Skip to content

Commit 2f16b3d

Browse files
committed
fix(wdk tests) fix wdk tests to make them build with clang
1 parent 0ca151c commit 2f16b3d

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

tests/projects/windows/driver/kmdf/ioctl/exe/testapp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ GetCoinstallerVersion(
213213

214214
VOID __cdecl
215215
main(
216-
_In_ ULONG argc,
216+
_In_ INT argc,
217217
_In_reads_(argc) PCHAR argv[]
218218
)
219219
{

tests/projects/windows/driver/umdf/skeleton/xmake.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ target("UMDFSkeleton")
88
add_files("*.cpp", {rules = "wdk.tracewpp"})
99
add_files("*.rc", "*.inx")
1010
set_values("wdk.umdf.sdkver", "1.9")
11-
add_shflags("/DEF:exports.def", {force = true})
12-
add_shflags("/ENTRY:_DllMainCRTStartup" .. (is_arch("x86") and "@12" or ""), {force = true})
11+
add_files("exports.def")
12+
on_config(function(target)
13+
if target:has_tool("sh", "clang", "clangxx") then
14+
target:add("shflags", "-Wl,/ENTRY:_DllMainCRTStartup" .. (is_arch("x86") and "@12" or ""), {force = true})
15+
else
16+
target:add("shflags", "/ENTRY:_DllMainCRTStartup" .. (is_arch("x86") and "@12" or ""), {force = true})
17+
end
18+
end)
1319

tests/projects/windows/driver/wdm/msdsm/intrface.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Module Name:
3232

3333
#pragma warning (disable:4305)
3434

35+
DSM_INIT_DATA gDsmInitData;
3536

3637
//
3738
// Flag to indicate whether to NT_ASSERT or ignore a particular condition.
@@ -3430,7 +3431,7 @@ Return Value:
34303431

34313432
NTSTATUS
34323433
DsmRemovePath(
3433-
_In_ IN PDSM_CONTEXT DsmContext,
3434+
_In_ IN PVOID _DsmContext,
34343435
_In_ IN PVOID PathId
34353436
)
34363437
/*++
@@ -3456,6 +3457,8 @@ Return Value:
34563457
PDSM_FAILOVER_GROUP failGroup;
34573458
KIRQL irql;
34583459

3460+
PDSM_CONTEXT DsmContext = (PDSM_CONTEXT)_DsmContext;
3461+
34593462
TracePrint((TRACE_LEVEL_VERBOSE,
34603463
TRACE_FLAG_PNP,
34613464
"DsmRemovePath (PathId %p): Entering function.\n",

tests/projects/windows/driver/wdm/msdsm/msdsm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Module Name:
115115
//
116116
// Initialization data structure that needs to be filled in for MPIO
117117
//
118-
DSM_INIT_DATA gDsmInitData;
118+
extern DSM_INIT_DATA gDsmInitData;
119119

120120
//
121121
// Macro used to round of a number to the nearest 8 byte aligned one.

tests/projects/windows/driver/wdm/msdsm/prototypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ DsmRemoveDevice(
206206

207207
NTSTATUS
208208
DsmRemovePath(
209-
_In_ IN PDSM_CONTEXT DsmContext,
209+
_In_ IN PVOID DsmContext,
210210
_In_ IN PVOID PathId
211211
);
212212

tests/projects/windows/driver/wdm/perfcounters/kcs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Module Name:
2727
#include "kcs.h"
2828
#include "kcsCounters.h"
2929

30+
#include <stdlib.h>
31+
#include <math.h>
32+
3033
#pragma code_seg("PAGE")
3134

3235
DRIVER_INITIALIZE DriverEntry;

0 commit comments

Comments
 (0)