summaryrefslogtreecommitdiff
path: root/network/wlan/WIFICX/drivercode
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 /network/wlan/WIFICX/drivercode
parent90a7fc175216f84a11cda994958cd1634341783f (diff)
add the INF file for UM and KM, make the static analysis issue free
Diffstat (limited to 'network/wlan/WIFICX/drivercode')
-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
5 files changed, 26 insertions, 15 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);
}