Skip to content

Commit

Permalink
Fixes for Building Kernel Mode in OS (microsoft#129)
Browse files Browse the repository at this point in the history
Fixes a number of build breaks in the OS repo from recent kernel mode code refactoring.
  • Loading branch information
nibanks authored Feb 12, 2020
1 parent 51d021f commit 8160a29
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 30 deletions.
7 changes: 0 additions & 7 deletions src/bin/winkernel/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
--*/

#include <ntverp.h>
#include <ntosp.h>
#include <ntstrsafe.h>
#include <WppRecorder.h>
#include <wdf.h>
#include <netioapi.h>

#include "quic_platform.h"
#include "quic_trace.h"

Expand Down
2 changes: 1 addition & 1 deletion src/core/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,8 @@ QuicCryptoProcessData(
&BufferCount,
&Buffer);

QUIC_TEL_ASSERT(DataAvailable);
UNREFERENCED_PARAMETER(DataAvailable);
QUIC_TEL_ASSERT(DataAvailable);
QUIC_DBG_ASSERT(BufferCount == 1);

QUIC_CONNECTION* Connection = QuicCryptoGetConnection(Crypto);
Expand Down
9 changes: 0 additions & 9 deletions src/inc/msquic_winkernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,11 @@ typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;

typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;

#define UINT8_MAX 0xffui8
#define UINT16_MAX 0xffffui16
#define UINT32_MAX 0xffffffffui32
#define UINT64_MAX 0xffffffffffffffffui64

#define UINTPTR_MAX MAXUINT_PTR
#define INTPTR_MAX MAXINT_PTR

#undef SIZE_MAX
#define SIZE_MAX UINTPTR_MAX

#ifndef STATUS_QUIC_HANDSHAKE_FAILURE
#define STATUS_QUIC_HANDSHAKE_FAILURE ((NTSTATUS)0xC0240000L)
#endif
Expand Down
28 changes: 28 additions & 0 deletions src/platform/platform_winkernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
textual reference to the "WPP_INIT_TRACING();" macro.
*/

typedef enum _SYSTEM_INFORMATION_CLASS {
SystemBasicInformation = 0
} SYSTEM_INFORMATION_CLASS;

NTSYSAPI // Copied from zwapi.h.
NTSTATUS
NTAPI
Expand All @@ -39,6 +43,30 @@ ZwQuerySystemInformation (
__out_opt PULONG ReturnLength
);

typedef struct _SYSTEM_BASIC_INFORMATION {
ULONG Reserved;
ULONG TimerResolution;
ULONG PageSize;

//
// WARNING: The following fields are 32-bit and may get
// capped to MAXULONG on systems with a lot of RAM!
//
// Use SYSTEM_PHYSICAL_MEMORY_INFORMATION instead.
//

ULONG NumberOfPhysicalPages; // Deprecated, do not use.
ULONG LowestPhysicalPageNumber; // Deprecated, do not use.
ULONG HighestPhysicalPageNumber; // Deprecated, do not use.

ULONG AllocationGranularity;
ULONG_PTR MinimumUserModeAddress;
ULONG_PTR MaximumUserModeAddress;
ULONG_PTR ActiveProcessorsAffinityMask;
CCHAR NumberOfProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;


uint64_t QuicPlatformPerfFreq;
uint64_t QuicTotalMemory;
QUIC_PLATFORM QuicPlatform = { NULL, NULL };
Expand Down
18 changes: 18 additions & 0 deletions src/platform/tls_schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@
#include <wbasek.h>
#include <secint.h>
#include <winerror.h>

typedef enum _SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS
{
SecApplicationProtocolNegotiationStatus_None,
SecApplicationProtocolNegotiationStatus_Success,
SecApplicationProtocolNegotiationStatus_SelectedClientOnly
} SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS, *PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS;

#define MAX_PROTOCOL_ID_SIZE 0xff

typedef struct _SecPkgContext_ApplicationProtocol
{
SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS ProtoNegoStatus; // Application protocol negotiation status
SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT ProtoNegoExt; // Protocol negotiation extension type corresponding to this protocol ID
unsigned char ProtocolIdSize; // Size in bytes of the application protocol ID
unsigned char ProtocolId[MAX_PROTOCOL_ID_SIZE]; // Byte string representing the negotiated application protocol ID
} SecPkgContext_ApplicationProtocol, *PSecPkgContext_ApplicationProtocol;

#endif

#define SCHANNEL_USE_BLACKLISTS
Expand Down
7 changes: 0 additions & 7 deletions src/test/bin/winkernel/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
--*/

#include <ntverp.h>
#include <ntosp.h>
#include <ntstrsafe.h>
#include <WppRecorder.h>
#include <wdf.h>
#include <netioapi.h>
#include <msquic.h>
#include <quic_platform.h>
#include <MsQuicTests.h>

Expand Down
6 changes: 0 additions & 6 deletions src/test/bin/winkernel/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
--*/

#include <ntverp.h>
#include <ntosp.h>
#include <ntstrsafe.h>
#include <WppRecorder.h>
#include <wdf.h>
#include <netioapi.h>
#include <quic_platform.h>

#include "quic_trace.h"
Expand Down

0 comments on commit 8160a29

Please sign in to comment.