Index: dll/win32/kernel32/client/file/disk.c =================================================================== --- dll/win32/kernel32/client/file/disk.c (revision 62704) +++ dll/win32/kernel32/client/file/disk.c (working copy) @@ -169,21 +169,40 @@ { FILE_FS_SIZE_INFORMATION FileFsSize; IO_STATUS_BLOCK IoStatusBlock; - WCHAR RootPathName[MAX_PATH]; + HANDLE hFile; NTSTATUS errCode; - if (lpRootPathName) + DWORD BufferSize; + LPWSTR CurrentDir; + + + + //If NULL is passed set the label in CurrentDirectory path + if(!lpRootPathName) { - wcsncpy (RootPathName, lpRootPathName, 3); - } - else - { - GetCurrentDirectoryW (MAX_PATH, RootPathName); - } - RootPathName[3] = 0; + BufferSize = GetCurrentDirectoryW(0, NULL); + CurrentDir = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize * sizeof(WCHAR)); + if(!CurrentDir) + { + return FALSE; + } + if(!GetCurrentDirectoryW(BufferSize, CurrentDir)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDir); + return FALSE; + } + } else { + //If lpRootPathName is empty + if(wcscmp(lpRootPathName, L"") == 0) + { + SetLastError(ERROR_PATH_NOT_FOUND); + return FALSE; + } + } + - hFile = InternalOpenDirW(RootPathName, FALSE); + hFile = InternalOpenDirW(lpRootPathName?lpRootPathName:CurrentDir, FALSE); if (INVALID_HANDLE_VALUE == hFile) { SetLastError(ERROR_PATH_NOT_FOUND); @@ -265,6 +284,7 @@ hFile = InternalOpenDirW(lpDirectoryName, FALSE); if (INVALID_HANDLE_VALUE == hFile) { + SetLastError(ERROR_PATH_NOT_FOUND); return FALSE; }