Skip to content

Commit

Permalink
Fix tests not targeting private msquic.sys (#4055)
Browse files Browse the repository at this point in the history
  • Loading branch information
csujedihy authored Jan 14, 2024
1 parent f0b34fe commit 04cdfa1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bin/winkernel/msquicpriv.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_TELEMETRY_ASSERTS=1;SECURITY_KERNEL;SECURITY_WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>QUIC_TEST_NMR_PROVIDER;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_TELEMETRY_ASSERTS=1;SECURITY_KERNEL;SECURITY_WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_TELEMETRY_ASSERTS=1;SECURITY_KERNEL;SECURITY_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>QUIC_TEST_NMR_PROVIDER;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_TELEMETRY_ASSERTS=1;SECURITY_KERNEL;SECURITY_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down
5 changes: 5 additions & 0 deletions src/bin/winkernel/nmrprovider.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "quic_platform.h"
#include <wdm.h>
#include "msquic.h"
#include "msquicp.h"
#include "quic_trace.h"
#ifdef QUIC_CLOG
#include "nmrprovider.c.clog.h"
Expand Down Expand Up @@ -95,6 +96,10 @@ MsQuicRegisterNmrProvider(
NmrProvider.NpiProviderCharacteristics.ProviderAttachClient = MsQuicNmrProviderAttachClient;
NmrProvider.NpiProviderCharacteristics.ProviderDetachClient = MsQuicNmrProviderDetachClient;

#ifdef QUIC_TEST_NMR_PROVIDER
QUIC_ENABLE_PRIVATE_NMR_PROVIDER();
#endif

ProviderRegistrationInstance = &NmrProvider.NpiProviderCharacteristics.ProviderRegistrationInstance;
ProviderRegistrationInstance->Version = 0;
ProviderRegistrationInstance->Size = sizeof(*ProviderRegistrationInstance);
Expand Down
5 changes: 5 additions & 0 deletions src/inc/msquicp.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ typedef struct QUIC_PRIVATE_TRANSPORT_PARAMETER {
#define QUIC_PARAM_STREAM_RELIABLE_OFFSET_RECV 0x88000000 // uint64_t
#endif

#define QUIC_ENABLE_PRIVATE_NMR_PROVIDER(...) \
do { \
MSQUIC_NPI_ID.Data1 = 0xDEADC0DE; \
} while (FALSE)

#if defined(__cplusplus)
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/test/bin/winkernel/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "control.cpp.clog.h"
#endif

#include "msquicp.h"

const MsQuicApi* MsQuic;
QUIC_CREDENTIAL_CONFIG ServerSelfSignedCredConfig;
QUIC_CREDENTIAL_CONFIG ServerSelfSignedCredConfigClientAuth;
Expand Down Expand Up @@ -82,6 +84,10 @@ QuicTestCtlInitialize(
WDF_IO_QUEUE_CONFIG QueueConfig;
WDFQUEUE Queue;

#ifdef QUIC_TEST_NMR_PROVIDER
QUIC_ENABLE_PRIVATE_NMR_PROVIDER();
#endif

Status = MsQuicNmrClientRegister(&NmrClient, &MSQUIC_MODULE_ID, 5000);
if (!NT_SUCCESS(Status)) {
QuicTraceEvent(
Expand Down
4 changes: 2 additions & 2 deletions src/test/bin/winkernel/msquictestpriv.kernel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>PRIVATE_LIBRARY;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_DISABLE_0RTT_TESTS;SECURITY_KERNEL;SECURITY_WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>QUIC_TEST_NMR_PROVIDER;PRIVATE_LIBRARY;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_DISABLE_0RTT_TESTS;SECURITY_KERNEL;SECURITY_WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>PRIVATE_LIBRARY;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_DISABLE_0RTT_TESTS;SECURITY_KERNEL;SECURITY_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>QUIC_TEST_NMR_PROVIDER;PRIVATE_LIBRARY;QUIC_EVENTS_MANIFEST_ETW;QUIC_LOGS_MANIFEST_ETW;QUIC_DISABLE_0RTT_TESTS;SECURITY_KERNEL;SECURITY_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit 04cdfa1

Please sign in to comment.