Implementation principle: to determine whether a registry exists is determined by finding whether the registry contains the corresponding identifier.
Note: Windows XP and Windows 7 registry are stored in different ways, 32-bit and 64-bit operating system registry are stored in different ways, you need to determine separately. Only 32-bit operating systems are judged here.
Source code:
//// Check whether oracle is installed
Function number checkoracleisexist ()
String svoraclepath, nvvalue;
Number nkeytype, nvtype, nvsize;
Begin
// Defaut Regedit Root
Regdbsetdefaultroot (HKEY_LOCAL_MACHINE );
// Oralce Regedit path
If (regdbgetkeyvalueex ("Software \ oracle \ all_homes", "default_home", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
Return-1;
End;
// SQL Server 2000, SQL Server 2005, SQL Server 2008,
// SQL Server 2005 Express, SQL Server 2008 Express
// Check whether SQL Server is installed
Function number checksqlserver ()
String nvvalue;
Number nvtype, nvsize;
Begin
// Return-1;
// Defaut Regedit Root
Regdbsetdefaultroot (HKEY_LOCAL_MACHINE );
// SQL Server 2000
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server", "installedinstances", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
// The SQL Server 2005 version
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server 2005 redist \ Bol \ 2052 \ CurrentVersion", "version", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
// SQL Server 2008 Express
// If (regdbgetkeyvalueex ("SOFTWARE \ Microsoft SQL Server 2008 redist \ sqlncli10 \ 2052 \ CurrentVersion", "version", nvtype, nvvalue, nvsize) = 0) then
// Return 0;
// Endif;
// Express
If (regdbgetkeyvalueex ("Software \ Microsoft SQL Server \ sqlexpress \ setup", "sqlpath", nvtype, nvvalue, nvsize) = 0) then
Return 0;
Endif;
Return-1;
End;