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