[CMAKE]
[reactos.git] / lib / rossym / zwfile.c
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 #define NTOSAPI
11 #include <ntddk.h>
12 #include <reactos/rossym.h>
13 #include "rossympriv.h"
14
15 #define NDEBUG
16 #include <debug.h>
17
18 NTSTATUS RosSymStatus;
19
20 BOOLEAN
21 RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
22 {
23 //NTSTATUS Status;
24 IO_STATUS_BLOCK IoStatusBlock;
25
26 RosSymStatus = ZwReadFile(*((HANDLE *) FileContext),
27 0, 0, 0,
28 &IoStatusBlock,
29 Buffer,
30 Size,
31 0, 0);
32
33 return NT_SUCCESS(RosSymStatus) && IoStatusBlock.Information == Size;
34 }
35
36 BOOLEAN
37 RosSymZwSeekFile(PVOID FileContext, ULONG_PTR Position)
38 {
39 //NTSTATUS Status;
40 IO_STATUS_BLOCK IoStatusBlock;
41 FILE_POSITION_INFORMATION NewPosition;
42
43 NewPosition.CurrentByteOffset.u.HighPart = 0;
44 NewPosition.CurrentByteOffset.u.LowPart = Position;
45 RosSymStatus = ZwSetInformationFile(*((HANDLE *) FileContext),
46 &IoStatusBlock,
47 (PVOID) &NewPosition,
48 sizeof(FILE_POSITION_INFORMATION),
49 FilePositionInformation);
50
51 return NT_SUCCESS(RosSymStatus);
52 }
53
54 /* EOF */