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