When updating the updater starts the application after finishing with update.

cusax-fix
Damian Minkov 15 years ago
parent 761b528e49
commit 52ef7b1f07

@ -67,3 +67,5 @@ plugin.simpleaccreg.PROTOCOL_ORDER=SIP|MSN|Yahoo|ICQ|AIM|Jabber
# Default provisioning method
plugin.provisioning.DEFAULT_PROVISIONING_METHOD=
plugin.updatechecker.package.name=sip-communicator

@ -453,9 +453,22 @@
<include name="run.bat" />
<include name="run.exe" />
<include name="sc-logo.ico" />
<include name="up2date.exe" />
</fileset>
</copy>
<copy file="${inst.resrc}/windows/up2date.exe"
tofile="${light.dir}/${package.name}-up2date.exe"
overwrite="true"/>
<exec executable="mt.exe" dir="${light.dir}" failonerror="true">
<arg value="-manifest" />
<arg value="${inst.resrc}\windows\up2date.exe.manifest" />
<arg value="-outputresource:${package.name}-up2date.exe;#1" />
</exec>
<exec executable="mt.exe" dir="${light.dir}" failonerror="true">
<arg value="-manifest" />
<arg value="${inst.resrc}\windows\run.exe.manifest" />
<arg value="-outputresource:run.exe;#1" />
</exec>
<mkdir dir="${light.dir}/lib" />
<copy todir="${light.dir}/lib" overwrite="true">
<fileset dir="${sc.basedir}/lib">

@ -206,10 +206,6 @@
IS_AUTOUPDATE = 1
</Show>
<Custom Action="LaunchApplication" After="ExecuteAction">
IS_AUTOUPDATE = 1
</Custom>
<Custom Action="SetIS_AUTOUPDATE" After="AppSearch">
<![CDATA[NOT Installed AND %SIP_COMMUNICATOR_AUTOUPDATE_INSTALLDIR <> ""]]>
</Custom>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity></dependentAssembly></dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo>
</assembly>

@ -41,6 +41,12 @@ int WINAPI
WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, int cmdShow) {
LPTSTR commandLine;
LPWSTR wCommandLine;
LPWSTR *argv;
int argc;
LPWSTR wDir;
LPWSTR run;
#ifdef _UNICODE
commandLine = up2date_str2wstr(cmdLine);
#else
@ -69,8 +75,47 @@ WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, int cmdShow)
TCHAR exePath[MAX_PATH + 1];
if (!up2date_getExePath(exePath, MAX_PATH + 1)) {
ShellExecute(NULL, TEXT("runas"), exePath,
noAllowElevationCommandLine, NULL, SW_SHOWDEFAULT);
SHELLEXECUTEINFO ShExecInfo;
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = TEXT("runas");
ShExecInfo.lpFile = exePath;
ShExecInfo.lpParameters = noAllowElevationCommandLine;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
#ifdef _UNICODE
wCommandLine = commandLine;
#else
wCommandLine = up2date_str2wstr(commandLine);
if (!wCommandLine)
return ERROR_NOT_ENOUGH_MEMORY;
#endif
argv = CommandLineToArgvW(wCommandLine, &argc);
if (argv)
{
wDir = *(argv + 3);
LPWSTR runExe = L"\\run.exe";
int len = wcslen(wDir);
run = (wchar_t*)(malloc(sizeof(wchar_t) * (len +
wcslen(runExe) + 1)));
wcscpy(run, wDir);
wcscpy(run + len, runExe);
ShellExecuteW(NULL, L"open", run,
NULL, NULL, SW_SHOWDEFAULT);
error = GetLastError();
if (error)
up2date_displayError(error);
free(run);
}
}
} else if (error)
up2date_displayError(error);
@ -130,6 +175,7 @@ up2date_createProcess(LPCTSTR commandLine) {
&si, &pi))
{
error = 0;
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}

@ -715,13 +715,23 @@ public void run()
return;
}
String packageName = getResources().getSettingsString(
"plugin.updatechecker.package.name");
// file saved. Now start updater and shutdown.
String workingDir = System.getProperty("user.dir");
String updateFileLocation = workingDir + File.separator;
if(packageName != null)
updateFileLocation += packageName + "-up2date.exe";
else
updateFileLocation += "up2date.exe";
ProcessBuilder processBuilder
= new ProcessBuilder(
new String[]
{
workingDir + File.separator + "up2date.exe",
updateFileLocation,
"--wait-parent",
"--allow-elevation",
temp.getCanonicalPath(),

Loading…
Cancel
Save