Пример #1
0
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;
}
Пример #2
0
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());
}
Пример #3
0
bool SaveEditorLocation(CString & sEditor)
{
    CRegistry theRegistry;
    bool bRet = false;

    if (theRegistry.Connect(HKEY_CURRENT_USER) == FALSE) {
        return false;
    }
    if (theRegistry.Create(g_sRegKey) == FALSE) {
        goto exit_2;
    }
    if (theRegistry.SetValue("TeXEditor", (LPCTSTR)sEditor) == FALSE) {
        goto exit_2;
    }
    bRet = true;

 exit_2:
    theRegistry.Close();
    return bRet;
}
Пример #4
0
bool __cdecl CleanupCDRom(LPVOID pParam)
{
    CString sTmp = g_sVarTexmf;
    GetParentDirectory(sTmp);
    RecursivelyRemove(sTmp);

#if 0
    CString sWinShellDir;
    if (! GetWinShellLocation(sWinShellDir) || ! DirectoryExists(sWinShellDir))
        return true;

    if (MessageBox(NULL, "Do you want to remove WinShell too ?", 
                   NULL, MB_YESNO | MB_ICONINFORMATION) == IDYES) {
        char buf[_MAX_PATH];
        CString sUninstCmd;
        for (int i = 0; i < 1000; i++) {
            wsprintf(buf, "unins%.3d.exe", i);
            sUninstCmd = ConcatPath(sWinShellDir, buf);
            if (! FileExists(sUninstCmd)) {
                i--;
                break;
            }
        }
        if (i > -1) {
            wsprintf(buf, "unins%.3d.exe", i);
            sUninstCmd = ConcatPath(sWinShellDir, buf);
            RunProcess(sUninstCmd, true);
            RecursivelyRemove(sWinShellDir);
        }
    }
#endif

    // Remove the registry key
    CRegistry theRegistry;
    if (theRegistry.Connect(HKEY_CURRENT_USER) == TRUE) {
        theRegistry.DeleteKey(g_sRegKey);
    }

    return true;
}
Пример #5
0
//////////////////////////////////////////////////////////////////////
//	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