2005-02-02 23:07:33 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: lib/rossym/zwfile.c
|
|
|
|
* PURPOSE: File I/O using native functions
|
2007-10-19 23:21:45 +00:00
|
|
|
*
|
2005-02-02 23:07:33 +00:00
|
|
|
* PROGRAMMERS: Ge van Geldorp (gvg@reactos.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NTOSAPI
|
2014-02-04 10:47:12 +00:00
|
|
|
#include <wdm.h>
|
2005-02-02 23:07:33 +00:00
|
|
|
#include <reactos/rossym.h>
|
|
|
|
#include "rossympriv.h"
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
|
|
|
|
Status = ZwReadFile(*((HANDLE *) FileContext),
|
2017-10-25 11:57:27 +00:00
|
|
|
NULL, NULL, NULL,
|
2005-02-02 23:07:33 +00:00
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
Size,
|
2017-10-25 11:57:27 +00:00
|
|
|
NULL, NULL);
|
2005-02-02 23:07:33 +00:00
|
|
|
|
|
|
|
return NT_SUCCESS(Status) && IoStatusBlock.Information == Size;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
RosSymZwSeekFile(PVOID FileContext, ULONG_PTR Position)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
FILE_POSITION_INFORMATION NewPosition;
|
|
|
|
|
|
|
|
NewPosition.CurrentByteOffset.u.HighPart = 0;
|
|
|
|
NewPosition.CurrentByteOffset.u.LowPart = Position;
|
|
|
|
Status = ZwSetInformationFile(*((HANDLE *) FileContext),
|
|
|
|
&IoStatusBlock,
|
|
|
|
(PVOID) &NewPosition,
|
|
|
|
sizeof(FILE_POSITION_INFORMATION),
|
|
|
|
FilePositionInformation);
|
|
|
|
|
|
|
|
return NT_SUCCESS(Status);
|
|
|
|
}
|