Skip to content

Commit 1b527be

Browse files
committed
Make PhSetFilePosition parameter optional
1 parent 9ab9a46 commit 1b527be

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

phlib/include/phnative.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ NTSTATUS
662662
NTAPI
663663
PhSetFilePosition(
664664
_In_ HANDLE FileHandle,
665-
_In_ PLARGE_INTEGER Position
665+
_In_opt_ PLARGE_INTEGER Position
666666
);
667667

668668
PHLIBAPI

phlib/native.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,13 +3109,16 @@ NTSTATUS PhGetFilePosition(
31093109

31103110
NTSTATUS PhSetFilePosition(
31113111
_In_ HANDLE FileHandle,
3112-
_In_ PLARGE_INTEGER Position
3112+
_In_opt_ PLARGE_INTEGER Position
31133113
)
31143114
{
31153115
FILE_POSITION_INFORMATION positionInfo;
31163116
IO_STATUS_BLOCK isb;
31173117

3118-
positionInfo.CurrentByteOffset = *Position;
3118+
if (Position)
3119+
positionInfo.CurrentByteOffset = *Position;
3120+
else
3121+
positionInfo.CurrentByteOffset.QuadPart = 0;
31193122

31203123
return NtSetInformationFile(
31213124
FileHandle,

0 commit comments

Comments
 (0)