Hello,
I'm currently working on a program that has to read values from the windows
registry.
I use the functions "RegOpenKey Ex", "RegCloseKe y" and "RegQueryValueE x" for
that.
If I can read the manual correctly (which I hope I can) I have to include
windows.h, winnt.h and winreg.h
The constructor of one of my classes looks like this:
NodeListReader: :NodeListReader (__int8 buffer)
{
HKEY *ptr1, *ptr2, *ptr3;
*sizeOfBuffer = 2081;
this->buffer = &buffer;
long temp = RegOpenKeyEx(HK EY_LOCAL_MACHIN E,"Software", 0,KEY_READ, ptr1);
temp = RegOpenKeyEx(*p tr1,"JavaSoft", 0,KEY_READ, *ptr2);
temp = RegOpenKeyEx(*p tr2,"Java Development Kit", 0,KEY_READ, *ptr3);
temp = RegQueryValueEx (*ptr3,"Current Version", NULL, REG_SZ, this->buffer,
*sizeOfBuffer);
temp = RegCloseKey(*pt r3);
temp = RegCloseKey(*pt r2);
temp = RegCloseKey(*pt r1);
}
When I try to compile it, I get these errors:
e:\nodelistcrea tor\nodelistrea der.h(46) : error C2664: 'RegOpenKeyExA' :
cannot convert parameter 5 from 'struct HKEY__ *' to 'struct HKEY__ ** '
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
e:\nodelistcrea tor\nodelistrea der.h(52) : error C2664: 'RegOpenKeyExA' :
cannot convert parameter 5 from 'struct HKEY__ *' to 'struct HKEY__ ** '
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
e:\nodelistcrea tor\nodelistrea der.h(58) : error C2664: 'RegQueryValueE xA' :
cannot convert parameter 4 from 'const int' to 'unsigned long *'
Conversion from integral type to pointer type requires
reinterpret_cas t, C-style cast or function-style cast
I don't really know why I get these errors, since the RegOpenKeyEx and
RegQueryValueEx functions expect a pointer to an open registry key.
That's exactly what I give!
Also, the errors state something about the functions "RegOpenKey ExA" and
"RegQueryValueE xA" (notice the 'A' in the end)
The MSDN-library doesn't give any info on those routines. Are they really
different routines that the ones without the 'A' in the end?
or is that just something the compiler adds??
thanks in advance!
--
Harbinger of Doom
I'm currently working on a program that has to read values from the windows
registry.
I use the functions "RegOpenKey Ex", "RegCloseKe y" and "RegQueryValueE x" for
that.
If I can read the manual correctly (which I hope I can) I have to include
windows.h, winnt.h and winreg.h
The constructor of one of my classes looks like this:
NodeListReader: :NodeListReader (__int8 buffer)
{
HKEY *ptr1, *ptr2, *ptr3;
*sizeOfBuffer = 2081;
this->buffer = &buffer;
long temp = RegOpenKeyEx(HK EY_LOCAL_MACHIN E,"Software", 0,KEY_READ, ptr1);
temp = RegOpenKeyEx(*p tr1,"JavaSoft", 0,KEY_READ, *ptr2);
temp = RegOpenKeyEx(*p tr2,"Java Development Kit", 0,KEY_READ, *ptr3);
temp = RegQueryValueEx (*ptr3,"Current Version", NULL, REG_SZ, this->buffer,
*sizeOfBuffer);
temp = RegCloseKey(*pt r3);
temp = RegCloseKey(*pt r2);
temp = RegCloseKey(*pt r1);
}
When I try to compile it, I get these errors:
e:\nodelistcrea tor\nodelistrea der.h(46) : error C2664: 'RegOpenKeyExA' :
cannot convert parameter 5 from 'struct HKEY__ *' to 'struct HKEY__ ** '
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
e:\nodelistcrea tor\nodelistrea der.h(52) : error C2664: 'RegOpenKeyExA' :
cannot convert parameter 5 from 'struct HKEY__ *' to 'struct HKEY__ ** '
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
e:\nodelistcrea tor\nodelistrea der.h(58) : error C2664: 'RegQueryValueE xA' :
cannot convert parameter 4 from 'const int' to 'unsigned long *'
Conversion from integral type to pointer type requires
reinterpret_cas t, C-style cast or function-style cast
I don't really know why I get these errors, since the RegOpenKeyEx and
RegQueryValueEx functions expect a pointer to an open registry key.
That's exactly what I give!
Also, the errors state something about the functions "RegOpenKey ExA" and
"RegQueryValueE xA" (notice the 'A' in the end)
The MSDN-library doesn't give any info on those routines. Are they really
different routines that the ones without the 'A' in the end?
or is that just something the compiler adds??
thanks in advance!
--
Harbinger of Doom
Comment