diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 67961b721..770439258 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -588,34 +588,17 @@ winFixupPaths (void) } if (getenv("HOME") == NULL) { - HMODULE shfolder; - SHGETFOLDERPATHPROC shgetfolderpath = NULL; char buffer[MAX_PATH + 5]; strncpy(buffer, "HOME=", 5); - /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */ - - shfolder = LoadLibrary("shfolder.dll"); - /* fallback to shell32.dll */ - if (shfolder == NULL) - shfolder = LoadLibrary("shell32.dll"); - - /* resolve SHGetFolderPath */ - if (shfolder != NULL) - shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA"); - /* query appdata directory */ - if (shgetfolderpath && - shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, - buffer + 5) == 0) - { + if (SHGetFolderPathA(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, buffer + 5) == 0) + { putenv(buffer); } else { winMsg (X_ERROR, "Can not determine HOME directory\n"); - } - if (shfolder != NULL) - FreeLibrary(shfolder); + } } if (!g_fLogFileChanged) { static char buffer[MAX_PATH]; @@ -825,10 +808,10 @@ winUseMsg (void) "\theight and initial position for that screen. Additionally\n" "\ta monitor number can be specified to start the server on,\n" "\tat which point, all coordinates become relative to that\n" - "\tmonitor (Not for Windows NT4 and 95). Examples:\n" - "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" - "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" - "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); + "\tmonitor. Examples:\n" + "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" + "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" + "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); ErrorF ("-silent-dup-error\n" "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n" diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c index a9d46f90e..967ae6d35 100644 --- a/hw/xwin/winmonitors.c +++ b/hw/xwin/winmonitors.c @@ -53,30 +53,8 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d return TRUE; } -typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); -ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; - -wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); - Bool QueryMonitor(int index, struct GetMonitorInfoData *data) { - /* Load EnumDisplayMonitors from DLL */ - HMODULE user32; - FARPROC func; - user32 = LoadLibrary("user32.dll"); - if (user32 == NULL) - { - winW32Error(2, "Could not open user32.dll"); - return FALSE; - } - func = GetProcAddress(user32, "EnumDisplayMonitors"); - if (func == NULL) - { - winW32Error(2, "Could not resolve EnumDisplayMonitors: "); - return FALSE; - } - _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; - /* prepare data */ if (data == NULL) return FALSE; @@ -84,9 +62,5 @@ Bool QueryMonitor(int index, struct GetMonitorInfoData *data) data->requestedMonitor = index; /* query information */ - _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); - - /* cleanup */ - FreeLibrary(user32); - return TRUE; + return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); } diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 0c24b083c..2b6949ed1 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -326,8 +326,7 @@ ddxProcessArgument (int argc, char *argv[], int i) struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); + ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); @@ -383,8 +382,7 @@ ddxProcessArgument (int argc, char *argv[], int i) struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); + ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { g_ScreenInfo[nScreenNum].iMonitor = iMonitor; @@ -411,8 +409,7 @@ ddxProcessArgument (int argc, char *argv[], int i) struct GetMonitorInfoData data; if (!QueryMonitor(iMonitor, &data)) { - ErrorF ("ddxProcessArgument - screen - " - "Querying monitors is not supported on NT4 and Win95\n"); + ErrorF ("ddxProcessArgument - screen - Querying monitors failed\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);