Spelling stuff.
[wine] / dlls / ntdll / file.c
1 /*
2  * Copyright 1999, 2000 Juergen Schmied
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <stdlib.h>
20 #include <string.h>
21 #include "wine/debug.h"
22 #include "ntdll_misc.h"
23
24 #include "ntddk.h"
25 #include "winioctl.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
28
29 /**************************************************************************
30  *                 NtOpenFile                           [NTDLL.@]
31  *                 ZwOpenFile                           [NTDLL.@]
32  * FUNCTION: Opens a file
33  * ARGUMENTS:
34  *  FileHandle          Variable that receives the file handle on return
35  *  DesiredAccess       Access desired by the caller to the file
36  *  ObjectAttributes    Structue describing the file to be opened
37  *  IoStatusBlock       Receives details about the result of the operation
38  *  ShareAccess         Type of shared access the caller requires
39  *  OpenOptions         Options for the file open
40  */
41 NTSTATUS WINAPI NtOpenFile(
42         OUT PHANDLE FileHandle,
43         ACCESS_MASK DesiredAccess,
44         POBJECT_ATTRIBUTES ObjectAttributes,
45         OUT PIO_STATUS_BLOCK IoStatusBlock,
46         ULONG ShareAccess,
47         ULONG OpenOptions)
48 {
49         FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx) stub\n",
50         FileHandle, DesiredAccess, ObjectAttributes, 
51         IoStatusBlock, ShareAccess, OpenOptions);
52         dump_ObjectAttributes (ObjectAttributes);
53         return 0;
54 }
55
56 /**************************************************************************
57  *              NtCreateFile                            [NTDLL.@]
58  *              ZwCreateFile                            [NTDLL.@]
59  * FUNCTION: Either causes a new file or directory to be created, or it opens
60  *  an existing file, device, directory or volume, giving the caller a handle
61  *  for the file object. This handle can be used by subsequent calls to
62  *  manipulate data within the file or the file object's state of attributes.
63  * ARGUMENTS:
64  *      FileHandle              Points to a variable which receives the file handle on return
65  *      DesiredAccess           Desired access to the file
66  *      ObjectAttributes        Structure describing the file
67  *      IoStatusBlock           Receives information about the operation on return
68  *      AllocationSize          Initial size of the file in bytes
69  *      FileAttributes          Attributes to create the file with
70  *      ShareAccess             Type of shared access the caller would like to the file
71  *      CreateDisposition       Specifies what to do, depending on whether the file already exists
72  *      CreateOptions           Options for creating a new file
73  *      EaBuffer                Undocumented
74  *      EaLength                Undocumented
75  */
76 NTSTATUS WINAPI NtCreateFile(
77         OUT PHANDLE FileHandle,
78         ACCESS_MASK DesiredAccess,
79         POBJECT_ATTRIBUTES ObjectAttributes,
80         OUT PIO_STATUS_BLOCK IoStatusBlock,
81         PLARGE_INTEGER AllocateSize,
82         ULONG FileAttributes,
83         ULONG ShareAccess,
84         ULONG CreateDisposition,
85         ULONG CreateOptions,
86         PVOID EaBuffer,
87         ULONG EaLength)  
88 {
89         FIXME("(%p,0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n",
90         FileHandle,DesiredAccess,ObjectAttributes,
91         IoStatusBlock,AllocateSize,FileAttributes,
92         ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength);
93         dump_ObjectAttributes (ObjectAttributes);
94         return 0;
95 }
96
97 /******************************************************************************
98  *  NtReadFile                                  [NTDLL.@]
99  *  ZwReadFile                                  [NTDLL.@]
100  *
101  * Parameters
102  *   HANDLE32           FileHandle
103  *   HANDLE32           Event           OPTIONAL
104  *   PIO_APC_ROUTINE    ApcRoutine      OPTIONAL
105  *   PVOID              ApcContext      OPTIONAL
106  *   PIO_STATUS_BLOCK   IoStatusBlock
107  *   PVOID              Buffer
108  *   ULONG              Length
109  *   PLARGE_INTEGER     ByteOffset      OPTIONAL
110  *   PULONG             Key             OPTIONAL
111  */
112 NTSTATUS WINAPI NtReadFile (
113         HANDLE FileHandle,
114         HANDLE EventHandle,
115         PIO_APC_ROUTINE ApcRoutine,
116         PVOID ApcContext,
117         PIO_STATUS_BLOCK IoStatusBlock,
118         PVOID Buffer,
119         ULONG Length,
120         PLARGE_INTEGER ByteOffset,
121         PULONG Key)
122 {
123         FIXME("(0x%08x,0x%08x,%p,%p,%p,%p,0x%08lx,%p,%p),stub!\n",
124         FileHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,Buffer,Length,ByteOffset,Key);
125         return 0;
126 }
127
128 /**************************************************************************
129  *              NtDeviceIoControlFile                   [NTDLL.@]
130  *              ZwDeviceIoControlFile                   [NTDLL.@]
131  */
132 NTSTATUS WINAPI NtDeviceIoControlFile(
133         IN HANDLE DeviceHandle,
134         IN HANDLE Event OPTIONAL,
135         IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
136         IN PVOID UserApcContext OPTIONAL,
137         OUT PIO_STATUS_BLOCK IoStatusBlock,
138         IN ULONG IoControlCode,
139         IN PVOID InputBuffer,
140         IN ULONG InputBufferSize,
141         OUT PVOID OutputBuffer,
142         IN ULONG OutputBufferSize)
143 {
144         FIXME("(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): empty stub\n",
145         DeviceHandle, Event, UserApcRoutine, UserApcContext,
146         IoStatusBlock, IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
147         return 0;
148 }
149
150 /******************************************************************************
151  * NtFsControlFile [NTDLL.@]
152  * ZwFsControlFile [NTDLL.@]
153  */
154 NTSTATUS WINAPI NtFsControlFile(
155         IN HANDLE DeviceHandle,
156         IN HANDLE Event OPTIONAL,
157         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
158         IN PVOID ApcContext OPTIONAL,
159         OUT PIO_STATUS_BLOCK IoStatusBlock,
160         IN ULONG IoControlCode,
161         IN PVOID InputBuffer,
162         IN ULONG InputBufferSize,
163         OUT PVOID OutputBuffer,
164         IN ULONG OutputBufferSize)
165 {
166         FIXME("(0x%08x,0x%08x,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): stub\n",
167         DeviceHandle,Event,ApcRoutine,ApcContext,IoStatusBlock,IoControlCode,
168         InputBuffer,InputBufferSize,OutputBuffer,OutputBufferSize);
169         return 0;
170 }
171
172 /******************************************************************************
173  *  NtSetVolumeInformationFile          [NTDLL.@]
174  *  ZwSetVolumeInformationFile          [NTDLL.@]
175  */
176 NTSTATUS WINAPI NtSetVolumeInformationFile(
177         IN HANDLE FileHandle,
178         PIO_STATUS_BLOCK IoStatusBlock,
179         PVOID FsInformation,
180         ULONG Length,
181         FS_INFORMATION_CLASS FsInformationClass) 
182 {
183         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x) stub\n",
184         FileHandle,IoStatusBlock,FsInformation,Length,FsInformationClass);
185         return 0;
186 }
187
188 /******************************************************************************
189  *  NtQueryInformationFile              [NTDLL.@]
190  *  ZwQueryInformationFile              [NTDLL.@]
191  */
192 NTSTATUS WINAPI NtQueryInformationFile(
193         HANDLE FileHandle,
194         PIO_STATUS_BLOCK IoStatusBlock,
195         PVOID FileInformation,
196         ULONG Length,
197         FILE_INFORMATION_CLASS FileInformationClass)
198 {
199         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x),stub!\n",
200         FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
201         return 0;
202 }
203
204 /******************************************************************************
205  *  NtSetInformationFile                [NTDLL.@]
206  *  ZwSetInformationFile                [NTDLL.@]
207  */
208 NTSTATUS WINAPI NtSetInformationFile(
209         HANDLE FileHandle,
210         PIO_STATUS_BLOCK IoStatusBlock,
211         PVOID FileInformation,
212         ULONG Length,
213         FILE_INFORMATION_CLASS FileInformationClass)
214 {
215         FIXME("(0x%08x,%p,%p,0x%08lx,0x%08x)\n",
216         FileHandle,IoStatusBlock,FileInformation,Length,FileInformationClass);
217         return 0;
218 }
219
220 /******************************************************************************
221  *  NtQueryDirectoryFile        [NTDLL.@]
222  *  ZwQueryDirectoryFile        [NTDLL.@]
223  *  ZwQueryDirectoryFile
224  */
225 NTSTATUS WINAPI NtQueryDirectoryFile(
226         IN HANDLE FileHandle,
227         IN HANDLE Event OPTIONAL,
228         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
229         IN PVOID ApcContext OPTIONAL,
230         OUT PIO_STATUS_BLOCK IoStatusBlock,
231         OUT PVOID FileInformation,
232         IN ULONG Length,
233         IN FILE_INFORMATION_CLASS FileInformationClass,
234         IN BOOLEAN ReturnSingleEntry,
235         IN PUNICODE_STRING FileName OPTIONAL,
236         IN BOOLEAN RestartScan)
237 {
238         FIXME("(0x%08x 0x%08x %p %p %p %p 0x%08lx 0x%08x 0x%08x %p 0x%08x\n",
239         FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation,
240         Length, FileInformationClass, ReturnSingleEntry, 
241         debugstr_us(FileName),RestartScan);
242         return 0;
243 }
244
245 /******************************************************************************
246  *  NtQueryVolumeInformationFile                [NTDLL.@]
247  *  ZwQueryVolumeInformationFile                [NTDLL.@]
248  */
249 NTSTATUS WINAPI NtQueryVolumeInformationFile (
250         IN HANDLE FileHandle,
251         OUT PIO_STATUS_BLOCK IoStatusBlock,
252         OUT PVOID FSInformation,
253         IN ULONG Length,
254         IN FS_INFORMATION_CLASS FSInformationClass)
255 {
256         ULONG len = 0;
257
258         FIXME("(0x%08x %p %p 0x%08lx 0x%08x) stub!\n",
259         FileHandle, IoStatusBlock, FSInformation, Length, FSInformationClass);
260
261         switch ( FSInformationClass )
262         {
263           case FileFsVolumeInformation:
264             len = sizeof( FILE_FS_VOLUME_INFORMATION );
265             break;
266           case FileFsLabelInformation:
267             len = 0;
268             break;
269
270           case FileFsSizeInformation:
271             len = sizeof( FILE_FS_SIZE_INFORMATION );
272             break;
273
274           case FileFsDeviceInformation: 
275             len = sizeof( FILE_FS_DEVICE_INFORMATION );
276             break;
277           case FileFsAttributeInformation:
278             len = sizeof( FILE_FS_ATTRIBUTE_INFORMATION );
279             break;
280
281           case FileFsControlInformation:
282             len = 0;
283             break;
284
285           case FileFsFullSizeInformation:
286             len = 0;
287             break;
288
289           case FileFsObjectIdInformation:
290             len = 0;
291             break;
292
293           case FileFsMaximumInformation:
294             len = 0;
295             break;
296         }
297
298         if (Length < len)
299           return STATUS_BUFFER_TOO_SMALL;
300
301         switch ( FSInformationClass )
302         {
303           case FileFsVolumeInformation:
304             break;
305           case FileFsLabelInformation:
306             break;
307
308           case FileFsSizeInformation:
309             break;
310
311           case FileFsDeviceInformation: 
312             if (FSInformation)
313             {
314               FILE_FS_DEVICE_INFORMATION * DeviceInfo = FSInformation;
315               DeviceInfo->DeviceType = FILE_DEVICE_DISK; 
316               DeviceInfo->Characteristics = 0;
317               break;
318             };
319           case FileFsAttributeInformation:
320             break;
321
322           case FileFsControlInformation:
323             break;
324
325           case FileFsFullSizeInformation:
326             break;
327
328           case FileFsObjectIdInformation:
329             break;
330
331           case FileFsMaximumInformation:
332             break;
333         }
334         IoStatusBlock->DUMMYUNIONNAME.Status = STATUS_SUCCESS;
335         IoStatusBlock->Information = len;
336         return STATUS_SUCCESS;
337 }