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 <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "pupy_load.h"
|
#include "pupy_load.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
void on_exit_session(void);
|
void on_exit_session(void);
|
||||||
|
|
||||||
|
@ -53,8 +54,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
wx.lpfnWndProc = WinProc;
|
wx.lpfnWndProc = WinProc;
|
||||||
wx.hInstance = hInstance;
|
wx.hInstance = hInstance;
|
||||||
wx.lpszClassName = class_name;
|
wx.lpszClassName = class_name;
|
||||||
if ( ! RegisterClassEx(&wx) )
|
|
||||||
|
if ( ! RegisterClassEx(&wx) ) {
|
||||||
|
dprint("RegisterClassEx failed: %d\n", GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
hwndMain = CreateWindowEx(
|
hwndMain = CreateWindowEx(
|
||||||
0,
|
0,
|
||||||
|
@ -64,6 +68,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!hwndMain) {
|
||||||
|
dprint("CreateWindowEx failed: %d\n", GetLastError());
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
hThread = CreateThread(
|
hThread = CreateThread(
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
@ -73,6 +82,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
&threadId
|
&threadId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!hThread) {
|
||||||
|
dprint("CreateThread failed: %d\n", GetLastError());
|
||||||
|
return -GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
dwWake = MsgWaitForMultipleObjects(
|
dwWake = MsgWaitForMultipleObjects(
|
||||||
1,
|
1,
|
||||||
|
@ -84,7 +98,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
|
|
||||||
switch (dwWake) {
|
switch (dwWake) {
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
return -1;
|
return -3;
|
||||||
|
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue