Okay, so I've been looking at this for quite some time. I think I know what the problem is, but my C++ skills are sad a best due to stuff like Java, C# and VB. So, I'm trying to pull information from the registry, and I have no problem getting it to work. I can pull REG_SZ values just fine. I can output them and everything. Now, I'm trying to get REG_DWORDs to work, but am having issues. When I have it look at something that has a DWORD value of like 546258943, the program spits out something like " ?Å ╪·"☺t·"" Unfortunately, this is not my intended output. So, the way I see it, I've got this char buffer that I'm filling with this numerical data, which it's interpreting as a character array what it outputs it. So, my dilemma is to get it not to do that.
Related Article:Objects vs Types: Strings, char, int.
is a solved C++ discussion thread by crapgarden that has 3 replies, was last updated 2 years ago and has been tagged with the keywords: c++, char, int, object, type.
You shouldn't just output rgValue, it is binary data unless Type has a value of REG_EXPAND_SZ, REG_MULTI_SZ, REG_SZ.
If the value in the registry is really a DWORD then Type should be REG_DWORD and size1 should be 4 on exit. In that case something (non-portable) like DWORD dwValue = *((DWORD*)rgValue); should do the trick. Alternatively just pass a pointer to a DWORD into RegQueryValueEx in the first place if you are sure of the type the key holds.