Re: When should PERL_SYS_TERM() be called? [was: Re: [PATCH] Re: [PATCH] Re: [PATCH...
[p5sagit/p5-mst-13.2.git] / win32 / vdir.h
index af769f1..10119ea 100644 (file)
@@ -150,7 +150,7 @@ void VDir::Init(VDir* pDir, VMem *p)
        bManageDirectory = 0;
        driveBits = GetLogicalDrives();
        if (GetLogicalDriveStrings(sizeof(szBuffer), szBuffer)) {
-           char* pEnv = GetEnvironmentStrings();
+           char* pEnv = (char*)GetEnvironmentStrings();
            char* ptr = szBuffer;
            for (index = 0; index < driveCount; ++index) {
                if (driveBits & (1<<index)) {
@@ -452,7 +452,9 @@ int VDir::SetCurrentDirectoryA(char *lpBuffer)
     DWORD r = GetFileAttributesA(pPtr);
     if ((r != 0xffffffff) && (r & FILE_ATTRIBUTE_DIRECTORY))
     {
-       SetDefaultDirA(pPtr, DriveIndex(pPtr[0]));
+       char szBuffer[(MAX_PATH+1)*2];
+       DoGetFullPathNameA(pPtr, sizeof(szBuffer), szBuffer);
+       SetDefaultDirA(szBuffer, DriveIndex(szBuffer[0]));
        nRet = 0;
     }
 
@@ -677,7 +679,9 @@ int VDir::SetCurrentDirectoryW(WCHAR *lpBuffer)
     DWORD r = GetFileAttributesW(pPtr);
     if ((r != 0xffffffff) && (r & FILE_ATTRIBUTE_DIRECTORY))
     {
-       SetDefaultDirW(pPtr, DriveIndex((char)pPtr[0]));
+       WCHAR wBuffer[(MAX_PATH+1)*2];
+       DoGetFullPathNameW(pPtr, (sizeof(wBuffer)/sizeof(WCHAR)), wBuffer);
+       SetDefaultDirW(wBuffer, DriveIndex((char)wBuffer[0]));
        nRet = 0;
     }