Skip to content

Commit da25ce4

Browse files
committed
Add exit codes
EXIT_CODE_NORMAL_EXIT will be returned when the process exits normally. EXIT_CODE_ERROR will be used if the process exits due to an error.
1 parent 40879e6 commit da25ce4

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Explorer++/Explorer++/Explorer++_internal.h

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ struct ColumnWidth
5656
int iWidth;
5757
};
5858

59+
enum ExitCode
60+
{
61+
EXIT_CODE_NORMAL_EXIT = 0,
62+
EXIT_CODE_ERROR = 1
63+
};
64+
5965
extern HACCEL g_hAccl;
6066

6167
BOOL TestConfigFileInternal(void);

Explorer++/Explorer++/MainWndSwitch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ LRESULT CALLBACK Explorerplusplus::WndProcStub(HWND hwnd, UINT msg, WPARAM wPara
6161

6262
if (!pContainer)
6363
{
64-
PostQuitMessage(0);
64+
PostQuitMessage(EXIT_CODE_ERROR);
6565
return 0;
6666
}
6767

@@ -72,7 +72,7 @@ LRESULT CALLBACK Explorerplusplus::WndProcStub(HWND hwnd, UINT msg, WPARAM wPara
7272
case WM_NCDESTROY:
7373
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
7474
delete pContainer;
75-
PostQuitMessage(0);
75+
PostQuitMessage(EXIT_CODE_NORMAL_EXIT);
7676
break;
7777
}
7878

Explorer++/Explorer++/WinMain.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
9898

9999
if (status != Gdiplus::Status::Ok)
100100
{
101-
return 0;
101+
return EXIT_CODE_ERROR;
102102
}
103103

104104
auto gdiplusCleanup = wil::scope_exit(
@@ -213,7 +213,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
213213

214214
if (shouldExit)
215215
{
216-
return 0;
216+
return EXIT_CODE_NORMAL_EXIT;
217217
}
218218

219219
BOOL bAllowMultipleInstances = TRUE;
@@ -272,7 +272,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
272272

273273
SetForegroundWindow(hPrev);
274274
ShowWindow(hPrev, SW_RESTORE);
275-
return 0;
275+
return EXIT_CODE_NORMAL_EXIT;
276276
}
277277
}
278278
}
@@ -287,7 +287,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
287287
MessageBox(nullptr, _T("Could not register class"), NExplorerplusplus::APP_NAME,
288288
MB_OK | MB_ICONERROR);
289289

290-
return 0;
290+
return EXIT_CODE_ERROR;
291291
}
292292

293293
InitializeCrashHandler();
@@ -307,7 +307,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
307307
MessageBox(nullptr, _T("Could not create main window."), NExplorerplusplus::APP_NAME,
308308
MB_OK | MB_ICONERROR);
309309

310-
return 0;
310+
return EXIT_CODE_ERROR;
311311
}
312312

313313
WINDOWPLACEMENT wndpl;

0 commit comments

Comments
 (0)