bool GetWinShellLocation(CString &sWinShell) { CRegistry theRegistry; sWinShell.Empty(); g_sEditor.Empty(); if (theRegistry.Connect(HKEY_LOCAL_MACHINE) == FALSE) { // theLog("Registry: can't connect to HKEY_LOCAL_MACHINE (Error %d)\n", // GetLastError()); return false; } if (theRegistry.Open(TEXT("SOFTWARE\\Classes\\tex_auto_file\\DefaultIcon"), (CRegistry::CreatePermissions)CRegistry::permissionRead) == FALSE ) { // theLog("Registry: can't open WinShell.Document\\DefaultIcon key (Error %d)\n", // GetLastError()); theRegistry.Close(); return false; } theRegistry.GetValue("", sWinShell); theRegistry.Close(); // It might be quoted ! sWinShell.Remove(TEXT('\"')); sWinShell.Remove(TEXT('\'')); ::GetParentDirectory(sWinShell); g_sEditor = ConcatPath(sWinShell, "WinShell.exe"); if (! FileExists(g_sEditor)) { g_sEditor.Empty(); sWinShell.Empty(); return false; } return true; }
////////////////////////////////////////////////////////////////////// // GetOraNLSFromReg CAMqa67738 & 67948 // // Retrieve the Oracle NLS_LANG varaible from the registry. It //will only retrieve the NLS_LANG from the last installed Oracle. // ////////////////////////////////////////////////////////////////////// CString ArbI18N::GetOraNLSFromReg() { CRegistry registry; CString cstrNLSLANG(_T("")); CString cstrValueName; BOOL fRetStatus = registry.Connect((HKEY)CRegistry::keyLocalMachine); if (!fRetStatus) return _T(""); // Failed to connect to the registry. // Get the ID of the last installed Oracle home. // Open the key for the last installed home ID CString cstrSubKey(_T("SOFTWARE\\ORACLE\\ALL_HOMES")); // Open the key for last home id and retrieve it. fRetStatus = registry.Open(cstrSubKey); if (!fRetStatus) return _T(""); CString cstrLastHomeID; cstrValueName = _T("LAST_HOME"); fRetStatus = registry.GetValue(cstrValueName, cstrLastHomeID); if (!fRetStatus) return _T(""); // Open the key to the NLS_LANG and retrieve it. cstrSubKey = _T("SOFTWARE\\ORACLE\\HOME"); cstrSubKey += cstrLastHomeID; cstrValueName = _T("NLS_LANG"); fRetStatus = registry.Open(cstrSubKey); if (!fRetStatus) return _T(""); fRetStatus = registry.GetValue(cstrValueName, cstrNLSLANG); if (!fRetStatus) return _T(""); return cstrNLSLANG; } //GetOraNLSFromReg
bool GetEditorLocation(CString &sEditor) { CRegistry theRegistry; bool bRet = false; if (sEditor.IsEmpty()) { if (theRegistry.Connect(HKEY_CURRENT_USER) == FALSE) { return false; } if (theRegistry.Open(g_sRegKey) == TRUE) { theRegistry.GetValue("TeXEditor", sEditor); } theRegistry.Close(); } return (!sEditor.IsEmpty()); }