cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Hazard
Level 4

I didn't get registry value. What is wrong in my code ?

Hi, community.

My function returns empty value for my registry key.


function CheckOracleVersion()
STRING szFile;
STRING szDllLocation;
STRING szVersion;

NUMBER nvSize;
INT result;
INT nvType;
begin
nvSize = MAX_PATH;
nvType = REGDB_STRING;

if (RegDBGetKeyValueEx ("\\HKEY_LOCAL_MACHINE\\SOFTWARE\\ORACLE\\ODP.NET\\4.112.3.0", "DllPath", nvType, szDllLocation, nvSize)< 0) then
SprintfBox(INFORMATION, "RegDBGetKeyValueEx failed", "RegDBGetKeyValueEx failed");
endif;
szFile = szDllLocation + "\\" + "oraclient11.dll";
result = VerGetFileVersion (szFile, szVersion);
end;


This is the records in my registry
[CODE]
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\\SOFTWARE\\ORACLE\\ODP.NET\\4.112.3.0]
"DllPath"="C:\\Oracle\\product\\11.2.0\\bin"
"TraceFileName"="C:\\odpnet4.trc"
"TraceLevel"="0"
"TraceOption"="0"
"SelfTuning"="1"
"MaxStatementCacheSize"="100"
"DemandOraclePermission"="0"
"PerformanceCounters"="0"
"PromotableTransaction"="promotable"
"StatementCacheWithUdts"="1"
"UdtCacheSize"="4096"

[/CODE]

What is wrong in my code?
Labels (1)
0 Kudos
(3) Replies
TsungH
Level 12

If you have not, please refer to RegDBGetKeyValueEx.
0 Kudos
jforst
Level 2

Try removing the '\\' before HKEY_LOCAL_MACHINE...
0 Kudos
Hazard
Level 4

The general problem was, I think, with defined by default RegDBSetDefaultRoot.

This is the working code:


function CheckOracleVersion()
STRING szFile;
STRING szDllLocation;
STRING szVersion;
STRING szRegistry;
STRING szKey;
STRING szNumValue;

NUMBER nvSize;
INT result;
INT nvType;
NUMBER nRootKey;
begin
nvSize = MAX_PATH;

nvType = REGDB_STRING;

szDllLocation = "";

szKey = "DllPath";

nRootKey = HKEY_LOCAL_MACHINE;

result = RegDBSetDefaultRoot (nRootKey);

szRegistry = "SOFTWARE\\ORACLE\\ODP.NET\\4.112.3.0";

if (RegDBGetKeyValueEx (szRegistry, szKey, nvType, szDllLocation, nvSize)< 0) then
SprintfBox(INFORMATION, "RegDBGetKeyValueEx failed", "RegDBGetKeyValueEx failed");
endif;

szFile = szDllLocation + "\\" + "oraclient11.dll";
result = VerGetFileVersion (szFile, szVersion);
end;
0 Kudos