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