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