diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-02-26 22:26:45 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-02-26 22:26:45 +0000 |
commit | 0e7b7035500dfac5a04098aabc2be70be928dcd2 (patch) | |
tree | 0328fc279fef8e1bdceff0c350bf10e46c52320c /win32 | |
parent | 935d2dd37e0196379b1bbd2b423bd65f506f9cbf (diff) | |
download | perl-0e7b7035500dfac5a04098aabc2be70be928dcd2.tar.gz |
Remove leftover Windows 95 / Windows NT4 support code
We only support building or running on Windows 2000 or higher, as of the
Windows 95 Chainsaw Massacre commit (8cbe99e5b6). These three chunks of
code escaped the massacre, but the chainsaw has finally caught up with them
now.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/perllib.c | 17 | ||||
-rw-r--r-- | win32/vdir.h | 42 | ||||
-rw-r--r-- | win32/win32.c | 77 |
3 files changed, 42 insertions, 94 deletions
diff --git a/win32/perllib.c b/win32/perllib.c index 428ebad944..84a618a77f 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -211,25 +211,14 @@ RunPerl(int argc, char **argv, char **env) { int exitstatus; PerlInterpreter *my_perl, *new_perl = NULL; - OSVERSIONINFO osver; char szModuleName[MAX_PATH]; char *arg0 = argv[0]; char *ansi = NULL; bool use_environ = (env == environ); - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionEx(&osver); - - if (osver.dwMajorVersion > 4) { - WCHAR widename[MAX_PATH]; - GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR)); - argv[0] = ansi = win32_ansipath(widename); - } - else { - Win_GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); - (void)win32_longpath(szModuleName); - argv[0] = szModuleName; - } + WCHAR widename[MAX_PATH]; + GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR)); + argv[0] = ansi = win32_ansipath(widename); #ifdef PERL_GLOBAL_STRUCT #define PERLVAR(prefix,var,type) /**/ diff --git a/win32/vdir.h b/win32/vdir.h index db7ec8417f..a4186a1ad9 100644 --- a/win32/vdir.h +++ b/win32/vdir.h @@ -146,43 +146,21 @@ void VDir::Init(VDir* pDir, VMem *p) else { int bSave = bManageDirectory; DWORD driveBits = GetLogicalDrives(); - OSVERSIONINFO osver; - - memset(&osver, 0, sizeof(osver)); - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionEx(&osver); bManageDirectory = 0; - if (osver.dwMajorVersion < 5) { - char szBuffer[MAX_PATH*driveCount]; - if (GetLogicalDriveStringsA(sizeof(szBuffer), szBuffer)) { - char* pEnv = (char*)GetEnvironmentStringsA(); - char* ptr = szBuffer; - for (index = 0; index < driveCount; ++index) { - if (driveBits & (1<<index)) { - ptr += SetDirA(ptr, index) + 1; - FromEnvA(pEnv, index); - } - } - FreeEnvironmentStringsA(pEnv); - } - SetDefaultA("."); - } - else { /* Windows 2000 or later */ - WCHAR szBuffer[MAX_PATH*driveCount]; - if (GetLogicalDriveStringsW(sizeof(szBuffer), szBuffer)) { - WCHAR* pEnv = GetEnvironmentStringsW(); - WCHAR* ptr = szBuffer; - for (index = 0; index < driveCount; ++index) { - if (driveBits & (1<<index)) { - ptr += SetDirW(ptr, index) + 1; - FromEnvW(pEnv, index); - } + WCHAR szBuffer[MAX_PATH*driveCount]; + if (GetLogicalDriveStringsW(sizeof(szBuffer), szBuffer)) { + WCHAR* pEnv = GetEnvironmentStringsW(); + WCHAR* ptr = szBuffer; + for (index = 0; index < driveCount; ++index) { + if (driveBits & (1<<index)) { + ptr += SetDirW(ptr, index) + 1; + FromEnvW(pEnv, index); } - FreeEnvironmentStringsW(pEnv); } - SetDefaultW(L"."); + FreeEnvironmentStringsW(pEnv); } + SetDefaultW(L"."); bManageDirectory = bSave; } } diff --git a/win32/win32.c b/win32/win32.c index eb3d428298..0064a50545 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -219,54 +219,35 @@ set_w32_module_name(void) ? GetModuleHandle(NULL) : w32_perldll_handle); - OSVERSIONINFO osver; /* g_osver may not yet be initialized */ - osver.dwOSVersionInfoSize = sizeof(osver); - GetVersionEx(&osver); - - if (osver.dwMajorVersion > 4) { - WCHAR modulename[MAX_PATH]; - WCHAR fullname[MAX_PATH]; - char *ansi; - - DWORD (__stdcall *pfnGetLongPathNameW)(LPCWSTR, LPWSTR, DWORD) = - (DWORD (__stdcall *)(LPCWSTR, LPWSTR, DWORD)) - GetProcAddress(GetModuleHandle("kernel32.dll"), "GetLongPathNameW"); - - GetModuleFileNameW(module, modulename, sizeof(modulename)/sizeof(WCHAR)); - - /* Make sure we get an absolute pathname in case the module was loaded - * explicitly by LoadLibrary() with a relative path. */ - GetFullPathNameW(modulename, sizeof(fullname)/sizeof(WCHAR), fullname, NULL); - - /* Make sure we start with the long path name of the module because we - * later scan for pathname components to match "5.xx" to locate - * compatible sitelib directories, and the short pathname might mangle - * this path segment (e.g. by removing the dot on NTFS to something - * like "5xx~1.yy") */ - if (pfnGetLongPathNameW) - pfnGetLongPathNameW(fullname, fullname, sizeof(fullname)/sizeof(WCHAR)); - - /* remove \\?\ prefix */ - if (memcmp(fullname, L"\\\\?\\", 4*sizeof(WCHAR)) == 0) - memmove(fullname, fullname+4, (wcslen(fullname+4)+1)*sizeof(WCHAR)); - - ansi = win32_ansipath(fullname); - my_strlcpy(w32_module_name, ansi, sizeof(w32_module_name)); - win32_free(ansi); - } - else { - GetModuleFileName(module, w32_module_name, sizeof(w32_module_name)); - - /* remove \\?\ prefix */ - if (memcmp(w32_module_name, "\\\\?\\", 4) == 0) - memmove(w32_module_name, w32_module_name+4, strlen(w32_module_name+4)+1); - - /* try to get full path to binary (which may be mangled when perl is - * run from a 16-bit app) */ - /*PerlIO_printf(Perl_debug_log, "Before %s\n", w32_module_name);*/ - win32_longpath(w32_module_name); - /*PerlIO_printf(Perl_debug_log, "After %s\n", w32_module_name);*/ - } + WCHAR modulename[MAX_PATH]; + WCHAR fullname[MAX_PATH]; + char *ansi; + + DWORD (__stdcall *pfnGetLongPathNameW)(LPCWSTR, LPWSTR, DWORD) = + (DWORD (__stdcall *)(LPCWSTR, LPWSTR, DWORD)) + GetProcAddress(GetModuleHandle("kernel32.dll"), "GetLongPathNameW"); + + GetModuleFileNameW(module, modulename, sizeof(modulename)/sizeof(WCHAR)); + + /* Make sure we get an absolute pathname in case the module was loaded + * explicitly by LoadLibrary() with a relative path. */ + GetFullPathNameW(modulename, sizeof(fullname)/sizeof(WCHAR), fullname, NULL); + + /* Make sure we start with the long path name of the module because we + * later scan for pathname components to match "5.xx" to locate + * compatible sitelib directories, and the short pathname might mangle + * this path segment (e.g. by removing the dot on NTFS to something + * like "5xx~1.yy") */ + if (pfnGetLongPathNameW) + pfnGetLongPathNameW(fullname, fullname, sizeof(fullname)/sizeof(WCHAR)); + + /* remove \\?\ prefix */ + if (memcmp(fullname, L"\\\\?\\", 4*sizeof(WCHAR)) == 0) + memmove(fullname, fullname+4, (wcslen(fullname+4)+1)*sizeof(WCHAR)); + + ansi = win32_ansipath(fullname); + my_strlcpy(w32_module_name, ansi, sizeof(w32_module_name)); + win32_free(ansi); /* normalize to forward slashes */ ptr = w32_module_name; |