X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fvdir.h;h=db7ec8417fef425597e9c36e18dc88b288beeb09;hb=0100440d3c83cbbd0295cecf65f71318c7bebf25;hp=fb80e38679087bcac3dfd3fcbe6e8884d22adbdc;hpb=d684b16258d4be88a6b78f17e48637c1127b0ed7;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/vdir.h b/win32/vdir.h index fb80e38..db7ec84 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(); @@ -261,13 +261,13 @@ void VDir::SetDefaultA(char const *pDefault) int VDir::SetDirW(WCHAR const *pPath, int index) { WCHAR chr, *ptr; - char szBuffer[MAX_PATH+1]; int length = 0; if (index < driveCount && pPath != NULL) { length = wcslen(pPath); pMem->Free(dirTableW[index]); ptr = dirTableW[index] = (WCHAR*)pMem->Malloc((length+2)*2); if (ptr != NULL) { + char *ansi; wcscpy(ptr, pPath); ptr += length-1; chr = *ptr++; @@ -275,13 +275,14 @@ int VDir::SetDirW(WCHAR const *pPath, int index) *ptr++ = '\\'; *ptr = '\0'; } - WideCharToMultiByte(CP_ACP, 0, dirTableW[index], -1, szBuffer, sizeof(szBuffer), NULL, NULL); - length = strlen(szBuffer); + ansi = win32_ansipath(dirTableW[index]); + length = strlen(ansi); pMem->Free(dirTableA[index]); dirTableA[index] = (char*)pMem->Malloc(length+1); if (dirTableA[index] != NULL) { - strcpy(dirTableA[index], szBuffer); + strcpy(dirTableA[index], ansi); } + win32_free(ansi); } } @@ -315,7 +316,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 */ @@ -543,7 +544,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 */