From: Jan Dubois Date: Fri, 11 May 2007 18:25:39 +0000 (-0700) Subject: Restore Windows NT support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3839a0fa28dfb81de1e2a571399e4a094f13e6c9;p=p5sagit%2Fp5-mst-13.2.git Restore Windows NT support From: "Jan Dubois" Message-ID: <02d101c79434$743be100$5cb3a300$@com> p4raw-id: //depot/perl@31211 --- diff --git a/win32/perllib.c b/win32/perllib.c index cc46b30..da8e13d 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -216,7 +216,7 @@ RunPerl(int argc, char **argv, char **env) osver.dwOSVersionInfoSize = sizeof(osver); GetVersionEx(&osver); - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + if (osver.dwMajorVersion > 4) { WCHAR widename[MAX_PATH]; GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR)); argv[0] = ansi = win32_ansipath(widename); diff --git a/win32/vdir.h b/win32/vdir.h index fb93205..a639ce5 100644 --- a/win32/vdir.h +++ b/win32/vdir.h @@ -153,7 +153,7 @@ void VDir::Init(VDir* pDir, VMem *p) GetVersionEx(&osver); bManageDirectory = 0; - if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { + if (osver.dwMajorVersion < 5) { char szBuffer[MAX_PATH*driveCount]; if (GetLogicalDriveStringsA(sizeof(szBuffer), szBuffer)) { char* pEnv = (char*)GetEnvironmentStringsA(); @@ -168,7 +168,7 @@ void VDir::Init(VDir* pDir, VMem *p) } SetDefaultA("."); } - else { /* Windows NT or later */ + else { /* Windows 2000 or later */ WCHAR szBuffer[MAX_PATH*driveCount]; if (GetLogicalDriveStringsW(sizeof(szBuffer), szBuffer)) { WCHAR* pEnv = GetEnvironmentStringsW(); diff --git a/win32/win32.c b/win32/win32.c index cb2bbda..21be48c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -19,7 +19,7 @@ # define HWND_MESSAGE ((HWND)-3) #endif #ifndef WC_NO_BEST_FIT_CHARS -# define WC_NO_BEST_FIT_CHARS 0x00000400 +# define WC_NO_BEST_FIT_CHARS 0x00000400 /* requires Windows 2000 or later */ #endif #include #include @@ -206,6 +206,12 @@ IsWinNT(void) return (g_osver.dwPlatformId == VER_PLATFORM_WIN32_NT); } +int +IsWin2000(void) +{ + return (g_osver.dwMajorVersion > 4); +} + EXTERN_C void set_w32_module_name(void) { @@ -219,7 +225,7 @@ set_w32_module_name(void) osver.dwOSVersionInfoSize = sizeof(osver); GetVersionEx(&osver); - if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + if (osver.dwMajorVersion > 4) { WCHAR modulename[MAX_PATH]; WCHAR fullname[MAX_PATH]; char *ansi; @@ -858,7 +864,7 @@ win32_opendir(const char *filename) scanname[len] = '\0'; /* do the FindFirstFile call */ - if (IsWinNT()) { + if (IsWin2000()) { WCHAR wscanname[sizeof(scanname)]; MultiByteToWideChar(CP_ACP, 0, scanname, -1, wscanname, sizeof(wscanname)/sizeof(WCHAR)); dirp->handle = FindFirstFileW(PerlDir_mapW(wscanname), &wFindData); @@ -949,7 +955,7 @@ win32_readdir(DIR *dirp) /* finding the next file that matches the wildcard * (which should be all of them in this directory!). */ - if (IsWinNT()) { + if (IsWin2000()) { WIN32_FIND_DATAW wFindData; res = FindNextFileW(dirp->handle, &wFindData); if (res) { @@ -4677,8 +4683,8 @@ ansify_path(void) WCHAR *wide_path; WCHAR *wide_dir; - /* there is no Unicode environment on Windows 9X */ - if (IsWin95()) + /* win32_ansipath() requires Windows 2000 or later */ + if (!IsWin2000()) return; /* fetch Unicode version of PATH */ @@ -4869,7 +4875,7 @@ win32_create_message_window() * "right" place with DispatchMessage() anymore, as there is no WindowProc * if there is no window handle. */ - if (g_osver.dwMajorVersion < 5) + if (!IsWin2000()) return NULL; return CreateWindow("Static", "", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, NULL);