summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang You (UU) <[email protected]>2025-11-18 18:21:05 -0800
committerYang You (UU) <[email protected]>2025-11-18 18:21:05 -0800
commit25de639a793266bde0116816b86f8ada28808186 (patch)
tree2f12a6fc948b85f636f7871da8be3f020bc7f8e8
parent90a7fc175216f84a11cda994958cd1634341783f (diff)
add the INF file for UM and KM, make the static analysis issue free
-rw-r--r--network/wlan/WIFICX/drivercode/device.cpp16
-rw-r--r--network/wlan/WIFICX/drivercode/driver.cpp2
-rw-r--r--network/wlan/WIFICX/drivercode/driver.h5
-rw-r--r--network/wlan/WIFICX/drivercode/wifihal.cpp7
-rw-r--r--network/wlan/WIFICX/drivercode/wifirequest.cpp11
-rw-r--r--network/wlan/WIFICX/km/wificxsampleclientkm.inf46
-rw-r--r--network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj24
-rw-r--r--network/wlan/WIFICX/um/wificxsampleclientum.infbin3340 -> 6802 bytes
8 files changed, 81 insertions, 30 deletions
diff --git a/network/wlan/WIFICX/drivercode/device.cpp b/network/wlan/WIFICX/drivercode/device.cpp
index 9ea10fd1..0fc17ea4 100644
--- a/network/wlan/WIFICX/drivercode/device.cpp
+++ b/network/wlan/WIFICX/drivercode/device.cpp
@@ -31,13 +31,6 @@ NTSTATUS EvtDeviceReleaseHardware(WDFDEVICE device, WDFCMRESLIST resourcesTransl
}
_Use_decl_annotations_
-void EvtDeviceSurpriseRemoval(WDFDEVICE device)
-{
- WFCInfo("Device=0x%p is surprise removed", device);
-}
-
-
-_Use_decl_annotations_
NTSTATUS EvtWifiDeviceCreateAdapter(WDFDEVICE Device, NETADAPTER_INIT* AdapterInit)
{
@@ -68,6 +61,15 @@ NTSTATUS EvtWifiDeviceCreateAdapter(WDFDEVICE Device, NETADAPTER_INIT* AdapterIn
}
_Use_decl_annotations_
+NTSTATUS EvtWifiDeviceCreateWifiDirectDevice(WDFDEVICE, WIFIDIRECT_DEVICE_INIT*)
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ TraceEntry();
+ TraceExit(status);
+ return status;
+}
+
+_Use_decl_annotations_
void EvtAdapterCleanup(_In_ WDFOBJECT NetAdapter)
{
UNREFERENCED_PARAMETER(NetAdapter);
diff --git a/network/wlan/WIFICX/drivercode/driver.cpp b/network/wlan/WIFICX/drivercode/driver.cpp
index f25cc7b5..974d87fb 100644
--- a/network/wlan/WIFICX/drivercode/driver.cpp
+++ b/network/wlan/WIFICX/drivercode/driver.cpp
@@ -156,7 +156,7 @@ Return Value:
WDI_VERSION_LATEST, // The "WDI" version supported by this Ihv driver
EvtWifiDeviceSendCommand, // The Wdi command and task, now called "wifirequest".
EvtWifiDeviceCreateAdapter, // The Wdi "ports", now support by the netadapter instances.
- nullptr); // [Scope: No WiFi Direct support in this sample]
+ EvtWifiDeviceCreateWifiDirectDevice); // [Scope: No WiFi Direct support in this sample]
// Initialize the WifiCx device with the configuration above to let OS side ready.
status = WifiDeviceInitialize(wdfIhvDevice, &wifiDeviceConfig);
diff --git a/network/wlan/WIFICX/drivercode/driver.h b/network/wlan/WIFICX/drivercode/driver.h
index 12820f1c..8d4f12b7 100644
--- a/network/wlan/WIFICX/drivercode/driver.h
+++ b/network/wlan/WIFICX/drivercode/driver.h
@@ -2,5 +2,10 @@
#pragma once
#include "precomp.h"
+extern "C"
+{
+ DRIVER_INITIALIZE DriverEntry;
+}
+
EVT_WDF_DRIVER_DEVICE_ADD EvtWifiDriverDeviceAdd;
EVT_WDF_OBJECT_CONTEXT_CLEANUP EvtWifiDriverContextCleanup; \ No newline at end of file
diff --git a/network/wlan/WIFICX/drivercode/wifihal.cpp b/network/wlan/WIFICX/drivercode/wifihal.cpp
index 4619e87c..4a73d386 100644
--- a/network/wlan/WIFICX/drivercode/wifihal.cpp
+++ b/network/wlan/WIFICX/drivercode/wifihal.cpp
@@ -15,7 +15,6 @@ NTSTATUS WifiHAL::_Create(WDFDEVICE Device)
WDF_OBJECT_ATTRIBUTES attributes;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, WifiHAL);
attributes.EvtCleanupCallback = WifiHAL::_OnCleanup;
- attributes.ParentObject = Device;
void* memory = nullptr;
WX_RETURN_NTSTATUS_IF_NOT_NT_SUCCESS_MSG(
@@ -32,6 +31,7 @@ NTSTATUS WifiHAL::_Create(WDFDEVICE Device)
return STATUS_SUCCESS;
}
+_Use_decl_annotations_
void WifiHAL::_OnCleanup(WDFOBJECT Object)
{
UNREFERENCED_PARAMETER(Object);
@@ -56,7 +56,7 @@ NTSTATUS WifiHAL::WifiIhvSetDeviceCapabilities()
deviceCaps.HardwareRadioState = TRUE;
deviceCaps.SoftwareRadioState = TRUE;
- deviceCaps.FirmwareVersion[MAX_FIRMWARE_VERSION_LENGTH];
+ RtlCopyMemory(deviceCaps.FirmwareVersion, "1.0.0", sizeof("1.0.0"));
deviceCaps.ActionFramesSupported = TRUE;
deviceCaps.NumRxStreams = 1;
deviceCaps.NumTxStreams = 1;
@@ -475,6 +475,7 @@ NTSTATUS WifiHAL::WifiIhvSetDeviceCapabilities()
return STATUS_SUCCESS;
}
+_Use_decl_annotations_
NTSTATUS WifiHAL::WifiIhvReset(const WDI_TASK_DOT11_RESET_PARAMETERS& ResetParameters, const PWDI_MESSAGE_HEADER, UINT)
{
if (0 == ResetParameters.Optional.ResetMACAddress_IsPresent)
@@ -573,6 +574,7 @@ NTSTATUS WifiHAL::WifiIhvScan(const WDI_SCAN_PARAMETERS& ScanParameters, const P
return STATUS_SUCCESS;
}
+_Use_decl_annotations_
NTSTATUS WifiHAL::WifiIhvConnect(const WDI_TASK_CONNECT_PARAMETERS& ConnectParameters, const PWDI_MESSAGE_HEADER pWdiHeader, UINT)
{
NT_ASSERT(m_LastConnectEntryId == 0);
@@ -787,6 +789,7 @@ NTSTATUS WifiHAL::WifiIhvPerformAssociation(
return ntStatus;
}
+_Use_decl_annotations_
NTSTATUS WifiHAL::WifiIhvSetSaeAuthParams(const WDI_SET_SAE_AUTH_PARAMS_COMMAND& setSAEAuthParams, const PWDI_MESSAGE_HEADER pWdiHeader, UINT)
{
//Since this is DIRECT OID, need to check the m_LastConnectTransactionId match
diff --git a/network/wlan/WIFICX/drivercode/wifirequest.cpp b/network/wlan/WIFICX/drivercode/wifirequest.cpp
index 525fa14c..fd02bd91 100644
--- a/network/wlan/WIFICX/drivercode/wifirequest.cpp
+++ b/network/wlan/WIFICX/drivercode/wifirequest.cpp
@@ -36,7 +36,7 @@ void WifiIhvSendIndicationToOs(
_In_ UINT16 WifiRequestMessageId,
_In_ UINT32 WifiRequestTransactionId,
_In_ NTSTATUS WifiRquestM4Status,
- _In_ PUCHAR pTlvData,
+ _In_opt_bytecount_(TlvDataSize) PUCHAR pTlvData,
_In_ UINT32 TlvDataSize)
{
WDFMEMORY data = WDF_NO_HANDLE;
@@ -56,12 +56,13 @@ void WifiIhvSendIndicationToOs(
RtlZeroMemory(pIndicationBuffer, indicationSize);
pIndicationHeader = reinterpret_cast<PWDI_MESSAGE_HEADER>(pIndicationBuffer);
-
- RtlCopyMemory(pIndicationHeader, pOriginalWdiHeader, sizeof(WDI_MESSAGE_HEADER));
- pIndicationHeader->TransactionId = WifiRequestTransactionId;
+ pIndicationHeader->PortId = pOriginalWdiHeader->PortId;
+ pIndicationHeader->Reserved = pOriginalWdiHeader->Reserved;
pIndicationHeader->Status = Wifi::ConvertNDISSTATUSToNTSTATUS(WifiRquestM4Status);
+ pIndicationHeader->TransactionId = WifiRequestTransactionId;
+ pIndicationHeader->IhvSpecificId = pOriginalWdiHeader->IhvSpecificId;
- if (TlvDataSize > 0)
+ if (TlvDataSize > 0 && pTlvData != nullptr)
{
RtlCopyMemory(pIndicationBuffer + sizeof(WDI_MESSAGE_HEADER), pTlvData, TlvDataSize);
}
diff --git a/network/wlan/WIFICX/km/wificxsampleclientkm.inf b/network/wlan/WIFICX/km/wificxsampleclientkm.inf
index 432e31ac..d068b5ff 100644
--- a/network/wlan/WIFICX/km/wificxsampleclientkm.inf
+++ b/network/wlan/WIFICX/km/wificxsampleclientkm.inf
@@ -1,11 +1,11 @@
-;
+;Copyright (c) Microsoft Corporation. All rights reserved.
; wificxsampleclientkm.inf
;
[Version]
Signature = "$WINDOWS NT$"
-Class = System ; TODO: specify appropriate Class
-ClassGuid = {4d36e97d-e325-11ce-bfc1-08002be10318} ; TODO: specify appropriate ClassGuid
+Class = NET
+ClassGuid = {4d36e972-e325-11ce-bfc1-08002be10318}
Provider = %ManufacturerName%
CatalogFile = wificxsampleclientkm.cat
DriverVer = ; TODO: set DriverVer in stampinf property pages
@@ -28,16 +28,25 @@ wificxsampleclientkm.sys = 1,,
%ManufacturerName% = Standard,NT$ARCH$.10.0...16299 ; %13% support introduced in build 16299
[Standard.NT$ARCH$.10.0...16299]
-%wificxsampleclientkm.DeviceDesc% = wificxsampleclientkm_Device, Root\wificxsampleclientkm ; TODO: edit hw-id
+%wificxsampleclientkm.DeviceDesc% = wificxsampleclientkm_Device.ndi, Root\wificxsampleclientkm
-[wificxsampleclientkm_Device.NT]
+;
+; Normal device - Networking Section
+;
+[wificxsampleclientkm_Device.ndi.NT]
CopyFiles = File_Copy
+Characteristics = 0x84 ; NCF_HAS_UI, NCF_PHYSICAL
+BusType = 0 ; Internal
+AddReg = wificxsampleclientkm.reg
+*IfType = 71 ; IF_TYPE_IEEE80211
+*MediaType = 16 ; NdisMediumNative802_11
+*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11
[File_Copy]
wificxsampleclientkm.sys
;-------------- Service installation
-[wificxsampleclientkm_Device.NT.Services]
+[wificxsampleclientkm_Device.ndi.NT.Services]
AddService = wificxsampleclientkm,%SPSVCINST_ASSOCSERVICE%, wificxsampleclientkm_Service_Inst
; -------------- wificxsampleclientkm driver install sections
@@ -48,15 +57,30 @@ StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %13%\wificxsampleclientkm.sys
-[wificxsampleclientkm_Device.NT.Wdf]
+[wificxsampleclientkm_Device.ndi.NT.Wdf]
KmdfService = wificxsampleclientkm, wificxsampleclientkm_wdfsect
[wificxsampleclientkm_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$
+
+[wificxsampleclientkm.reg]
+HKR, Ndi, Service, 0, "wificxsampleclientkm"
+HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
+HKR, Ndi\Interfaces, LowerRange, 0, "wlan,ethernet"
+; standard INF keywords for NetAdapter drivers
+; using AddReg directive so they will work when this INF being Includes/Needs
+
+HKR, NetworkInterface, *IfConnectorPresent, 0x00010001, 1
+HKR, NetworkInterface, *ConnectionType, 0x00010001, 1
+HKR, NetworkInterface, *DirectionType, 0x00010001, 0
+HKR, NetworkInterface, *AccessType, 0x00010001, 2
+HKR, NetworkInterface, *HardwareLoopback, 0x00010001, 0
+HKR, , NumberOfNetworkInterfaces, 0x00010001, 11
+
[Strings]
SPSVCINST_ASSOCSERVICE = 0x00000002
-ManufacturerName = "<Your manufacturer name>" ;TODO: Replace with your manufacturer name
-DiskName = "wificxsampleclientkm Installation Disk"
-wificxsampleclientkm.DeviceDesc = "wificxsampleclientkm Device"
-wificxsampleclientkm.SVCDESC = "wificxsampleclientkm Service"
+ManufacturerName = "WDK Sample"
+DiskName = "Wificxsampleclientkm Installation Disk"
+wificxsampleclientkm.DeviceDesc = "Wificxsampleclientkm Device"
+wificxsampleclientkm.SVCDESC = "Wificxsampleclientkm Service"
diff --git a/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj b/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj
index 49510981..d2748de9 100644
--- a/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj
+++ b/network/wlan/WIFICX/km/wificxsampleclientkm.vcxproj
@@ -34,7 +34,7 @@
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <DriverTargetPlatform>Windows Driver</DriverTargetPlatform>
<KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
<KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR>
<KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED>
@@ -52,7 +52,7 @@
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <DriverTargetPlatform>Windows Driver</DriverTargetPlatform>
<KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
<KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR>
<KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED>
@@ -70,7 +70,7 @@
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <DriverTargetPlatform>Windows Driver</DriverTargetPlatform>
<KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
<KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR>
<KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED>
@@ -88,7 +88,7 @@
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <DriverTargetPlatform>Windows Driver</DriverTargetPlatform>
<KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
<KMDF_VERSION_MINOR>33</KMDF_VERSION_MINOR>
<KMDF_MINIMUM_VERSION_REQUIRED>33</KMDF_MINIMUM_VERSION_REQUIRED>
@@ -110,15 +110,19 @@
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DriverSign>
@@ -134,6 +138,9 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <Inf>
+ <TimeStamp>1.0</TimeStamp>
+ </Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DriverSign>
@@ -149,6 +156,9 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <Inf>
+ <TimeStamp>1.0</TimeStamp>
+ </Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<DriverSign>
@@ -164,6 +174,9 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <Inf>
+ <TimeStamp>1.0</TimeStamp>
+ </Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<DriverSign>
@@ -179,6 +192,9 @@
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wlan\2.0\WificxTLVGenParse.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <Inf>
+ <TimeStamp>1.0</TimeStamp>
+ </Inf>
</ItemDefinitionGroup>
<ItemGroup>
<Inf Include="wificxsampleclientkm.inf" />
diff --git a/network/wlan/WIFICX/um/wificxsampleclientum.inf b/network/wlan/WIFICX/um/wificxsampleclientum.inf
index 6ed871d4..41828dea 100644
--- a/network/wlan/WIFICX/um/wificxsampleclientum.inf
+++ b/network/wlan/WIFICX/um/wificxsampleclientum.inf
Binary files differ