Skip to content

Commit

Permalink
Use Zw version API
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-GS committed Jan 16, 2025
1 parent fd58cee commit 1f9c6e9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/bin/winkernel/msquic.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</ClCompile>
<Link>
<ModuleDefinitionFile>msquic.src</ModuleDefinitionFile>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;ndis.lib;netio.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;ndis.lib;netio.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/kernel /NOOPTIDATA /pdbcompress /MERGE:.gfids=GFIDS /MERGE:.orpc=.text /MERGE:_PAGE=PAGE /MERGE:_RDATA=.rdata /MERGE:_TEXT=.text /section:GFIDS,d</AdditionalOptions>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/bin/winkernel/msquicpriv.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</ClCompile>
<Link>
<ModuleDefinitionFile>msquicpriv.src</ModuleDefinitionFile>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;ndis.lib;netio.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;ndis.lib;netio.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/kernel /NOOPTIDATA /pdbcompress /MERGE:.gfids=GFIDS /MERGE:.orpc=.text /MERGE:_PAGE=PAGE /MERGE:_RDATA=.rdata /MERGE:_TEXT=.text /section:GFIDS,d</AdditionalOptions>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
Expand Down
52 changes: 28 additions & 24 deletions src/inc/quic_platform_winkernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,34 +484,38 @@ typedef struct _FILE_IO_COMPLETION_INFORMATION {
IO_STATUS_BLOCK IoStatusBlock;
} FILE_IO_COMPLETION_INFORMATION, *PFILE_IO_COMPLETION_INFORMATION;

__kernel_entry NTSYSCALLAPI
// copied from zwapi.h
NTSYSAPI
NTSTATUS
NtCreateIoCompletion (
_Out_ PHANDLE IoCompletionHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ ULONG Count
NTAPI
ZwCreateIoCompletion (
OUT PHANDLE IoCompletionHandle,
IN ACCESS_MASK DesiredAccess,
IN OPTIONAL POBJECT_ATTRIBUTES ObjectAttributes,
IN OPTIONAL ULONG Count
);

__kernel_entry NTSYSCALLAPI
NTSYSAPI
NTSTATUS
NtSetIoCompletion (
_In_ HANDLE IoCompletionHandle,
_In_opt_ PVOID KeyContext,
_In_opt_ PVOID ApcContext,
_In_ NTSTATUS IoStatus,
_In_ ULONG_PTR IoStatusInformation
NTAPI
ZwSetIoCompletion (
IN HANDLE IoCompletionHandle,
IN PVOID KeyContext,
IN PVOID ApcContext,
IN NTSTATUS IoStatus,
IN ULONG_PTR IoStatusInformation
);

__kernel_entry NTSYSCALLAPI
NTSYSAPI
NTSTATUS
NtRemoveIoCompletionEx (
_In_ HANDLE IoCompletionHandle,
_Out_writes_to_(Count, *NumEntriesRemoved) PFILE_IO_COMPLETION_INFORMATION IoCompletionInformation,
_In_ ULONG Count,
_Out_ PULONG NumEntriesRemoved,
_In_opt_ PLARGE_INTEGER Timeout,
_In_ BOOLEAN Alertable
NTAPI
ZwRemoveIoCompletionEx (
IN HANDLE IoCompletionHandle,
OUT PFILE_IO_COMPLETION_INFORMATION IoCompletionInformation,
IN ULONG Count,
OUT PULONG NumEntriesRemoved,
IN PLARGE_INTEGER Timeout OPTIONAL,
IN BOOLEAN Alertable
);

//
Expand Down Expand Up @@ -540,7 +544,7 @@ CxPlatEventQInitialize(
_Out_ CXPLAT_EVENTQ* queue
)
{
return NT_SUCCESS(NtCreateIoCompletion(queue, IO_COMPLETION_ALL_ACCESS, NULL, 0));
return NT_SUCCESS(ZwCreateIoCompletion(queue, IO_COMPLETION_ALL_ACCESS, NULL, 0));
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand All @@ -561,7 +565,7 @@ CxPlatEventQEnqueue(
_In_ CXPLAT_SQE* sqe
)
{
return NT_SUCCESS(NtSetIoCompletion(*queue, NULL, sqe, STATUS_SUCCESS, 0));
return NT_SUCCESS(ZwSetIoCompletion(*queue, NULL, sqe, STATUS_SUCCESS, 0));
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand All @@ -578,7 +582,7 @@ CxPlatEventQDequeue(
timeout.QuadPart = -10000LL * wait_time;

ULONG entriesRemoved = 0;
NTSTATUS status = NtRemoveIoCompletionEx(
NTSTATUS status = ZwRemoveIoCompletionEx(
*queue,
events,
count,
Expand Down
2 changes: 1 addition & 1 deletion src/perf/bin/secnetperfdriver.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)artifacts\bin\winkernel\$(Platform)_$(Configuration)_schannel\</AdditionalLibraryDirectories>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquic.lib;ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquic.lib;ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/perf/bin/secnetperfdriverpriv.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)artifacts\bin\winkernel\$(Platform)_$(Configuration)_schannel\</AdditionalLibraryDirectories>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquicpriv.lib;ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquicpriv.lib;ndis.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/test/bin/winkernel/msquictest.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)artifacts\bin\winkernel\$(Platform)_$(Configuration)_schannel\</AdditionalLibraryDirectories>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquic.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquic.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/test/bin/winkernel/msquictestpriv.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)artifacts\bin\winkernel\$(Platform)_$(Configuration)_schannel\</AdditionalLibraryDirectories>
<AdditionalDependencies>ntdll.lib;cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquicpriv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>cng.lib;ksecdd.lib;msnetioid.lib;netio.lib;wdmsec.lib;uuid.lib;msquicpriv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
Expand Down

0 comments on commit 1f9c6e9

Please sign in to comment.