G
Guest
I have problem with the vc++ 6 compiler and its libraries on windows 200
Create the following new ke
HKEY_LOCAL_MACHINE\SOFTWARE\SURI\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9
inside the key create the strin
"Assembly"="P24R3O35T1E4C7T14U26S
============================
The file test.cpp looks lik
============================
------------------------------------------------------------------------------------------
/* The following is the header file included to accomadate vc++6*
#include<AFXWIN.H
#include <string.h
#include <windows.h
#include <tchar.h
#include <stdio.h
#include <malloc.h
/* To test This code create the following registry entrie
Create the following new ke
HKEY_LOCAL_MACHINE\SOFTWARE\SURI\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9
inside the key create the strin
"Assembly"="P24R3O35T1E4C7T14U26S
*
int function1(void)
int main (int argc, char* argv [])
char dir1 [1000]
int abc=0
abc=function1()
} /* main *
int function1(void
/* Local variable declaration*
HKEY hKey,hKey_1
DWORD dwType_1
DWORD dwSize
LONG queryResult
char itime[60]
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\SURI\\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9}"),0,KEY_QUERY_VALUE,&hKey_1))==ERROR_SUCCESS
queryResult = RegQueryValueEx(hKey_1, _T("Assembly"), NULL, &dwType_1,(LPBYTE)&itime, &dwSize)
if(ERROR_SUCCESS!=queryResult
printf("Error with RegQueryValueEx \n")
/* Check if the installation time is null
it should not happen once VSEP is installed *
if( strlen(itime) >= 1
MessageBox(NULL,"Success fully read the registry","Security Check",MB_OK)
/* Else means the user has deleted the installTime registry entry from the registry
We force to expire VSEP and delete the Package key *
else
MessageBox(NULL,"Error unable to read the registry","Security Check",MB_OK)
exit(1)
return 0
------------------------------------------------------------------------------------------
==========================================================
Compile and line the code using the following command line
==========================================================
"c:/Program Files/Microsoft Visual Studio/vc98/Bin/cl.exe" -c -nologo -W4 -GX -D "WIN32" -D "_WINDOWS" -FD -MT -Fotest.o test.cp
cl -otest.exe -nologo -W4 -GX -D "WIN32" -D "_WINDOWS" -FD -D_EVALUATION -MT test.o LIBCMT.lib /link /force:multipl
execute test .ex
The program would be able to successfully read the registry entry from windows registr
and we would get the message "Success fully read the registry
--------------------------------------------------------------------------------------------
=======
Proble
=======
change the lin
char dir1 [1000];
t
char dir1[10000]
compile and link using the same set of command lines abov
and execute test.ex
We would get the error message
"Error unable to read the registry
This is because the function cal
queryResult = RegQueryValueEx(hKey_1, _T("Assembly"), NULL, &dwType_1,(LPBYTE)&itime, &dwSize)
malfunction
Please help me in identifying the reason for malfunction of the function RegQueryValueE
-----------------------------------------------------------------------------------
Create the following new ke
HKEY_LOCAL_MACHINE\SOFTWARE\SURI\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9
inside the key create the strin
"Assembly"="P24R3O35T1E4C7T14U26S
============================
The file test.cpp looks lik
============================
------------------------------------------------------------------------------------------
/* The following is the header file included to accomadate vc++6*
#include<AFXWIN.H
#include <string.h
#include <windows.h
#include <tchar.h
#include <stdio.h
#include <malloc.h
/* To test This code create the following registry entrie
Create the following new ke
HKEY_LOCAL_MACHINE\SOFTWARE\SURI\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9
inside the key create the strin
"Assembly"="P24R3O35T1E4C7T14U26S
*
int function1(void)
int main (int argc, char* argv [])
char dir1 [1000]
int abc=0
abc=function1()
} /* main *
int function1(void
/* Local variable declaration*
HKEY hKey,hKey_1
DWORD dwType_1
DWORD dwSize
LONG queryResult
char itime[60]
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\SURI\\{6FE7A40D-F0EA-4008-A238-3C306E2B2EA9}"),0,KEY_QUERY_VALUE,&hKey_1))==ERROR_SUCCESS
queryResult = RegQueryValueEx(hKey_1, _T("Assembly"), NULL, &dwType_1,(LPBYTE)&itime, &dwSize)
if(ERROR_SUCCESS!=queryResult
printf("Error with RegQueryValueEx \n")
/* Check if the installation time is null
it should not happen once VSEP is installed *
if( strlen(itime) >= 1
MessageBox(NULL,"Success fully read the registry","Security Check",MB_OK)
/* Else means the user has deleted the installTime registry entry from the registry
We force to expire VSEP and delete the Package key *
else
MessageBox(NULL,"Error unable to read the registry","Security Check",MB_OK)
exit(1)
return 0
------------------------------------------------------------------------------------------
==========================================================
Compile and line the code using the following command line
==========================================================
"c:/Program Files/Microsoft Visual Studio/vc98/Bin/cl.exe" -c -nologo -W4 -GX -D "WIN32" -D "_WINDOWS" -FD -MT -Fotest.o test.cp
cl -otest.exe -nologo -W4 -GX -D "WIN32" -D "_WINDOWS" -FD -D_EVALUATION -MT test.o LIBCMT.lib /link /force:multipl
execute test .ex
The program would be able to successfully read the registry entry from windows registr
and we would get the message "Success fully read the registry
--------------------------------------------------------------------------------------------
=======
Proble
=======
change the lin
char dir1 [1000];
t
char dir1[10000]
compile and link using the same set of command lines abov
and execute test.ex
We would get the error message
"Error unable to read the registry
This is because the function cal
queryResult = RegQueryValueEx(hKey_1, _T("Assembly"), NULL, &dwType_1,(LPBYTE)&itime, &dwSize)
malfunction
Please help me in identifying the reason for malfunction of the function RegQueryValueE
-----------------------------------------------------------------------------------