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
|
2005-12-01 21:37:19 +00:00
|
|
|
#include <ntddk.h>
|
2005-02-02 23:07:33 +00:00
|
|
|
#include <reactos/rossym.h>
|
|
|
|
#include "rossympriv.h"
|
|
|
|
|
2010-12-04 21:16:35 +00:00
|
|
|
#define NDEBUG
|
2005-02-02 23:07:33 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
2010-12-15 23:37:54 +00:00
|
|
|
NTSTATUS RosSymStatus;
|
|
|
|
|
2005-02-02 23:07:33 +00:00
|
|
|
BOOLEAN
|
|
|
|
RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size)
|
|
|
|
{
|
2010-12-15 23:37:54 +00:00
|
|
|
//NTSTATUS Status;
|
2005-02-02 23:07:33 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
|
2010-12-15 23:37:54 +00:00
|
|
|
RosSymStatus = ZwReadFile(*((HANDLE *) FileContext),
|
2005-02-02 23:07:33 +00:00
|
|
|
0, 0, 0,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
Size,
|
|
|
|
0, 0);
|
|
|
|
|
2010-12-15 23:37:54 +00:00
|
|
|
return NT_SUCCESS(RosSymStatus) && IoStatusBlock.Information == Size;
|
2005-02-02 23:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
RosSymZwSeekFile(PVOID FileContext, ULONG_PTR Position)
|
|
|
|
{
|
2010-12-15 23:37:54 +00:00
|
|
|
//NTSTATUS Status;
|
2005-02-02 23:07:33 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
FILE_POSITION_INFORMATION NewPosition;
|
|
|
|
|
|
|
|
NewPosition.CurrentByteOffset.u.HighPart = 0;
|
|
|
|
NewPosition.CurrentByteOffset.u.LowPart = Position;
|
2010-12-15 23:37:54 +00:00
|
|
|
RosSymStatus = ZwSetInformationFile(*((HANDLE *) FileContext),
|
2005-02-02 23:07:33 +00:00
|
|
|
&IoStatusBlock,
|
|
|
|
(PVOID) &NewPosition,
|
|
|
|
sizeof(FILE_POSITION_INFORMATION),
|
|
|
|
FilePositionInformation);
|
|
|
|
|
2010-12-15 23:37:54 +00:00
|
|
|
return NT_SUCCESS(RosSymStatus);
|
2005-02-02 23:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|