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

@ -27,44 +27,56 @@
WINBOOL STDCALL CreateDirectoryA(LPCSTR lpPathName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
return CreateDirectoryExA(NULL,lpPathName,lpSecurityAttributes);
return CreateDirectoryExA(NULL,lpPathName,lpSecurityAttributes);
}
WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
LPCSTR lpNewDirectory,
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
WCHAR TemplateDirectoryW[MAX_PATH];
WCHAR NewDirectoryW[MAX_PATH];
ULONG i;
i = 0;
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
{
TemplateDirectoryW[i] = *lpTemplateDirectory;
lpTemplateDirectory++;
i++;
}
TemplateDirectoryW[i] = 0;
WCHAR TemplateDirectoryW[MAX_PATH];
WCHAR NewDirectoryW[MAX_PATH];
ULONG i;
i = 0;
while ((*lpNewDirectory)!=0 && i < MAX_PATH)
{
NewDirectoryW[i] = *lpNewDirectory;
lpNewDirectory++;
i++;
}
NewDirectoryW[i] = 0;
return CreateDirectoryExW(TemplateDirectoryW,
NewDirectoryW,
lpSecurityAttributes);
DPRINT("lpTemplateDirectory %s lpNewDirectory %s lpSecurityAttributes %p\n",
lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes);
if (lpTemplateDirectory)
{
i = 0;
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
{
TemplateDirectoryW[i] = *lpTemplateDirectory;
lpTemplateDirectory++;
i++;
}
TemplateDirectoryW[i] = 0;
}
DPRINT ("\n");
if (lpNewDirectory)
{
i = 0;
while ((*lpNewDirectory)!=0 && i < MAX_PATH)
{
NewDirectoryW[i] = *lpNewDirectory;
lpNewDirectory++;
i++;
}
NewDirectoryW[i] = 0;
}
DPRINT ("\n");
return CreateDirectoryExW(lpTemplateDirectory?TemplateDirectoryW:NULL,
lpNewDirectory?NewDirectoryW:NULL,
lpSecurityAttributes);
}
WINBOOL STDCALL CreateDirectoryW(LPCWSTR lpPathName,
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes);
return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes);
}
WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
@ -76,8 +88,11 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING DirectoryNameString;
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
DPRINT("KERNEL32:FIXME:%s:%d\n",__FILE__,__LINE__);
@ -87,14 +102,14 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
DirectoryNameString.Length = lstrlenW(lpNewDirectory)*sizeof(WCHAR);
DirectoryNameString.Buffer = (WCHAR *)lpNewDirectory;
DirectoryNameString.MaximumLength = DirectoryNameString.Length+sizeof(WCHAR);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &DirectoryNameString;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE | OBJ_INHERIT;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
errCode = ZwCreateFile(&DirectoryHandle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes,
@ -106,15 +121,15 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
0,
NULL,
0);
DPRINT("errCode: %x\n", errCode);
if (!NT_SUCCESS(errCode))
{
SetLastError(RtlNtStatusToDosError(errCode));
return FALSE;
}
NtClose(DirectoryHandle);
return TRUE;
}

View file

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