summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2007-05-11 11:25:39 -0700
committerSteve Peters <steve@fisharerojo.org>2007-05-13 16:35:02 +0000
commit3839a0fa28dfb81de1e2a571399e4a094f13e6c9 (patch)
treef2bef8db1eb23b12a6c27e0caac0b083bcfa9857 /win32
parent035e2bcc0535c60f40214acc38bb076a74774dd2 (diff)
downloadperl-3839a0fa28dfb81de1e2a571399e4a094f13e6c9.tar.gz
Restore Windows NT support
From: "Jan Dubois" <jand@activestate.com> Message-ID: <02d101c79434$743be100$5cb3a300$@com> p4raw-id: //depot/perl@31211
Diffstat (limited to 'win32')
-rw-r--r--win32/perllib.c2
-rw-r--r--win32/vdir.h4
-rw-r--r--win32/win32.c20
3 files changed, 16 insertions, 10 deletions
diff --git a/win32/perllib.c b/win32/perllib.c
index cc46b304bd..da8e13d965 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 fb93205408..a639ce56ee 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 cb2bbdae8d..21be48c032 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 <winnt.h>
#include <tlhelp32.h>
@@ -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);