handle palm desktop 6.01, no bug, sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@165210 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
f37baac8dd
commit
e537247792
@ -160,21 +160,15 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
res = IDS_SUCCESS_UNINSTALL;
|
||||
}
|
||||
else
|
||||
return TRUE;;
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmpi(lpCmdLine,"/us")) // silent un-install
|
||||
{
|
||||
res = UninstallConduit();
|
||||
if(!res)
|
||||
return TRUE; // success
|
||||
return res;
|
||||
return UninstallConduit();
|
||||
}
|
||||
else if (!strcmpi(lpCmdLine,"/s")) // silent install
|
||||
{
|
||||
res = InstallConduit(hInstance, installDir);
|
||||
if(!res)
|
||||
return TRUE; // success
|
||||
return res;
|
||||
return InstallConduit(hInstance, installDir);
|
||||
}
|
||||
else // install
|
||||
{
|
||||
@ -194,7 +188,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
ConstructMessage(hInstance, res, msgStr);
|
||||
MessageBox(NULL, msgStr, appTitle, MB_OK);
|
||||
|
||||
return TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// this function gets the install dir for installation
|
||||
@ -429,6 +423,7 @@ char *mystrsep(char **stringp, char delim)
|
||||
}
|
||||
|
||||
char oldSettingsStr[500];
|
||||
static char gSavedCwd[_MAX_PATH];
|
||||
|
||||
// installs our Conduit
|
||||
int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||
@ -461,7 +456,8 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||
// might already have conduit filename in szConduitPath if we're called recursively
|
||||
if (!strstr(szConduitPath, CONDUIT_FILENAME))
|
||||
{
|
||||
strcat(szConduitPath, DIRECTORY_SEPARATOR_STR);
|
||||
if (szConduitPath[strlen(szConduitPath) - 1] != DIRECTORY_SEPARATOR)
|
||||
strcat(szConduitPath, DIRECTORY_SEPARATOR_STR);
|
||||
strcat(szConduitPath, CONDUIT_FILENAME);
|
||||
}
|
||||
// Make sure the conduit dll exists
|
||||
@ -492,6 +488,12 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||
HINSTANCE hConduitManagerDLL;
|
||||
if( (dwReturnCode=GetPalmDesktopInstallDirectory(szPalmDesktopDir, &desktopSize)) == 0 )
|
||||
{
|
||||
// need to switch current working directory to directory with palm dlls
|
||||
// because of a bug in Palm Desktop 6.01
|
||||
|
||||
GetCurrentDirectory(sizeof(gSavedCwd), gSavedCwd);
|
||||
SetCurrentDirectory(szPalmDesktopDir);
|
||||
|
||||
if( (dwReturnCode = LoadConduitManagerDll(&hConduitManagerDLL, szPalmDesktopDir)) != 0 )
|
||||
// load it from local dir if present by any chance
|
||||
if( (dwReturnCode = LoadConduitManagerDll(&hConduitManagerDLL, ".")) != 0 )
|
||||
@ -543,6 +545,12 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||
return(IDS_ERR_LOADING_CONDMGR);
|
||||
}
|
||||
|
||||
szOldCreatorTitle[0] = '\0';
|
||||
szOldCreatorName[0] = '\0';
|
||||
szOldRemote[0] = '\0';
|
||||
szOldCreatorTitle[0] = '\0';
|
||||
szOldCreatorFile[0] = '\0';
|
||||
szOldCreatorDirectory[0] = '\0';
|
||||
// get settings for old conduit
|
||||
int remoteBufSize = sizeof(szOldRemote);
|
||||
(*lpfnCmGetCreatorRemote) (CREATOR, szOldRemote, &remoteBufSize);
|
||||
@ -615,7 +623,11 @@ int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||
// Re-start HotSync if it was running before
|
||||
if( gWasHotSyncRunning )
|
||||
StartHotSync(hHsapiDLL);
|
||||
|
||||
|
||||
// restore cwd, if we changed it.
|
||||
if (gSavedCwd[0])
|
||||
SetCurrentDirectory(gSavedCwd);
|
||||
|
||||
return(dwReturnCode);
|
||||
}
|
||||
|
||||
@ -641,6 +653,12 @@ int UninstallConduit()
|
||||
else if( (dwReturnCode = LoadConduitManagerDll(&hConduitManagerDLL, ".")) != 0 )
|
||||
return(dwReturnCode);
|
||||
|
||||
// need to switch current working directory to directory with palm dlls
|
||||
// because of a bug in Palm Desktop 6.01
|
||||
|
||||
GetCurrentDirectory(sizeof(gSavedCwd), gSavedCwd);
|
||||
SetCurrentDirectory(szPalmDesktopDir);
|
||||
|
||||
// Prepare to uninstall the conduit using Conduit Manager functions
|
||||
CmRemoveConduitByCreatorIDPtr lpfnCmRemoveConduitByCreatorID;
|
||||
lpfnCmRemoveConduitByCreatorID = (CmRemoveConduitByCreatorIDPtr) GetProcAddress(hConduitManagerDLL, "CmRemoveConduitByCreatorID");
|
||||
@ -766,6 +784,10 @@ int UninstallConduit()
|
||||
if( bHotSyncRunning )
|
||||
StartHotSync(hHsapiDLL);
|
||||
|
||||
// restore cwd, if we changed it.
|
||||
if (gSavedCwd[0])
|
||||
SetCurrentDirectory(gSavedCwd);
|
||||
|
||||
if( dwReturnCode < 0 )
|
||||
return dwReturnCode;
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user