RegQueryValueEx failing sometimes. 
Author Message
 RegQueryValueEx failing sometimes.

I've found that RegQueryValueEx fails with return code 234 (ERROR_MORE_DATA)
sometimes.  What does this error mean?

If I call RegQueryValueEx on ORACLE_HOME first and RecoveryFolder second,
the RecoveryFolder call fails.  If I switch the order (RecoveryFolder 1st,
ORACLE_HOME 2nd) they both are successful.

 LONG llRet;
 HKEY regkey;
 DWORD ldwSize;
 unsigned char lpszOracleHome[100], lpszRecoveryFolder[100];

 llRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\ORACLE", 0, KEY_READ,
 llRet = RegQueryValueEx(regkey, "ORACLE_HOME", NULL, NULL, lpszOracleHome,
 llRet = RegCloseKey(regkey);

// RecoveryFolder
 llRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\FAMOUS Database", 0,
KEY_READ, &regkey);
 llRet = RegQueryValueEx(regkey, "RecoveryFolder", NULL, NULL,
lpszRecoveryFolder, &ldwSize);
 llRet = RegCloseKey(regkey);

Any ideas?
Thanks - Jim.

Tue, 27 Feb 2001 03:00:00 GMT  
 RegQueryValueEx failing sometimes.


> I've found that RegQueryValueEx fails with return code 234 (ERROR_MORE_DATA)
> sometimes.  What does this error mean?

You need to initialize ldwSize to the length of your values. After the first
call it will contain the length of string returned. I seem to recall that you
can use a RegQueryValueEx call with a NULL pointer instead of a string address
and it will return the length of the value so that you can create a big enough
buffer for the value.

To send mail, change spam-me-not to msn

Fri, 02 Mar 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. RegQueryValueEx() fails when called from an NT Service

2. DCOM Proxy stub DLL fails to register - SOMETIMES ...

3. SetCooperativeLevel fails SOMETIMES...why?

4. CreateProcess() sometimes fails to start QuickWin application

5. Socket Error: WSAGetOverlappedResult fails sometimes

6. debug version works, release version sometimes fails

7. ICON fails to load sometimes

8. RpcNsBindingLookupBegin SOMETIMES fails

9. LoadFrame sometimes fails on NT, then requires reboot to fix

10. GetMethod() sometimes fails in recursive call

11. MFC Serialize: sometimes OK, sometimes not!

12. Listbox: Sometimes allowing multiple selection and sometimes not ?


Powered by phpBB® Forum Software