xref: /reactos/sdk/lib/rossym_new/zwfile.c (revision 80774a2f)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS kernel
4  * FILE:            lib/rossym/zwfile.c
5  * PURPOSE:         File I/O using native functions
6  *
7  * PROGRAMMERS:     Ge van Geldorp (gvg@reactos.com)
8  */
9 
10 #include <precomp.h>
11 
12 NTSTATUS RosSymStatus;
13 
14 BOOLEAN
15 RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
16 {
17 	//NTSTATUS Status;
18   IO_STATUS_BLOCK IoStatusBlock;
19 
20   RosSymStatus = ZwReadFile(*((HANDLE *) FileContext),
21                       NULL, NULL, NULL,
22                       &IoStatusBlock,
23                       Buffer,
24                       Size,
25                       NULL, NULL);
26 
27   return NT_SUCCESS(RosSymStatus) && IoStatusBlock.Information == Size;
28 }
29 
30 BOOLEAN
31 RosSymZwSeekFile(PVOID FileContext, ULONG_PTR Position)
32 {
33 	//NTSTATUS Status;
34   IO_STATUS_BLOCK IoStatusBlock;
35   FILE_POSITION_INFORMATION NewPosition;
36 
37   NewPosition.CurrentByteOffset.u.HighPart = 0;
38   NewPosition.CurrentByteOffset.u.LowPart = Position;
39   RosSymStatus = ZwSetInformationFile(*((HANDLE *) FileContext),
40                                 &IoStatusBlock,
41                                 (PVOID) &NewPosition,
42                                 sizeof(FILE_POSITION_INFORMATION),
43                                 FilePositionInformation);
44 
45   return NT_SUCCESS(RosSymStatus);
46 }
47 
48 /* EOF */
49