From ab6fc2bddfcfffc5f2802eb95e0b2e2941d24e9d Mon Sep 17 00:00:00 2001 From: "cavin%netscape.com" Date: Fri, 10 Jan 2003 02:09:12 +0000 Subject: [PATCH] Fix for bug 182423. Look for conduit mgr dll in the registry entry for "Software\\U.S. Robotics\\Pilot Desktop\\Core" as well and restore registry back to point to Palm install dir after uninstall. r=ssu, sr=sspitzer. git-svn-id: svn://10.0.0.236/trunk@136117 18797224-902f-48f8-a5cc-f745e15eee43 --- .../windows/palmsync/PalmSyncInstall.cpp | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/mozilla/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp b/mozilla/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp index 544d26b235a..30ac3edca30 100644 --- a/mozilla/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp +++ b/mozilla/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "CondMgr.h" #include "HSAPI.h" @@ -147,19 +148,45 @@ int APIENTRY WinMain(HINSTANCE hInstance, // this function gets the install dir for installation int GetPalmDesktopInstallDirectory(TCHAR *pPDInstallDirectory, unsigned long *pSize) - { +{ HKEY key; // open the key - LONG rc = ::RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\palm.exe", &key); + LONG rc = ::RegOpenKey(HKEY_CURRENT_USER, "Software\\U.S. Robotics\\Pilot Desktop\\Core", &key); if (rc == ERROR_SUCCESS) { // get key value rc = ::RegQueryValueEx(key, "Path", NULL, NULL, (LPBYTE)pPDInstallDirectory, pSize); - if (rc == ERROR_SUCCESS) + if (rc == ERROR_SUCCESS) { + *pSize = _tcslen(pPDInstallDirectory); // windows only rc=0; // 0 is success for us + } // close the key ::RegCloseKey(key); } + + if(rc) { + HKEY key2; + // open the key + rc = ::RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\palm.exe", &key2); + if (rc == ERROR_SUCCESS) { + // get the default key value + rc = ::RegQueryValueEx(key2, "", NULL, NULL, + (LPBYTE)pPDInstallDirectory, pSize); + // get only the path (ie, strip out the exe name). note that we don't use string match + // for the exe name here since it's possilbe that the exe name in the default setting + // is different from the exe name in RegOpenKey() call. For example, the exe name in + // the default setting for "Software\\...\\App Paths\\pbrush.exe" is mspaint.exe. + if (rc == ERROR_SUCCESS) { + TCHAR *end = pPDInstallDirectory + _tcslen(pPDInstallDirectory); + while ((*end != '\\') && (end != pPDInstallDirectory)) + end--; + *end = '\0'; + rc=0; // 0 is success for us + } + // close the key + ::RegCloseKey(key2); + } + } return rc; } @@ -512,6 +539,14 @@ int UninstallConduit() dwReturnCode = (*lpfnCmRestoreHotSyncSettings)(TRUE); } + // this registry key is set by the RestoreHotSyncSettings to point incorrectly to Mozilla dir + // this should point to the Palm directory to enable sync with Palm Desktop. + HKEY key; + LONG rc = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\U.S. Robotics\\Pilot Desktop\\Core", + 0, KEY_ALL_ACCESS, &key); + if(rc == ERROR_SUCCESS) + ::RegSetValueEx(key, "Path", 0, REG_SZ, (const BYTE *) szPalmDesktopDir, size); + // Re-start HotSync if it was running before if( bHotSyncRunning ) StartHotSync(hHsapiDLL);