@@ -119,6 +119,8 @@ LRESULT CALLBACK MessageWindowWndProc(HWND window_handle, UINT message, WPARAM w
119
119
return DefWindowProc (window_handle, message, w_param, l_param);
120
120
}
121
121
122
+ #define PROGRAM_NAME " Intel PresentMon"
123
+
122
124
HWND CreateBrowserWindow (HINSTANCE instance_handle, int show_minimize_or_maximize)
123
125
{
124
126
WNDCLASSEX wcex = { 0 };
@@ -136,7 +138,7 @@ HWND CreateBrowserWindow(HINSTANCE instance_handle, int show_minimize_or_maximiz
136
138
RegisterClassEx (&wcex);
137
139
138
140
HWND hwnd = CreateWindow (
139
- BrowserWindowClassName, " Intel PresentMon " ,
141
+ BrowserWindowClassName, PROGRAM_NAME ,
140
142
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 200 , 20 ,
141
143
1360 , 1020 , nullptr , nullptr , instance_handle, nullptr
142
144
);
@@ -174,6 +176,20 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
174
176
{
175
177
using namespace client ;
176
178
try {
179
+ #ifdef NDEBUG
180
+ std::wstring _path = std::filesystem::current_path ();
181
+ if (_path.find (L" Program Files\\ " , 0 ) == -1LL ) // -1 means no offset was found
182
+ {
183
+ wchar_t msg[512 ]{};
184
+ (void )_snwprintf_s (msg, _countof (msg),
185
+ L" Unable to start " PROGRAM_NAME " due to path not being in privileged location.\n "
186
+ " Path: \" %s\"\n "
187
+ " You must copy installation files to privileged location such as \" C:\\ Program Files\" ." , _path.c_str ());
188
+ MessageBoxW (nullptr , msg, L" " PROGRAM_NAME " Startup Error" , MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
189
+ return -1 ;
190
+ }
191
+ #endif
192
+ #undef PROGRAM_NAME
177
193
opt::init ();
178
194
util::BootServices ();
179
195
0 commit comments