Skip to content

Commit

Permalink
Remove WdfObjectDelete call for adapter
Browse files Browse the repository at this point in the history
Doesn't seen to be needed - according to documentation:

> The NETADAPTER object is a standard WDF object. The framework manages its deletion, which occurs when the parent WDFDEVICE is deleted.

Bump version to 0.7.4

Signed-off-by: Lev Stipakov <[email protected]>
  • Loading branch information
lstipakov committed May 20, 2022
1 parent 8400e9e commit 00b479d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
4 changes: 3 additions & 1 deletion Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ VOID OvpnEvtDeviceCleanup(WDFOBJECT obj) {
OvpnBufferQueueDelete(device->ControlRxBufferQueue);
OvpnBufferQueueDelete(device->DataRxBufferQueue);

OvpnAdapterDestroy(device->Adapter);
KIRQL irql = ExAcquireSpinLockExclusive(&device->SpinLock);
device->Adapter = WDF_NO_HANDLE;
ExReleaseSpinLockExclusive(&device->SpinLock, irql);
}

EVT_WDF_DRIVER_DEVICE_ADD OvpnEvtDeviceAdd;
Expand Down
2 changes: 1 addition & 1 deletion PropertySheet.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup Label="UserMacros">
<OVPN_DCO_VERSION_MAJOR>0</OVPN_DCO_VERSION_MAJOR>
<OVPN_DCO_VERSION_MINOR>7</OVPN_DCO_VERSION_MINOR>
<OVPN_DCO_VERSION_PATCH>3</OVPN_DCO_VERSION_PATCH>
<OVPN_DCO_VERSION_PATCH>4</OVPN_DCO_VERSION_PATCH>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup>
Expand Down
21 changes: 0 additions & 21 deletions adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,6 @@ OvpnAdapterSetLinkState(POVPN_ADAPTER adapter, NET_IF_MEDIA_CONNECT_STATE state)
NetAdapterSetLinkState(adapter->NetAdapter, &linkState);
}


_Use_decl_annotations_
VOID
OvpnAdapterDestroy(NETADAPTER netAdapter)
{
if (netAdapter == WDF_NO_HANDLE)
return;

POVPN_ADAPTER adapter = OvpnGetAdapterContext(netAdapter);
POVPN_DEVICE device = OvpnGetDeviceContext(adapter->WdfDevice);

KIRQL irql = ExAcquireSpinLockExclusive(&device->SpinLock);
device->Adapter = WDF_NO_HANDLE;
ExReleaseSpinLockExclusive(&device->SpinLock, irql);

// TODO: this breaks on Windows 10 when called from EvtCleanupCallback, is this call even needed?
// NetAdapterStop(netAdapter);

WdfObjectDelete(netAdapter);
}

EVT_NET_ADAPTER_CREATE_TXQUEUE OvpnEvtAdapterCreateTxQueue;

_Use_decl_annotations_
Expand Down
4 changes: 0 additions & 4 deletions adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ _IRQL_requires_same_
NTSTATUS
OvpnAdapterCreate(OVPN_DEVICE* device);

_IRQL_requires_(PASSIVE_LEVEL)
VOID
OvpnAdapterDestroy(NETADAPTER netAdapter);

// notify NetAdapter (if it is ready) that more packets are available
NTSTATUS
OvpnAdapterNotifyRx(NETADAPTER netAdapter);
Expand Down

0 comments on commit 00b479d

Please sign in to comment.