This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Run Porting/new-perldelta.pl for v5.23.2
[perl5.git] / win32 / vdir.h
index fb93205..42c306b 100644 (file)
@@ -85,7 +85,7 @@ protected:
     {
        char *ptr = dirTableA[index];
        if (!ptr) {
-           /* simulate the existance of this drive */
+           /* simulate the existence of this drive */
            ptr = szLocalBufferA;
            ptr[0] = 'A' + index;
            ptr[1] = ':';
@@ -98,7 +98,7 @@ protected:
     {
        WCHAR *ptr = dirTableW[index];
        if (!ptr) {
-           /* simulate the existance of this drive */
+           /* simulate the existence of this drive */
            ptr = szLocalBufferW;
            ptr[0] = 'A' + index;
            ptr[1] = ':';
@@ -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.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-            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 NT 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;
   }
 }
@@ -316,7 +294,7 @@ inline void DoGetFullPathNameA(char* lpBuffer, DWORD dwSize, char* Dest)
 
     /*
      * On WinNT GetFullPathName does not fail, (or at least always
-     * succeeds when the drive is valid) WinNT does set *Dest to Nullch
+     * succeeds when the drive is valid) WinNT does set *Dest to NULL
      * On Win98 GetFullPathName will set last error if it fails, but
      * does not touch *Dest
      */
@@ -544,7 +522,7 @@ inline void DoGetFullPathNameW(WCHAR* lpBuffer, DWORD dwSize, WCHAR* Dest)
 
     /*
      * On WinNT GetFullPathName does not fail, (or at least always
-     * succeeds when the drive is valid) WinNT does set *Dest to Nullch
+     * succeeds when the drive is valid) WinNT does set *Dest to NULL
      * On Win98 GetFullPathName will set last error if it fails, but
      * does not touch *Dest
      */