@@ -119,6 +119,8 @@ LRESULT CALLBACK MessageWindowWndProc(HWND window_handle, UINT message, WPARAM w
119119 return DefWindowProc (window_handle, message, w_param, l_param);
120120}
121121
122+ #define PROGRAM_NAME " Intel PresentMon"
123+
122124HWND CreateBrowserWindow (HINSTANCE instance_handle, int show_minimize_or_maximize)
123125{
124126 WNDCLASSEX wcex = { 0 };
@@ -136,7 +138,7 @@ HWND CreateBrowserWindow(HINSTANCE instance_handle, int show_minimize_or_maximiz
136138 RegisterClassEx (&wcex);
137139
138140 HWND hwnd = CreateWindow (
139- BrowserWindowClassName, " Intel PresentMon " ,
141+ BrowserWindowClassName, PROGRAM_NAME ,
140142 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 200 , 20 ,
141143 1360 , 1020 , nullptr , nullptr , instance_handle, nullptr
142144 );
@@ -174,6 +176,20 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
174176{
175177 using namespace client ;
176178 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
177193 opt::init ();
178194 util::BootServices ();
179195
0 commit comments