diff options
-rw-r--r-- | updater/extern.cpp | 52 | ||||
-rw-r--r-- | updater/updater.rc | 6 | ||||
-rw-r--r-- | updater/version.h | 2 |
3 files changed, 44 insertions, 16 deletions
diff --git a/updater/extern.cpp b/updater/extern.cpp index 2d220df..ad34bd9 100644 --- a/updater/extern.cpp +++ b/updater/extern.cpp @@ -350,15 +350,39 @@ extern "C" void __declspec(dllexport) CALLBACK ExternalUpdate(HWND hwnd, HINSTAN HANDLE hMiranda = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, FALSE, mpi);
if(hMiranda) {
- if(WaitForSingleObjectEx(hMiranda, 20 * 1000, FALSE) == WAIT_TIMEOUT) {
+ int mbFlags, idRetry, idCancel, idContinue;
+ const int MAX_SIZE = 2048;
+ TCHAR message[MAX_SIZE];
+ int exitStatus;
+
+ OSVERSIONINFO vi = {0};
+ vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&vi);
+ _tcsncpy(message, _T("Miranda did not exit - cannot install or restart.\n"), MAX_SIZE);
+
+ if (vi.dwMajorVersion = 5) {
+ //windows 2000+
+ mbFlags = 0x00000006L; //MB_CANCELTRYCONTINUE;
+ idRetry = 10; //IDTRYAGAIN
+ idCancel = IDCANCEL;
+ idContinue = 11; //IDCONTINUE
+ _tcsncat(message, _T("Press 'Try again' to check Miranda's status again, press 'Continue' to kill the process or press 'Cancel' to abort."), MAX_SIZE);
+ } else {
+ //windows 98, me
+ mbFlags = MB_ABORTRETRYIGNORE;
+ idRetry = IDRETRY;
+ idCancel = IDCANCEL;
+ idContinue = IDIGNORE;
+ _tcsncat(message, _T("Press 'Retry' to check Miranda's status again, press 'Ignore' to kill the process or press 'Abort' to abort."), MAX_SIZE);
+ }
+
+ while ((exitStatus = WaitForSingleObjectEx(hMiranda, 20 * 1000, FALSE)) == WAIT_TIMEOUT) {
+ int res = MessageBox(0, message, _T("Updater Error"), mbFlags | MB_ICONERROR);
- if(MessageBox(0, _T("Miranda did not exit - cannot install or restart.\n")
- _T("Press OK to kill the process, ")
- _T("or press Cancel to abort."), _T("Updater Error"), MB_OKCANCEL | MB_ICONERROR) == IDOK)
- {
+ if (res == idContinue) {
+ //if the user chooses Continue then kill the application
TerminateProcess(hMiranda, 1);
-
- if(WaitForSingleObjectEx(hMiranda, 5 * 1000, FALSE) == WAIT_TIMEOUT) {
+ if((exitStatus = WaitForSingleObjectEx(hMiranda, 5 * 1000, FALSE)) == WAIT_TIMEOUT) {
//hMiranda = OpenProcess(SYNCHRONIZE, FALSE, mpi);
//if(hMiranda) {
//CloseHandle(hMiranda);
@@ -367,17 +391,21 @@ extern "C" void __declspec(dllexport) CALLBACK ExternalUpdate(HWND hwnd, HINSTAN #ifdef _UD_LOGGING
mWriteFile(hDatFile, "Wait for miranda processs to 'Terminate' interrupted - assuming it exited");
#endif
- exited = true;
+ }
+ } else {
+ if (res == idRetry) {
+ //if the user selected 'Try again' then wait a bit more.
+ continue; //wait again
}
}
- CloseHandle(hMiranda);
- } else {
+
+ break; //don't update anymore (happens when user choses 'Continue' or 'Cacel'
+ }
#ifdef _UD_LOGGING
mWriteFile(hDatFile, "Wait for miranda processs interrupted - assuming it exited");
#endif
- exited = true;
+ exited = (exitStatus != WAIT_TIMEOUT);
CloseHandle(hMiranda);
- }
} else {
#ifdef _UD_LOGGING
mWriteFile(hDatFile, "Could not open miranda processs - assuming it exited");
diff --git a/updater/updater.rc b/updater/updater.rc index 660fe9e..91b90aa 100644 --- a/updater/updater.rc +++ b/updater/updater.rc @@ -121,12 +121,12 @@ BEGIN DEFPUSHBUTTON "Changelog",IDC_BTN_CHANGELOG,169,159,53,14,WS_DISABLED | NOT WS_TABSTOP
END
-IDD_PROGRESS DIALOGEX 0, 0, 187, 47
+IDD_PROGRESS DIALOGEX 0, 0, 187, 41
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Progress"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,21,173,19,WS_EX_STATICEDGE
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,21,173,13,WS_EX_STATICEDGE
LTEXT "Initialising...",IDC_PROGMSG,9,7,171,8
END
@@ -171,7 +171,7 @@ BEGIN LEFTMARGIN, 7
RIGHTMARGIN, 180
TOPMARGIN, 7
- BOTTOMMARGIN, 40
+ BOTTOMMARGIN, 34
END
IDD_OPT2, DIALOG
diff --git a/updater/version.h b/updater/version.h index 180539a..92f2735 100644 --- a/updater/version.h +++ b/updater/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 4
#define __RELEASE_NUM 12
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|