Some more fixes.

svn path=/trunk/; revision=432
This commit is contained in:
Eric Kohl 1999-05-07 20:09:54 +00:00
parent 14e5e06271
commit 0064915ad7
2 changed files with 95 additions and 50 deletions

View file

@ -37,6 +37,12 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
WCHAR TemplateDirectoryW[MAX_PATH]; WCHAR TemplateDirectoryW[MAX_PATH];
WCHAR NewDirectoryW[MAX_PATH]; WCHAR NewDirectoryW[MAX_PATH];
ULONG i; ULONG i;
DPRINT("lpTemplateDirectory %s lpNewDirectory %s lpSecurityAttributes %p\n",
lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes);
if (lpTemplateDirectory)
{
i = 0; i = 0;
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH) while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
{ {
@ -45,7 +51,11 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
i++; i++;
} }
TemplateDirectoryW[i] = 0; TemplateDirectoryW[i] = 0;
}
DPRINT ("\n");
if (lpNewDirectory)
{
i = 0; i = 0;
while ((*lpNewDirectory)!=0 && i < MAX_PATH) while ((*lpNewDirectory)!=0 && i < MAX_PATH)
{ {
@ -54,8 +64,11 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
i++; i++;
} }
NewDirectoryW[i] = 0; NewDirectoryW[i] = 0;
return CreateDirectoryExW(TemplateDirectoryW, }
NewDirectoryW, DPRINT ("\n");
return CreateDirectoryExW(lpTemplateDirectory?TemplateDirectoryW:NULL,
lpNewDirectory?NewDirectoryW:NULL,
lpSecurityAttributes); lpSecurityAttributes);
} }
@ -63,7 +76,6 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
WINBOOL STDCALL CreateDirectoryW(LPCWSTR lpPathName, WINBOOL STDCALL CreateDirectoryW(LPCWSTR lpPathName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes) LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{ {
return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes); return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes);
} }
@ -77,7 +89,10 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
UNICODE_STRING DirectoryNameString; UNICODE_STRING DirectoryNameString;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
if ( lpTemplateDirectory != NULL ) DPRINT("lpTemplateDirectory %w lpNewDirectory %w lpSecurityAttributes %p\n",
lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes);
if ( lpTemplateDirectory != NULL && *lpTemplateDirectory != 0 )
{ {
// get object attributes from template directory // get object attributes from template directory
DPRINT("KERNEL32:FIXME:%s:%d\n",__FILE__,__LINE__); DPRINT("KERNEL32:FIXME:%s:%d\n",__FILE__,__LINE__);
@ -106,7 +121,7 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
0, 0,
NULL, NULL,
0); 0);
DPRINT("errCode: %x\n", errCode);
if (!NT_SUCCESS(errCode)) if (!NT_SUCCESS(errCode))
{ {
SetLastError(RtlNtStatusToDosError(errCode)); SetLastError(RtlNtStatusToDosError(errCode));

View file

@ -128,9 +128,11 @@ GetDiskFreeSpaceA(
LPDWORD lpTotalNumberOfClusters LPDWORD lpTotalNumberOfClusters
) )
{ {
ULONG i;
WCHAR RootPathNameW[MAX_PATH]; WCHAR RootPathNameW[MAX_PATH];
i = 0;
if (lpRootPathName)
{
ULONG i = 0;
while ((*lpRootPathName)!=0 && i < MAX_PATH) while ((*lpRootPathName)!=0 && i < MAX_PATH)
{ {
RootPathNameW[i] = *lpRootPathName; RootPathNameW[i] = *lpRootPathName;
@ -138,7 +140,13 @@ GetDiskFreeSpaceA(
i++; i++;
} }
RootPathNameW[i] = 0; RootPathNameW[i] = 0;
return GetDiskFreeSpaceW(RootPathNameW,lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ); }
return GetDiskFreeSpaceW(lpRootPathName?RootPathNameW:NULL,
lpSectorsPerCluster,
lpBytesPerSector,
lpNumberOfFreeClusters,
lpTotalNumberOfClusters);
} }
WINBOOL WINBOOL
@ -153,10 +161,21 @@ GetDiskFreeSpaceW(
{ {
FILE_FS_SIZE_INFORMATION FileFsSize; FILE_FS_SIZE_INFORMATION FileFsSize;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
WCHAR RootPathName[MAX_PATH];
HANDLE hFile; HANDLE hFile;
NTSTATUS errCode; NTSTATUS errCode;
hFile = CreateFileW(lpRootPathName, if (lpRootPathName)
{
wcsncpy (RootPathName, lpRootPathName, 3);
}
else
{
GetCurrentDirectoryW (MAX_PATH, RootPathName);
RootPathName[3] = 0;
}
hFile = CreateFileW(RootPathName,
FILE_READ_ATTRIBUTES, FILE_READ_ATTRIBUTES,
FILE_SHARE_READ, FILE_SHARE_READ,
NULL, NULL,
@ -194,9 +213,10 @@ GetDiskFreeSpaceExA(
) )
{ {
WCHAR DirectoryNameW[MAX_PATH]; WCHAR DirectoryNameW[MAX_PATH];
ULONG i;
i = 0; if (lpDirectoryName)
{
ULONG i = 0;
while ((*lpDirectoryName)!=0 && i < MAX_PATH) while ((*lpDirectoryName)!=0 && i < MAX_PATH)
{ {
DirectoryNameW[i] = *lpDirectoryName; DirectoryNameW[i] = *lpDirectoryName;
@ -204,7 +224,9 @@ GetDiskFreeSpaceExA(
i++; i++;
} }
DirectoryNameW[i] = 0; DirectoryNameW[i] = 0;
return GetDiskFreeSpaceExW(DirectoryNameW, }
return GetDiskFreeSpaceExW(lpDirectoryName?DirectoryNameW:NULL,
lpFreeBytesAvailableToCaller, lpFreeBytesAvailableToCaller,
lpTotalNumberOfBytes, lpTotalNumberOfBytes,
lpTotalNumberOfFreeBytes); lpTotalNumberOfFreeBytes);
@ -222,14 +244,22 @@ GetDiskFreeSpaceExW(
{ {
FILE_FS_SIZE_INFORMATION FileFsSize; FILE_FS_SIZE_INFORMATION FileFsSize;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
ULARGE_INTEGER BytesPerCluster;
WCHAR RootPathName[MAX_PATH];
HANDLE hFile; HANDLE hFile;
NTSTATUS errCode; NTSTATUS errCode;
WCHAR RootPath[4];
ULARGE_INTEGER BytesPerCluster;
wcsncpy (RootPath, lpDirectoryName, 3); if (lpDirectoryName)
{
wcsncpy (RootPathName, lpDirectoryName, 3);
}
else
{
GetCurrentDirectoryW (MAX_PATH, RootPathName);
RootPathName[3] = 0;
}
hFile = CreateFileW(RootPath, hFile = CreateFileW(RootPathName,
FILE_READ_ATTRIBUTES, FILE_READ_ATTRIBUTES,
FILE_SHARE_READ, FILE_SHARE_READ,
NULL, NULL,