зеркало из https://github.com/mozilla/pjs.git
more work on making palmsync a tbird extension, make palmsyncinstall.exe optionally take a path to mozabconduit.dll, r/sr=mscott 214407 not part of default build
This commit is contained in:
Родитель
1335021487
Коммит
67a306b91e
|
@ -20,7 +20,8 @@
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Rajiv Dayal <rdayal@netscape.com>
|
* Rajiv Dayal <rdayal@netscape.com>
|
||||||
|
* David Bienvenu <bienvenu@nventure.com>
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
@ -86,7 +87,7 @@ typedef int (WINAPI *mozDllRegisterServerPtr)(void);
|
||||||
typedef int (WINAPI *mozDllUnregisterServerPtr)(void);
|
typedef int (WINAPI *mozDllUnregisterServerPtr)(void);
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
int InstallConduit(HINSTANCE hInstance);
|
int InstallConduit(HINSTANCE hInstance, TCHAR *installPath);
|
||||||
int UninstallConduit();
|
int UninstallConduit();
|
||||||
void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg);
|
void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg);
|
||||||
|
|
||||||
|
@ -122,6 +123,12 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
int strResource=0;
|
int strResource=0;
|
||||||
int res=-1;
|
int res=-1;
|
||||||
|
|
||||||
|
// /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"
|
||||||
|
|
||||||
if(!strcmp(lpCmdLine,"/u")) // un-install
|
if(!strcmp(lpCmdLine,"/u")) // un-install
|
||||||
{
|
{
|
||||||
ConstructMessage(hInstance, IDS_APP_TITLE_UNINSTALL, appTitle);
|
ConstructMessage(hInstance, IDS_APP_TITLE_UNINSTALL, appTitle);
|
||||||
|
@ -142,7 +149,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
else if (!strcmp(lpCmdLine,"/s")) // silent install
|
else if (!strcmp(lpCmdLine,"/s")) // silent install
|
||||||
{
|
{
|
||||||
res = InstallConduit(hInstance);
|
res = InstallConduit(hInstance, installDir);
|
||||||
if(!res)
|
if(!res)
|
||||||
return TRUE; // success
|
return TRUE; // success
|
||||||
return res;
|
return res;
|
||||||
|
@ -153,7 +160,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
ConstructMessage(hInstance, IDS_CONFIRM_INSTALL, msgStr);
|
ConstructMessage(hInstance, IDS_CONFIRM_INSTALL, msgStr);
|
||||||
if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES)
|
if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES)
|
||||||
{
|
{
|
||||||
res = InstallConduit(hInstance);
|
res = InstallConduit(hInstance, installDir);
|
||||||
if(!res)
|
if(!res)
|
||||||
res = IDS_SUCCESS_INSTALL;
|
res = IDS_SUCCESS_INSTALL;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +394,7 @@ int UnregisterMozPalmSyncDll()
|
||||||
}
|
}
|
||||||
|
|
||||||
// installs our Conduit
|
// installs our Conduit
|
||||||
int InstallConduit(HINSTANCE hInstance)
|
int InstallConduit(HINSTANCE hInstance, TCHAR *installDir)
|
||||||
{
|
{
|
||||||
int dwReturnCode;
|
int dwReturnCode;
|
||||||
BOOL bHotSyncRunning = FALSE;
|
BOOL bHotSyncRunning = FALSE;
|
||||||
|
@ -396,26 +403,34 @@ int InstallConduit(HINSTANCE hInstance)
|
||||||
// Applications should not place conduits in the Palm Desktop directory.
|
// Applications should not place conduits in the Palm Desktop directory.
|
||||||
// The Palm Desktop installer only manages the Palm Desktop conduits.
|
// The Palm Desktop installer only manages the Palm Desktop conduits.
|
||||||
TCHAR szConduitPath[_MAX_PATH];
|
TCHAR szConduitPath[_MAX_PATH];
|
||||||
if(!GetModuleFileName(NULL, szConduitPath, _MAX_PATH))
|
if (!installDir)
|
||||||
return IDS_ERR_CONDUIT_NOT_FOUND;
|
{
|
||||||
// extract the dir path (without the module name)
|
if(!GetModuleFileName(NULL, szConduitPath, _MAX_PATH))
|
||||||
int index = strlen(szConduitPath)-1;
|
return IDS_ERR_CONDUIT_NOT_FOUND;
|
||||||
while((szConduitPath[index] != DIRECTORY_SEPARATOR) && index)
|
// extract the dir path (without the module name)
|
||||||
index--;
|
int index = strlen(szConduitPath)-1;
|
||||||
szConduitPath[index] = 0;
|
while((szConduitPath[index] != DIRECTORY_SEPARATOR) && index)
|
||||||
|
index--;
|
||||||
|
szConduitPath[index] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strncpy(szConduitPath, installDir, sizeof(szConduitPath) - 1);
|
||||||
|
|
||||||
// take care of any possible string overwrites
|
// take care of any possible string overwrites
|
||||||
if((strlen(szConduitPath) + strlen(DIRECTORY_SEPARATOR_STR) + strlen(CONDUIT_FILENAME)) > _MAX_PATH)
|
if((strlen(szConduitPath) + strlen(DIRECTORY_SEPARATOR_STR) + strlen(CONDUIT_FILENAME)) > _MAX_PATH)
|
||||||
return IDS_ERR_LOADING_CONDMGR;
|
return IDS_ERR_LOADING_CONDMGR;
|
||||||
strcat(szConduitPath, DIRECTORY_SEPARATOR_STR);
|
// might already have conduit filename in szConduitPath if we're called recursively
|
||||||
strcat(szConduitPath, CONDUIT_FILENAME);
|
if (!strstr(szConduitPath, CONDUIT_FILENAME))
|
||||||
|
{
|
||||||
|
strcat(szConduitPath, DIRECTORY_SEPARATOR_STR);
|
||||||
|
strcat(szConduitPath, CONDUIT_FILENAME);
|
||||||
|
}
|
||||||
// Make sure the conduit dll exists
|
// Make sure the conduit dll exists
|
||||||
struct _finddata_t dll_file;
|
struct _finddata_t dll_file;
|
||||||
long hFile;
|
long hFile;
|
||||||
if( (hFile = _findfirst( szConduitPath, &dll_file )) == -1L )
|
if( (hFile = _findfirst( szConduitPath, &dll_file )) == -1L )
|
||||||
return IDS_ERR_CONDUIT_NOT_FOUND;
|
return IDS_ERR_CONDUIT_NOT_FOUND;
|
||||||
|
|
||||||
// now register the Mozilla Palm Sync Support Dll
|
// now register the Mozilla Palm Sync Support Dll
|
||||||
if( (dwReturnCode = RegisterMozPalmSyncDll()) != 0)
|
if( (dwReturnCode = RegisterMozPalmSyncDll()) != 0)
|
||||||
return dwReturnCode;
|
return dwReturnCode;
|
||||||
|
@ -490,7 +505,7 @@ int InstallConduit(HINSTANCE hInstance)
|
||||||
//free the library so that the existing AB Conduit is unloaded properly
|
//free the library so that the existing AB Conduit is unloaded properly
|
||||||
FreeLibrary(hConduitManagerDLL);
|
FreeLibrary(hConduitManagerDLL);
|
||||||
FreeLibrary(hHsapiDLL);
|
FreeLibrary(hHsapiDLL);
|
||||||
return InstallConduit(hInstance);
|
return InstallConduit(hInstance, szConduitPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( dwReturnCode == 0 )
|
if( dwReturnCode == 0 )
|
||||||
|
|
Загрузка…
Ссылка в новой задаче