Win NT 4.0 - Win 95 Registry Reading Problems 
Author Message
 Win NT 4.0 - Win 95 Registry Reading Problems

I have an app that was written in VC++ 6.0 on an Win NT 4.0 system
When I run this app on a 95 system, I get the error:
<myapp> has caused a page fault in MSCVRT.dll.
I thought putting SP2 in would help, but it didn't.
I have the most current version of those DLL's.  Here is the code that
causes the error:

HKEY hKey;
CString regKey ="SOFTWARE\\DMHRS Targetdir\\";
LPVOID lpMsgBuf;
long regOpenSuccess =
RegOpenKeyEx(HKEY_LOCAL_MACHINE,regKey,0,KEY_READ,&hKey);
FormatMessage(     FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |     FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    GetLastError(),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (LPTSTR) &lpMsgBuf,
    0,
   NULL );
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
char buf[512];
// DWORD type;
DWORD size;
CString entry = "TargetDir";
size = sizeof(buf) * sizeof(char);
long regQuerySuccess =
RegQueryValueExA(hKey,entry,NULL,NULL,(LPBYTE)buf,&size);
FormatMessage(     FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |     FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    GetLastError(),
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (LPTSTR) &lpMsgBuf,
    0,
   NULL );

The RegOpenKey function works just fine (I get "Operation completed
Successfully",) but the RegQueryValueExA function (even without the A)
returns
Missing library file needed to complete this function (or something like
that,)

Any idea why this is popping up?

Thanks.
dk



Tue, 07 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Registry - Win 95/Win NT

2. Win 95/95 to Win NT

3. Win NT to Win 95

4. Porting application from Win 95 to Win NT

5. Q: Differences WIN NT / WIN 95 in VC++ 5.0

6. Win NT vs. Win 95

7. DLL on Win NT vs. Win 95

8. DLL on Win NT vs. Win 95

9. Win NT vs Win 95/98

10. Win NT to Win 95

11. Win 95 -> Win NT

12. Dialog behaviour in Win 95 and Win NT

 

 
Powered by phpBB® Forum Software