From 0e7b7035500dfac5a04098aabc2be70be928dcd2 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Wed, 26 Feb 2014 22:26:45 +0000 Subject: [PATCH] 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. --- win32/perllib.c | 17 +++---------- win32/vdir.h | 42 ++++++++----------------------- win32/win32.c | 77 ++++++++++++++++++++++----------------------------------- 3 files changed, 42 insertions(+), 94 deletions(-) diff --git a/win32/perllib.c b/win32/perllib.c index 428ebad..84a618a 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 db7ec84..a4186a1 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< 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; -- 2.7.4