I need to fetch few information from the registry, I have made use of some code posted in the past.

The first information I retrieve from the registry is also fetched and displayed through a msgbox, but the second time qarun tries to open the registry it quits with an unknown exception error.

Does anyone know what i made wrong

Thank You
Best Regards

My actual code to access the windows history looks like this:


Declare DllFunc "uint RegSetValueExA( uint, str, uint, long, str, long) advapi32" RegSetString
Declare DllFunc "uint RegCreateKeyA( uint, str, uint*) advapi32" RegCreateKey
Declare DllFunc "uint RegQueryValueExA(uint, str, uint, long, str) advapi32" RegGetValue
Declare DllFunc "uint RegCloseKey(uint) advapi32" RegCloseKey
Declare DllFunc "uint RegOpenKeyExA( uint, str, long, uint, uint*) advapi32" RegOpenKey

Function Main

//Declare local variables
Var hdlKey //Handle to open key
Var hdlKeyb //Handle to open key
Var strType //DataType will be a string - (REG_SZ)
Var strData //reg string value
Var KeyOpened //Return value if key opened successfully. Equals 0 if it did.
Var DriverLocation //Location of the Oracle driver

SetStrLen(DriverLocation, 255) //Set the buffer length to receive the path from registry

KeyOpened = RegOpenKey( 0x80000002, "SOFTWARE\Microsoft\Windows\CurrentVersion", 0, 0x20019, hdlKey )

If KeyOpened = 0 Then
RegGetValue(hdlKey, "CommonFilesDir", 0, strType, DirectoryPath)
MsgBox("info", DirectoryPath)

KeyOpened = RegOpenKey( 0x80000002, "SOFTWARE\Microsoft\Windows\CurrentVersion", 0, 0x20019, hdlKey )

If KeyOpened = 0 Then
RegGetValue(hdlKey2, "ProgramFilesDir", 0, strType, DirectoryPath2)
MsgBox("info", DirectoryPath2)

End Function