mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
correct bug on CreateDirectory : crash if no template
correct call to ZwCreateFile svn path=/trunk/; revision=225
This commit is contained in:
parent
9e65542bad
commit
638ba1c9e4
1 changed files with 15 additions and 2 deletions
|
@ -35,9 +35,12 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
|
|||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||
{
|
||||
WCHAR TemplateDirectoryW[MAX_PATH];
|
||||
PWCHAR pTemplateDirectoryW;
|
||||
WCHAR NewDirectoryW[MAX_PATH];
|
||||
ULONG i;
|
||||
i = 0;
|
||||
if(lpTemplateDirectory)
|
||||
{
|
||||
while ((*lpTemplateDirectory)!=0 && i < MAX_PATH)
|
||||
{
|
||||
TemplateDirectoryW[i] = *lpTemplateDirectory;
|
||||
|
@ -45,6 +48,9 @@ WINBOOL STDCALL CreateDirectoryExA(LPCSTR lpTemplateDirectory,
|
|||
i++;
|
||||
}
|
||||
TemplateDirectoryW[i] = 0;
|
||||
pTemplateDirectoryW=TemplateDirectoryW;
|
||||
}
|
||||
else pTemplateDirectoryW=NULL;
|
||||
|
||||
i = 0;
|
||||
while ((*lpNewDirectory)!=0 && i < MAX_PATH)
|
||||
|
@ -76,6 +82,7 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING DirectoryNameString;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
WCHAR FileNameW[MAX_PATH];
|
||||
|
||||
if ( lpTemplateDirectory != NULL )
|
||||
{
|
||||
|
@ -84,6 +91,12 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
FileNameW[0] = '\\';
|
||||
FileNameW[1] = '?';
|
||||
FileNameW[2] = '?';
|
||||
FileNameW[3] = '\\';
|
||||
FileNameW[4] = 0;
|
||||
wcscat(FileNameW,lpNewDirectory);
|
||||
DirectoryNameString.Length = lstrlenW(lpNewDirectory)*sizeof(WCHAR);
|
||||
DirectoryNameString.Buffer = (WCHAR *)lpNewDirectory;
|
||||
DirectoryNameString.MaximumLength = DirectoryNameString.Length+sizeof(WCHAR);
|
||||
|
@ -100,10 +113,10 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
NULL,
|
||||
FILE_ATTRIBUTE_DIRECTORY,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0,
|
||||
FILE_CREATE,
|
||||
0,
|
||||
FILE_DIRECTORY_FILE,
|
||||
NULL,
|
||||
0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue