📄 setup.rul
字号:
endswitch;UpdateRegistry: SetStatusWindow(95, "Creating registry entries..."); Delay(2); RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); Disable(LOGGING); // Create ODBC Core Subkey (if it doesn't exist) // (But don't create uninstall information for it) szKey = ODBC_CORE_KEY; nResult = RegDBCreateKeyEx(szKey, ""); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create ODBC Core subkey.", SEVERE); exit; endif; // Create Installed Driver Key (if it doesn't exist) // (But don't create uninstall information for it) szKey = ODBC_DRIVERS_KEY; nResult = RegDBCreateKeyEx(szKey, ""); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create ODBC Drivers subkey.", SEVERE); exit; endif; // Increment Driver Manager Component UsageCount szKey = ODBC_CORE_KEY; szName = "UsageCount"; if (RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize) < 0) then ComponentUsageCount = 0; endif; // MessageBox("Current Driver Manager Component Usage Count = " + svValue, INFORMATION); StrToNum(ComponentUsageCount, svValue); ComponentUsageCount = ComponentUsageCount + 1; NumToStr(szTmp, ComponentUsageCount); // MessageBox("New Driver Manager Component Usage Count = " + szTmp, INFORMATION); nResult = RegDBSetKeyValueEx(szKey, szName, REGDB_NUMBER, szTmp, -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to increment Driver Manager component usage count.", SEVERE); exit; endif; // Re-enable logging now Enable(LOGGING); // set ODBC Drivers Subkey (installed) szKey = ODBC_DRIVERS_KEY; nResult = RegDBSetKeyValueEx(szKey, DRIVER_NAME, REGDB_STRING, "Installed", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'Installed' key value.", SEVERE); exit; endif; // Driver Specification Subkey (PostgreSQL) szKey = ODBC_COMP_KEY + "\\" + DRIVER_NAME; nResult = RegDBCreateKeyEx(szKey, ""); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create ODBC Driver Key.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "APILevel", REGDB_STRING, "1", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'APILevel' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "ConnectFunctions", REGDB_STRING, "YYN", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'ConnectFunctions' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "Driver", REGDB_STRING, WINSYSDIR ^ DRIVER_FILE, -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'Driver' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "DriverODBCVer", REGDB_STRING, "02.00", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'DriverODBCVer' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "FileUsage", REGDB_STRING, "0", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'FileUsage' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "Setup", REGDB_STRING, WINSYSDIR ^ DRIVER_FILE, -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'Setup' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "SQLLevel", REGDB_STRING, "1", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'SQLLevel' key value.", SEVERE); exit; endif; nResult = RegDBSetKeyValueEx(szKey, "UsageCount", REGDB_NUMBER, "1", -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'UsageCount' key value.", SEVERE); exit; endif; pos = StrFind(CMDLINE, "UseDeclareFetch="); if (pos >= 0) then StrSub(svValue, CMDLINE, pos + 16, 1); nResult = RegDBSetKeyValueEx(szKey, "UseDeclareFetch", REGDB_STRING, svValue, -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'UseDeclareFetch' key value.", SEVERE); exit; endif; endif; pos = StrFind(CMDLINE, "Protocol="); if (pos >= 0) then StrSub(svValue, CMDLINE, pos + 9, 3); nResult = RegDBSetKeyValueEx(szKey, "Protocol", REGDB_STRING, svValue, -1); if (nResult < 0) then MessageBeep(0); MessageBox("Unable to create 'Protocol' key value.", SEVERE); exit; endif; endif;RenameOld: if (FindFile(WINSYSDIR, OLD_DRIVER_FILE, svFileName) = 0) then szMessage = "Renaming old driver to " + OLD_DRIVER_FILE_RENAMED + " ..."; SetStatusWindow(98, szMessage); Delay(1); Disable(LOGGING); SRCDIR= WINSYSDIR; TARGETDIR = WINSYSDIR; RenameFile(OLD_DRIVER_FILE, OLD_DRIVER_FILE_RENAMED); Enable(LOGGING); endif;Done: Delay(1); SetStatusWindow(100, "Installation complete"); Delay(1); Disable(STATUSDLG); if (BATCH_INSTALL = TRUE) then szMsg = "Some files could not be updated because they are " + "currently in use by other programs on the system. " + "Files in use will be updated the next time you restart " + "your system."; RebootDialog("Restart Windows", szMsg, SYS_BOOTMACHINE); CommitSharedFiles(0); szMsg = "Driver setup complete.\n\nReboot your system to complete the installation."; MessageBeep(0); MessageBox(szMsg, INFORMATION); else szMsg = "Driver installation completed successfully."; MessageBeep(0); MessageBox(szMsg, INFORMATION); endif; exit;/*---------------------------------------------------------------------------*\ * * Function: SetupScreen * * Purpose: This function will set up the screen look. This includes * colors, fonts, text to be displayed, etc. * * * Input: * * Returns: * * Comments:\*---------------------------------------------------------------------------*/function SetupScreen() begin Enable( INDVFILESTATUS ); SetTitle( APP_NAME + " Setup", 28, WHITE ); SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text. Enable( BACKGROUND ); end;function FileCompare(szCompInfoDate, szCompInfoTime, szFileInfoDate, szFileInfoTime) STRING year, month, day, file_date, file_time; NUMBER nResult; begin StrSub(year, szFileInfoDate, 2, 2); StrSub(month, szFileInfoDate, 5, 2); StrSub(day, szFileInfoDate, 8, 2); file_date = month + "-" + day + "-" + year; nResult = StrCompare(szCompInfoDate, file_date); if (nResult != 0) then return nResult; endif; StrSub(file_time, szFileInfoTime, 0, 5); // MessageBox("Comp = " + szCompInfoDate + " " + szCompInfoTime + ", File = " + file_date + " " + file_time, INFORMATION); nResult = StrCompare(szCompInfoTime, file_time); return nResult; end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -