source: trunk/src/NTDLL/file.c@ 10367

Last change on this file since 10367 was 9986, checked in by sandervl, 22 years ago

PF: NTDLL update for GCC 3.2.1 + resync with Wine

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