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 <wdm.h> 11 #include <reactos/rossym.h> 12 #include "rossympriv.h" 13 14 BOOLEAN 15 RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size) 16 { 17 NTSTATUS Status; 18 IO_STATUS_BLOCK IoStatusBlock; 19 20 Status = ZwReadFile(*((HANDLE *) FileContext), 21 NULL, NULL, NULL, 22 &IoStatusBlock, 23 Buffer, 24 Size, 25 NULL, NULL); 26 27 return NT_SUCCESS(Status) && 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 Status = ZwSetInformationFile(*((HANDLE *) FileContext), 40 &IoStatusBlock, 41 (PVOID) &NewPosition, 42 sizeof(FILE_POSITION_INFORMATION), 43 FilePositionInformation); 44 45 return NT_SUCCESS(Status); 46 } 47