2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/kernel32/file/create.c
5 * PURPOSE: Directory functions
6 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
7 GetTempFileName is modified from WINE [ Alexandre Juiliard ]
13 #undef WIN32_LEAN_AND_MEAN
15 #include <ddk/ntddk.h>
18 #include <kernel32/li.h>
21 HANDLE STDCALL
CreateFileA(LPCSTR lpFileName
,
22 DWORD dwDesiredAccess
,
24 LPSECURITY_ATTRIBUTES lpSecurityAttributes
,
25 DWORD dwCreationDisposition
,
26 DWORD dwFlagsAndAttributes
,
30 WCHAR FileNameW
[MAX_PATH
];
33 OutputDebugStringA("CreateFileA\n");
35 while ((*lpFileName
)!=0 && i
< MAX_PATH
)
37 FileNameW
[i
] = *lpFileName
;
43 return CreateFileW(FileNameW
,dwDesiredAccess
,
46 dwCreationDisposition
,
52 HANDLE STDCALL
CreateFileW(LPCWSTR lpFileName
,
53 DWORD dwDesiredAccess
,
55 LPSECURITY_ATTRIBUTES lpSecurityAttributes
,
56 DWORD dwCreationDisposition
,
57 DWORD dwFlagsAndAttributes
,
63 OBJECT_ATTRIBUTES ObjectAttributes
;
64 IO_STATUS_BLOCK IoStatusBlock
;
65 UNICODE_STRING FileNameString
;
67 WCHAR PathNameW
[MAX_PATH
];
70 WCHAR CurrentDir
[MAX_PATH
];
72 OutputDebugStringA("CreateFileW\n");
74 if (!(dwFlagsAndAttributes
& FILE_FLAG_OVERLAPPED
))
76 Flags
|= FILE_SYNCHRONOUS_IO_ALERT
;
79 // lstrcpyW(PathNameW,L"\\??\\");
86 dprintf("Name %w\n",PathNameW
);
87 if (lpFileName
[0] != L
'\\' && lpFileName
[1] != L
':')
89 Len
= GetCurrentDirectoryW(MAX_PATH
,CurrentDir
);
90 dprintf("CurrentDir %w\n",CurrentDir
);
91 lstrcatW(PathNameW
,CurrentDir
);
92 dprintf("Name %w\n",PathNameW
);
94 lstrcatW(PathNameW
,lpFileName
);
95 dprintf("Name %w\n",PathNameW
);
97 FileNameString
.Length
= lstrlenW( PathNameW
)*sizeof(WCHAR
);
99 if ( FileNameString
.Length
== 0 )
102 if ( FileNameString
.Length
> MAX_PATH
)
105 FileNameString
.Buffer
= (WCHAR
*)PathNameW
;
106 FileNameString
.MaximumLength
= FileNameString
.Length
;
108 ObjectAttributes
.Length
= sizeof(OBJECT_ATTRIBUTES
);
109 ObjectAttributes
.RootDirectory
= NULL
;
110 ObjectAttributes
.ObjectName
= &FileNameString
;
111 ObjectAttributes
.Attributes
= OBJ_CASE_INSENSITIVE
;
112 ObjectAttributes
.SecurityDescriptor
= NULL
;
113 ObjectAttributes
.SecurityQualityOfService
= NULL
;
115 Status
= NtCreateFile(&FileHandle
,
120 dwFlagsAndAttributes
,
122 dwCreationDisposition
,