diff --git a/xpinstall/wizard/windows/palmsync/BrandName.rc b/xpinstall/wizard/windows/palmsync/BrandName.rc deleted file mode 100644 index a75e217ad141..000000000000 --- a/xpinstall/wizard/windows/palmsync/BrandName.rc +++ /dev/null @@ -1,8 +0,0 @@ -STRINGTABLE DISCARDABLE -BEGIN -#ifdef MOZ_THUNDERBIRD - IDS_BRAND_NAME "Thunderbird" -#else - IDS_BRAND_NAME "Mozilla" -#endif -END diff --git a/xpinstall/wizard/windows/palmsync/Makefile.in b/xpinstall/wizard/windows/palmsync/Makefile.in index bf0c1ca72ef4..4dad9828e707 100644 --- a/xpinstall/wizard/windows/palmsync/Makefile.in +++ b/xpinstall/wizard/windows/palmsync/Makefile.in @@ -69,10 +69,6 @@ XULAPP_DEFINES = \ -DEXTENSION_VERSION=$(MOZILLA_VERSION) \ $(NULL) -#ifdef MOZ_THUNDERBIRD -RCFLAGS += -DMOZ_THUNDERBIRD -#endif - endif diff --git a/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp b/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp index fdb465eda1a9..df32f50e64ea 100644 --- a/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp +++ b/xpinstall/wizard/windows/palmsync/PalmSyncInstall.cpp @@ -107,28 +107,25 @@ typedef int (WINAPI *mozDllRegisterServerPtr)(void); typedef int (WINAPI *mozDllUnregisterServerPtr)(void); // forward declaration -int InstallConduit(HINSTANCE hInstance, TCHAR *installPath); +int InstallConduit(HINSTANCE hInstance, TCHAR *installPath, TCHAR *appName); int UninstallConduit(); -void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg); +void ConstructMessage(HINSTANCE hInstance, TCHAR *appName, DWORD dwMessageId, TCHAR *formattedMsg); // Global vars BOOL gWasHotSyncRunning = FALSE; -void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg) +void ConstructMessage(HINSTANCE hInstance, TCHAR *appName, DWORD dwMessageId, TCHAR *formattedMsg) { // Load brand name and the format string. - TCHAR brandName[MAX_LOADSTRING]; TCHAR formatString[MAX_LOADSTRING]; - LoadString(hInstance, IDS_BRAND_NAME, brandName, MAX_LOADSTRING-1); LoadString(hInstance, dwMessageId, formatString, MAX_LOADSTRING-1); - // A few msgs needs two brand name substitutions. + // A few msgs needs two app name substitutions. if ((dwMessageId == IDS_SUCCESS_INSTALL) || - (dwMessageId == IDS_CONFIRM_INSTALL) || - (dwMessageId == IDS_ERR_REGISTERING_MOZ_DLL)) - _sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, brandName, brandName); + (dwMessageId == IDS_CONFIRM_INSTALL)) + _sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, appName, appName); else - _sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, brandName); + _sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, appName); formattedMsg[MAX_LOADSTRING-1]='\0'; } @@ -138,57 +135,104 @@ int APIENTRY WinMain(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { - TCHAR appTitle[MAX_LOADSTRING]; - TCHAR msgStr[MAX_LOADSTRING]; + TCHAR appTitle[MAX_LOADSTRING]; + TCHAR appName[MAX_LOADSTRING] = {0}; + TCHAR msgStr[MAX_LOADSTRING]; - int strResource=0; - int res=-1; + enum eActionType + { + eInstall, + eSilentInstall, + eUninstall, + eSilentUninstall + }; - // /p can only be used with a standard install, i.e., non-silent install - char *installDir = strstr(lpCmdLine, "/p"); - if (installDir) - installDir += 2; // advance past "/p", e.g., "/pC:/program files/mozilla/dist/bin" + int res = -1; - if(!strcmpi(lpCmdLine,"/u")) // un-install + char* installDir = NULL; + eActionType action = eInstall; + + if (__argc > 1) + { + char* arg; + // Skip the first arg + for (int i = 1; i < __argc; ++i) { - ConstructMessage(hInstance, IDS_APP_TITLE_UNINSTALL, appTitle); - ConstructMessage(hInstance, IDS_CONFIRM_UNINSTALL, msgStr); - if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES) - { - res = UninstallConduit(); - if(!res) - res = IDS_SUCCESS_UNINSTALL; - } - else - return 0; - } - else if (!strcmpi(lpCmdLine,"/us")) // silent un-install - { - return UninstallConduit(); - } - else if (!strcmpi(lpCmdLine,"/s")) // silent install - { - return InstallConduit(hInstance, installDir); - } - else // install - { - ConstructMessage(hInstance, IDS_APP_TITLE_INSTALL, appTitle); - ConstructMessage(hInstance, IDS_CONFIRM_INSTALL, msgStr); - if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES) - { - res = InstallConduit(hInstance, installDir); - if(!res) - res = IDS_SUCCESS_INSTALL; - } - } + // The calling's app brand name + arg = strstr(__argv[i], "/n"); + if (arg) + { + // advance pass app name + arg += 2; - if(res > IDS_ERR_MAX || res < IDS_ERR_GENERAL) - res = IDS_ERR_GENERAL; + // now get the name + strncpy(appName, arg, MAX_LOADSTRING - 1); - ConstructMessage(hInstance, res, msgStr); - MessageBox(NULL, msgStr, appTitle, MB_OK); + // Add a space onto the name so that we get the display right + strcat(appName, " "); + } + else + { + // /p can only be used with a standard install, + // i.e., non-silent install + arg = strstr(__argv[i], "/p"); + if (arg) + // move past the /p, default action is install. + installDir = arg + 2; + else if (!strcmpi(__argv[i], "/u")) + action = eUninstall; + else if (!strcmpi(__argv[i], "/us")) + action = eSilentUninstall; + else if (!strcmpi(__argv[i], "/s")) + action = eSilentInstall; + } + } + } + // Free the command line memory + LocalFree(__argv); + + switch (action) + { + case eInstall: + ConstructMessage(hInstance, appName, IDS_APP_TITLE_INSTALL, appTitle); + ConstructMessage(hInstance, appName, IDS_CONFIRM_INSTALL, msgStr); + + if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES) + { + res = InstallConduit(hInstance, installDir, appName); + if (!res) + res = IDS_SUCCESS_INSTALL; + } + break; + + case eSilentInstall: + return InstallConduit(hInstance, installDir, appName); + + case eUninstall: + ConstructMessage(hInstance, appName, IDS_APP_TITLE_UNINSTALL, appTitle); + ConstructMessage(hInstance, appName, IDS_CONFIRM_UNINSTALL, msgStr); + + if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES) + { + res = UninstallConduit(); + if (!res) + res = IDS_SUCCESS_UNINSTALL; + break; + } return 0; + + case eSilentUninstall: + return UninstallConduit(); + } + + if (res > IDS_ERR_MAX || res < IDS_ERR_GENERAL) + res = IDS_ERR_GENERAL; + + ConstructMessage(hInstance, appName, res, msgStr); + MessageBox(NULL, msgStr, appTitle, MB_OK); + + return 0; } // this function gets the install dir for installation @@ -426,7 +470,7 @@ char oldSettingsStr[500]; static char gSavedCwd[_MAX_PATH]; // installs our Conduit -int InstallConduit(HINSTANCE hInstance, TCHAR *installDir) +int InstallConduit(HINSTANCE hInstance, TCHAR *installDir, TCHAR *appName) { int dwReturnCode; BOOL bHotSyncRunning = FALSE; @@ -449,21 +493,27 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir) else strncpy(szConduitPath, installDir, sizeof(szConduitPath) - 1); + TCHAR shortConduitPath[_MAX_PATH]; + + // Try and get the short path name. + if (!GetShortPathName(szConduitPath, shortConduitPath, _MAX_PATH)) + // If failed, so just use the long one + strncpy(shortConduitPath, szConduitPath, _MAX_PATH); // take care of any possible string overwrites - if((strlen(szConduitPath) + strlen(DIRECTORY_SEPARATOR_STR) + strlen(CONDUIT_FILENAME)) > _MAX_PATH) + if((strlen(shortConduitPath) + strlen(DIRECTORY_SEPARATOR_STR) + strlen(CONDUIT_FILENAME)) > _MAX_PATH) return IDS_ERR_LOADING_CONDMGR; - // might already have conduit filename in szConduitPath if we're called recursively - if (!strstr(szConduitPath, CONDUIT_FILENAME)) + // might already have conduit filename in shortConduitPath if we're called recursively + if (!strstr(shortConduitPath, CONDUIT_FILENAME)) { - if (szConduitPath[strlen(szConduitPath) - 1] != DIRECTORY_SEPARATOR) - strcat(szConduitPath, DIRECTORY_SEPARATOR_STR); - strcat(szConduitPath, CONDUIT_FILENAME); + if (shortConduitPath[strlen(shortConduitPath) - 1] != DIRECTORY_SEPARATOR) + strcat(shortConduitPath, DIRECTORY_SEPARATOR_STR); + strcat(shortConduitPath, CONDUIT_FILENAME); } // Make sure the conduit dll exists struct _finddata_t dll_file; long hFile; - if( (hFile = _findfirst( szConduitPath, &dll_file )) == -1L ) + if( (hFile = _findfirst( shortConduitPath, &dll_file )) == -1L ) return IDS_ERR_CONDUIT_NOT_FOUND; // now register the Mozilla Palm Sync Support Dll @@ -593,17 +643,17 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir) //free the library so that the existing AB Conduit is unloaded properly FreeLibrary(hConduitManagerDLL); FreeLibrary(hHsapiDLL); - return InstallConduit(hInstance, szConduitPath); + return InstallConduit(hInstance, shortConduitPath, appName); } } if( dwReturnCode == 0 ) { (*lpfnCmSetCreatorValueString) (CREATOR, "oldConduitSettings", oldSettingsStr); - dwReturnCode = (*lpfnCmSetCreatorName)(CREATOR, szConduitPath); + dwReturnCode = (*lpfnCmSetCreatorName)(CREATOR, shortConduitPath); if( dwReturnCode != 0 ) return dwReturnCode; TCHAR title[MAX_LOADSTRING]; // Construct conduit title (the one displayed in HotSync Mgr's Custom...list).. - ConstructMessage(hInstance, IDS_CONDUIT_TITLE, title); + ConstructMessage(hInstance, appName, IDS_CONDUIT_TITLE, title); dwReturnCode = (*lpfnCmSetCreatorTitle)(CREATOR, title); if( dwReturnCode != 0 ) return dwReturnCode; dwReturnCode = (*lpfnCmSetCreatorRemote)(CREATOR, REMOTE_DB); diff --git a/xpinstall/wizard/windows/palmsync/PalmSyncInstall.rc b/xpinstall/wizard/windows/palmsync/PalmSyncInstall.rc index 4e0cfe233752..ee2a4413ef60 100644 --- a/xpinstall/wizard/windows/palmsync/PalmSyncInstall.rc +++ b/xpinstall/wizard/windows/palmsync/PalmSyncInstall.rc @@ -73,34 +73,34 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // String Table // +// Note these strings don't have a space after %s because the code adds that for us +// (just in case we've not got a name to dispaly). STRINGTABLE DISCARDABLE BEGIN - IDS_APP_TITLE_INSTALL "%s Address Book Palm Sync Install" - IDS_APP_TITLE_UNINSTALL "%s Address Book Palm Sync Uninstall" - IDS_CONDUIT_TITLE "%s Address Book" + IDS_APP_TITLE_INSTALL "%sAddress Book Palm Sync Install" + IDS_APP_TITLE_UNINSTALL "%sAddress Book Palm Sync Uninstall" + IDS_CONDUIT_TITLE "%sAddress Book" IDC_PALMSYNCINSTALL "PALMSYNCINSTALL" - IDS_ERR_GENERAL "Error in (un)installing the %s Address Book Palm Sync Conduit" - IDS_ERR_LOADING_CONDMGR "Error in loading the Conduit Manager while (un)installing the %s Address Book Palm Sync Conduit" + IDS_ERR_GENERAL "Error in (un)installing the %sAddress Book Palm Sync Conduit" + IDS_ERR_LOADING_CONDMGR "Error in loading the Conduit Manager while (un)installing the %sAddress Book Palm Sync Conduit" END STRINGTABLE DISCARDABLE BEGIN - IDS_ERR_HSAPI_NOT_FOUND "Could not find the HSAPI.dll while (un)installing the %s Address Book Palm Sync Conduit" + IDS_ERR_HSAPI_NOT_FOUND "Could not find the HSAPI.dll while (un)installing the %sAddress Book Palm Sync Conduit" IDS_ERR_CONDUIT_NOT_FOUND - "Could not find the %s Address Book Palm Sync Conduit to install" + "Could not find the %sAddress Book Palm Sync Conduit to install" IDS_ERR_HOTSYNC_IN_PROGRESS - "A Palm HotSync operation is in progress, let it complete first then install the %s Address Book Palm Sync Conduit" + "A Palm HotSync operation is in progress, let it complete first then install the %sAddress Book Palm Sync Conduit" IDS_ERR_FINDING_INSTALL_DIR - "Could not find the directory to install the %s Address Book Palm Sync Conduit." - IDS_SUCCESS_INSTALL "%s Address Book Palm Sync was successfully installed. Using your Palm device, perform a HotSync operation to synchronize your Palm device's address book with your %s address book." - IDS_SUCCESS_UNINSTALL "%s Address Book Palm Sync was successfully uninstalled. Palm Desktop synchronization with your Palm device is now restored." - IDS_CONFIRM_INSTALL "You are about to add the %s Address Book conduit to your Palm Hot Sync installation, which may remove the Palm Desktop conduit. Do you want to continue?" - IDS_CONFIRM_UNINSTALL "You are about to uninstall %s Address Book Palm Sync. This will restore Palm Desktop synchronization. Do you want to continue?" + "Could not find the directory to install the %sAddress Book Palm Sync Conduit." + IDS_SUCCESS_INSTALL "%sAddress Book Palm Sync was successfully installed. Using your Palm device, perform a HotSync operation to synchronize your Palm device's address book with your %saddress book." + IDS_SUCCESS_UNINSTALL "%sAddress Book Palm Sync was successfully uninstalled. Palm Desktop synchronization with your Palm device is now restored." + IDS_CONFIRM_INSTALL "You are about to add the %sAddress Book conduit to your Palm Hot Sync installation, which may remove the Palm Desktop conduit. Do you want to continue?" + IDS_CONFIRM_UNINSTALL "You are about to uninstall %sAddress Book Palm Sync. This will restore Palm Desktop synchronization. Do you want to continue?" IDS_ERR_REGISTERING_MOZ_DLL - "Failed to register the %s's Palm Sync Support Proxy Dll while installing the %s Address Book Palm Sync Conduit." + "Failed to register the Palm Sync Support Proxy Dll while installing the %sAddress Book Palm Sync Conduit." END -#include "BrandName.rc" - #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/xpinstall/wizard/windows/palmsync/resource.h b/xpinstall/wizard/windows/palmsync/resource.h index 062b8d702c3e..ef708198c6cc 100644 --- a/xpinstall/wizard/windows/palmsync/resource.h +++ b/xpinstall/wizard/windows/palmsync/resource.h @@ -39,7 +39,6 @@ #define IDS_APP_TITLE_INSTALL 103 #define IDS_APP_TITLE_UNINSTALL 104 #define IDS_CONDUIT_TITLE 105 -#define IDS_BRAND_NAME 106 #define IDI_PALMSYNCINSTALL 107 #define IDI_SMALL 108 #define IDC_PALMSYNCINSTALL 109