From f186b497665a364d4e8fbd678e342077469c4be2 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 6 Feb 2016 19:41:53 +0000 Subject: tools/IconPatcher: support waiting miranda terminate git-svn-id: http://svn.miranda-ng.org/main/trunk@16230 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/IconPatcher/IconPatcher.exe | Bin 926394 -> 926599 bytes tools/IconPatcher/IconPatcher_v.1.0.iss | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tools/IconPatcher/IconPatcher.exe b/tools/IconPatcher/IconPatcher.exe index b09aef32ce..f49775e0d4 100644 Binary files a/tools/IconPatcher/IconPatcher.exe and b/tools/IconPatcher/IconPatcher.exe differ diff --git a/tools/IconPatcher/IconPatcher_v.1.0.iss b/tools/IconPatcher/IconPatcher_v.1.0.iss index e1937dbab6..1447d7b4d5 100644 --- a/tools/IconPatcher/IconPatcher_v.1.0.iss +++ b/tools/IconPatcher/IconPatcher_v.1.0.iss @@ -5,6 +5,7 @@ ; • It has English and Russian interface (automatically detected) ; • Intuitive graphical user interface. ; • Command line support. Command line parameters: +; • /PID = "PID of Miranda procees for wait closing it". ; • /BIN = "path to Miranda32/64.exe". The exe-file path, related to which all archived files' paths would be calculated with respect to 'files from the archive to the resources' from the 'files Miranda'. ; • /ARC = archive name without extension, for example, /ARC=Nova. ; • /RES = list of archive folders to process, they will be marked in the patcher's UI. If you want to mark all folders, you can simply omit /RES parameter, or use /RES=* either. @@ -197,6 +198,10 @@ type IconList: TStringList; end; +function WaitForSingleObject(hHandle : THandle; dwMilliseconds : DWORD) : DWORD; external 'WaitForSingleObject@kernel32.dll stdcall'; +function OpenProcess(dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwProcessId: Longint): THandle; external 'OpenProcess@kernel32.dll stdcall'; +function TerminateProcess(hProcess:THandle; exitCode: DWORD): BOOL; external 'TerminateProcess@kernel32.dll stdcall'; + function SevenZipOpenArchive(const hwnd: HWND; szFileName: AnsiString; const dwMode: DWORD): THandle; external 'SevenZipOpenArchive@files:7-zip32.dll stdcall'; function SevenZipCloseArchive(harc: THandle): Integer; external 'SevenZipCloseArchive@files:7-zip32.dll stdcall'; function SevenZipFindFirst(harc: THandle; szWildName: AnsiString; var lpSubInfo: INDIVIDUALINFO): Integer; external 'SevenZipFindFirst@files:7-zip32.dll stdcall'; @@ -533,7 +538,24 @@ var RootPath, RootDir, DirName, FileName, OutputDir, AddParam: AnsiString; ItemText: AnsiString; i, ResultCode: Integer; + handle: THandle; + PID: Longint; begin + + PID := StrToIntDef(ExpandConstant('{param:PID}'), 0); + if PID <> 0 then + begin + handle := OpenProcess(1048576 or 1, false, PID); + if handle <> 0 then + begin + StatusBar.Panels[0].Text := FmtMessage(CustomMessage('cmStatusLabelCaption1a'), ['Waiting...']); + StatusBar.Refresh; + if WaitForSingleObject(handle, 15000) = 258 then + TerminateProcess(handle, 9); + CloseHandle(handle); + end + end; + { ResHelper } Log(CustomMessage('cmLogUpdateResources1a')); ResHelper.IconList := TStringList.Create; -- cgit v1.2.3