如何在 setup.rul 中通过 installshield 安装 64 位 odbc?
how to install 64-bit odbc by installshield in setup.rul?
//install 32-bit odbc dsn
szFilePath="\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\SysWOW64\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
//install 64-bit odbc dsn
szFilePath="\SOFTWARE\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\System32\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
这是 Setup.rul
中的部分代码。上半部分是安装 32 位 odbc dsn。它运作良好。我可以在 regedit
中查看和使用我的 32 位数据源。
下半场不行。让我很困惑,我发现路径 \SOFTWARE\ODBC\ODBC.INI\
是无效的,RegDBSetKeyValueEx
总是设置值到路径 \SOFTWARE\Wow6432Node\ODBC\ODBC.INI\
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
szFilePath="\SOFTWARE\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\System32\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
//install 32-bit odbc dsn
szFilePath="\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\SysWOW64\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
//install 64-bit odbc dsn
szFilePath="\SOFTWARE\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\System32\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
这是 Setup.rul
中的部分代码。上半部分是安装 32 位 odbc dsn。它运作良好。我可以在 regedit
中查看和使用我的 32 位数据源。
下半场不行。让我很困惑,我发现路径 \SOFTWARE\ODBC\ODBC.INI\
是无效的,RegDBSetKeyValueEx
总是设置值到路径 \SOFTWARE\Wow6432Node\ODBC\ODBC.INI\
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
szFilePath="\SOFTWARE\ODBC\ODBC.INI\"^szDemoDB;
RegDBSetKeyValueEx(szFilePath,"Database",REGDB_STRING, szDemoDB,-1);
RegDBSetKeyValueEx(szFilePath,"Driver",REGDB_STRING, "c:\Windows\System32\sqlncli11.dll",-1);
RegDBSetKeyValueEx(szFilePath,"Server",REGDB_STRING,"(localdb)\.\v11.0",-1);
szFilePath="\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources";
RegDBSetKeyValueEx(szFilePath,szDemoDB,REGDB_STRING, "SQL Server Native Client 11.0",-1);
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;