mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Some more fixes.
svn path=/trunk/; revision=432
This commit is contained in:
parent
14e5e06271
commit
0064915ad7
2 changed files with 95 additions and 50 deletions
|
@ -27,44 +27,56 @@
|
||||||
WINBOOL STDCALL CreateDirectoryA(LPCSTR lpPathName,
|
WINBOOL STDCALL CreateDirectoryA(LPCSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||||
{
|
{
|
||||||
return CreateDirectoryExA(NULL,lpPathName,lpSecurityAttributes);
|
return CreateDirectoryExA(NULL,lpPathName,lpSecurityAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
|
WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
|
||||||
LPCSTR lpNewDirectory,
|
LPCSTR lpNewDirectory,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||||
{
|
{
|
||||||
WCHAR TemplateDirectoryW[MAX_PATH];
|
WCHAR TemplateDirectoryW[MAX_PATH];
|
||||||
WCHAR NewDirectoryW[MAX_PATH];
|
WCHAR NewDirectoryW[MAX_PATH];
|
||||||
ULONG i;
|
ULONG i;
|
||||||
i = 0;
|
|
||||||
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
|
|
||||||
{
|
|
||||||
TemplateDirectoryW[i] = *lpTemplateDirectory;
|
|
||||||
lpTemplateDirectory++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
TemplateDirectoryW[i] = 0;
|
|
||||||
|
|
||||||
i = 0;
|
DPRINT("lpTemplateDirectory %s lpNewDirectory %s lpSecurityAttributes %p\n",
|
||||||
while ((*lpNewDirectory)!=0 && i < MAX_PATH)
|
lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes);
|
||||||
{
|
|
||||||
NewDirectoryW[i] = *lpNewDirectory;
|
if (lpTemplateDirectory)
|
||||||
lpNewDirectory++;
|
{
|
||||||
i++;
|
i = 0;
|
||||||
}
|
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
|
||||||
NewDirectoryW[i] = 0;
|
{
|
||||||
return CreateDirectoryExW(TemplateDirectoryW,
|
TemplateDirectoryW[i] = *lpTemplateDirectory;
|
||||||
NewDirectoryW,
|
lpTemplateDirectory++;
|
||||||
lpSecurityAttributes);
|
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,
|
WINBOOL STDCALL CreateDirectoryW(LPCWSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||||
{
|
{
|
||||||
|
return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes);
|
||||||
return CreateDirectoryExW(NULL,lpPathName,lpSecurityAttributes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
||||||
|
@ -76,8 +88,11 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
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__);
|
||||||
|
@ -87,14 +102,14 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
||||||
DirectoryNameString.Length = lstrlenW(lpNewDirectory)*sizeof(WCHAR);
|
DirectoryNameString.Length = lstrlenW(lpNewDirectory)*sizeof(WCHAR);
|
||||||
DirectoryNameString.Buffer = (WCHAR *)lpNewDirectory;
|
DirectoryNameString.Buffer = (WCHAR *)lpNewDirectory;
|
||||||
DirectoryNameString.MaximumLength = DirectoryNameString.Length+sizeof(WCHAR);
|
DirectoryNameString.MaximumLength = DirectoryNameString.Length+sizeof(WCHAR);
|
||||||
|
|
||||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||||
ObjectAttributes.RootDirectory = NULL;
|
ObjectAttributes.RootDirectory = NULL;
|
||||||
ObjectAttributes.ObjectName = &DirectoryNameString;
|
ObjectAttributes.ObjectName = &DirectoryNameString;
|
||||||
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT;
|
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE | OBJ_INHERIT;
|
||||||
ObjectAttributes.SecurityDescriptor = NULL;
|
ObjectAttributes.SecurityDescriptor = NULL;
|
||||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||||
|
|
||||||
errCode = ZwCreateFile(&DirectoryHandle,
|
errCode = ZwCreateFile(&DirectoryHandle,
|
||||||
DIRECTORY_ALL_ACCESS,
|
DIRECTORY_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -106,15 +121,15 @@ 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));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(DirectoryHandle);
|
NtClose(DirectoryHandle);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
if (lpRootPathName)
|
||||||
|
{
|
||||||
|
wcsncpy (RootPathName, lpRootPathName, 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetCurrentDirectoryW (MAX_PATH, RootPathName);
|
||||||
|
RootPathName[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
hFile = CreateFileW(lpRootPathName,
|
hFile = CreateFileW(RootPathName,
|
||||||
FILE_READ_ATTRIBUTES,
|
FILE_READ_ATTRIBUTES,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -194,17 +213,20 @@ GetDiskFreeSpaceExA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR DirectoryNameW[MAX_PATH];
|
WCHAR DirectoryNameW[MAX_PATH];
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
i = 0;
|
if (lpDirectoryName)
|
||||||
while ((*lpDirectoryName)!=0 && i < MAX_PATH)
|
|
||||||
{
|
{
|
||||||
DirectoryNameW[i] = *lpDirectoryName;
|
ULONG i = 0;
|
||||||
lpDirectoryName++;
|
while ((*lpDirectoryName)!=0 && i < MAX_PATH)
|
||||||
i++;
|
{
|
||||||
|
DirectoryNameW[i] = *lpDirectoryName;
|
||||||
|
lpDirectoryName++;
|
||||||
|
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,
|
||||||
|
|
Loading…
Reference in a new issue