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