Fixed a few problems with DCX_* flags handling.
[wine] / dlls / ntdll / file.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include "debugtools.h"
4 #include "ntdll_misc.h"
5
6 #include "ntddk.h"
7
8 DEFAULT_DEBUG_CHANNEL(ntdll);
9
10 /**************************************************************************
11  *                 NtOpenFile                           [NTDLL.@]
12  *                 ZwOpenFile                           [NTDLL.@]
13  * FUNCTION: Opens a file
14  * ARGUMENTS:
15  *  FileHandle          Variable that receives the file handle on return
16  *  DesiredAccess       Access desired by the caller to the file
17  *  ObjectAttributes    Structue describing the file to be opened
18  *  IoStatusBlock       Receives details about the result of the operation
19  *  ShareAccess         Type of shared access the caller requires
20  *  OpenOptions         Options for the file open
21  */
22 NTSTATUS WINAPI NtOpenFile(
23         OUT PHANDLE FileHandle,
24         ACCESS_MASK DesiredAccess,
25         POBJECT_ATTRIBUTES ObjectAttributes,
26         OUT PIO_STATUS_BLOCK IoStatusBlock,
27         ULONG ShareAccess,
28         ULONG OpenOptions)
29 {
30         FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx) stub\n",
31         FileHandle, DesiredAccess, ObjectAttributes, 
32         IoStatusBlock, ShareAccess, OpenOptions);
33         dump_ObjectAttributes (ObjectAttributes);
34         return 0;
35 }
36
37 /**************************************************************************
38  *              NtCreateFile                            [NTDLL.@]
39  *              ZwCreateFile                            [NTDLL.@]
40  * FUNCTION: Either causes a new file or directory to be created, or it opens
41  *  an existing file, device, directory or volume, giving the caller a handle
42  *  for the file object. This handle can be used by subsequent calls to
43  *  manipulate data within the file or the file object's state of attributes.
44  * ARGUMENTS:
45  *      FileHandle              Points to a variable which receives the file handle on return
46  *      DesiredAccess           Desired access to the file
47  *      ObjectAttributes        Structure describing the file
48  *      IoStatusBlock           Receives information about the operation on return
49  *      AllocationSize          Initial size of the file in bytes
50  *      FileAttributes          Attributes to create the file with
51  *      ShareAccess             Type of shared access the caller would like to the file
52  *      CreateDisposition       Specifies what to do, depending on whether the file already exists
53  *      CreateOptions           Options for creating a new file
54  *      EaBuffer                Undocumented
55  *      EaLength                Undocumented
56  */
57 NTSTATUS WINAPI NtCreateFile(
58         OUT PHANDLE FileHandle,
59         ACCESS_MASK DesiredAccess,
60         POBJECT_ATTRIBUTES ObjectAttributes,
61         OUT PIO_STATUS_BLOCK IoStatusBlock,
62         PLARGE_INTEGER AllocateSize,
63         ULONG FileAttributes,
64         ULONG ShareAccess,
65         ULONG CreateDisposition,
66         ULONG CreateOptions,
67         PVOID EaBuffer,
68         ULONG EaLength)  
69 {
70         FIXME("(%p,0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n",
71         FileHandle,DesiredAccess,ObjectAttributes,
72         IoStatusBlock,AllocateSize,FileAttributes,
73         ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength);
74         dump_ObjectAttributes (ObjectAttributes);
75         return 0;
76 }
77
78 /******************************************************************************
79  *  NtReadFile                                  [NTDLL.@]
80  *  ZwReadFile                                  [NTDLL.@]
81  *
82  * Parameters
83  *   HANDLE32           FileHandle
84  *   HANDLE32           Event           OPTIONAL
85  *   PIO_APC_ROUTINE    ApcRoutine      OPTIONAL
86  *   PVOID              ApcContext      OPTIONAL
87  *   PIO_STATUS_BLOCK   IoStatusBlock
88  *   PVOID              Buffer
89  *   ULONG              Length
90  *   PLARGE_INTEGER     ByteOffset      OPTIONAL
91  *   PULONG             Key             OPTIONAL
92  */
93 NTSTATUS WINAPI NtReadFile (
94         HANDLE FileHandle,
95         HANDLE EventHandle,
96         PIO_APC_ROUTINE ApcRoutine,
97         PVOID ApcContext,
98         PIO_STATUS_BLOCK IoStatusBlock,
99         PVOID Buffer,
100         ULONG Length,
101         PLARGE_INTEGER ByteOffset,
102         PULONG Key)
103 {
104         FIXME("(0x%08x,0x%08x,%p,%p,%p,%p,0x%08lx,%p,%p),stub!\n",
105         FileHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,Buffer,Length,ByteOffset,Key);
106         return 0;
107 }
108
109 /**************************************************************************
110  *              NtDeviceIoControlFile                   [NTDLL.@]
111  *              ZwDeviceIoControlFile                   [NTDLL.@]
112  */
113 NTSTATUS WINAPI NtDeviceIoControlFile(
114         IN HANDLE DeviceHandle,
115         IN HANDLE Event OPTIONAL,
116         IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
117         IN PVOID UserApcContext OPTIONAL,
118         OUT PIO_STATUS_BLOCK IoStatusBlock,
119         IN ULONG IoControlCode,
120         IN PVOID InputBuffer,
121         IN ULONG InputBufferSize,
122         OUT PVOID OutputBuffer,
123         IN ULONG OutputBufferSize)
124 {
125         FIXME("(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): empty stub\n",
126         DeviceHandle, Event, UserApcRoutine, UserApcContext,
127         IoStatusBlock, IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
128         return 0;
129 }
130
131 /******************************************************************************
132  * NtFsControlFile [NTDLL.@]
133  * ZwFsControlFile [NTDLL.@]
134  */
135 NTSTATUS WINAPI NtFsControlFile(
136         IN HANDLE DeviceHandle,
137         IN HANDLE Event OPTIONAL,
138         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
139         IN PVOID ApcContext OPTIONAL,
140         OUT PIO_STATUS_BLOCK IoStatusBlock,
141         IN ULONG IoControlCode,
142         IN PVOID InputBuffer,
143         IN ULONG InputBufferSize,
144         OUT PVOID OutputBuffer,
145         IN ULONG OutputBufferSize)
146 {
147         FIXME("(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): stub\n",
148         DeviceHandle,Event,ApcRoutine,ApcContext,IoStatusBlock,IoControlCode,
149         InputBuffer,InputBufferSize,OutputBuffer,OutputBufferSize);
150         return 0;
151 }
152
153 /******************************************************************************
154  *  NtSetVolumeInformationFile          [NTDLL.@]
155  *  ZwSetVolumeInformationFile          [NTDLL.@]
156  */
157 NTSTATUS WINAPI NtSetVolumeInformationFile(
158         IN HANDLE FileHandle,
159         PIO_STATUS_BLOCK IoStatusBlock,
160         PVOID FsInformation,
161         ULONG Length,
162         FS_INFORMATION_CLASS FsInformationClass) 
163 {
164         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x) stub\n",
165         FileHandle,IoStatusBlock,FsInformation,Length,FsInformationClass);
166         return 0;
167 }
168
169 /******************************************************************************
170  *  NtQueryInformationFile              [NTDLL.@]
171  *  ZwQueryInformationFile              [NTDLL.@]
172  */
173 NTSTATUS WINAPI NtQueryInformationFile(
174         HANDLE FileHandle,
175         PIO_STATUS_BLOCK IoStatusBlock,
176         PVOID FileInformation,
177         ULONG Length,
178         FILE_INFORMATION_CLASS FileInformationClass)
179 {
180         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x),stub!\n",
181         FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
182         return 0;
183 }
184
185 /******************************************************************************
186  *  NtSetInformationFile                [NTDLL.@]
187  *  ZwSetInformationFile                [NTDLL.@]
188  */
189 NTSTATUS WINAPI NtSetInformationFile(
190         HANDLE FileHandle,
191         PIO_STATUS_BLOCK IoStatusBlock,
192         PVOID FileInformation,
193         ULONG Length,
194         FILE_INFORMATION_CLASS FileInformationClass)
195 {
196         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x)\n",
197         FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
198         return 0;
199 }
200
201 /******************************************************************************
202  *  NtQueryDirectoryFile        [NTDLL.@]
203  *  ZwQueryDirectoryFile        [NTDLL.@]
204  *  ZwQueryDirectoryFile
205  */
206 NTSTATUS WINAPI NtQueryDirectoryFile(
207         IN HANDLE FileHandle,
208         IN HANDLE Event OPTIONAL,
209         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
210         IN PVOID ApcContext OPTIONAL,
211         OUT PIO_STATUS_BLOCK IoStatusBlock,
212         OUT PVOID FileInformation,
213         IN ULONG Length,
214         IN FILE_INFORMATION_CLASS FileInformationClass,
215         IN BOOLEAN ReturnSingleEntry,
216         IN PUNICODE_STRING FileName OPTIONAL,
217         IN BOOLEAN RestartScan)
218 {
219         FIXME("(0x%08x 0x%08x %p %p %p %p 0x%08lx 0x%08x 0x%08x %p 0x%08x\n",
220         FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation,
221         Length, FileInformationClass, ReturnSingleEntry, 
222         debugstr_us(FileName),RestartScan);
223         return 0;
224 }
225
226 /******************************************************************************
227  *  NtQueryVolumeInformationFile                [NTDLL.@]
228  *  ZwQueryVolumeInformationFile                [NTDLL.@]
229  */
230 NTSTATUS WINAPI NtQueryVolumeInformationFile (
231         IN HANDLE FileHandle,
232         OUT PIO_STATUS_BLOCK IoStatusBlock,
233         OUT PVOID FSInformation,
234         IN ULONG Length,
235         IN FS_INFORMATION_CLASS FSInformationClass)
236 {
237         TRACE("(0x%08x %p %p 0x%08lx 0x%08x) stub\n",
238         FileHandle, IoStatusBlock, FSInformation, Length, FSInformationClass);
239         return STATUS_SUCCESS;
240 }