Improve designated initializers
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
5bbff1026f
commit
5ec565c7e8
@ -36,7 +36,7 @@ CommentPragmas: '^begin_wpp|^end_wpp|^FUNC |^USESUFFIX |^USESUFFIX '
|
|||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
ContinuationIndentWidth: 4
|
ContinuationIndentWidth: 4
|
||||||
Cpp11BracedListStyle: true
|
Cpp11BracedListStyle: false
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
ExperimentalAutoDetectBinPacking: false
|
ExperimentalAutoDetectBinPacking: false
|
||||||
IndentCaseLabels: false
|
IndentCaseLabels: false
|
||||||
|
21
wintun.c
21
wintun.c
@ -1263,7 +1263,8 @@ TunInitializeEx(
|
|||||||
.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1 },
|
.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1 },
|
||||||
.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT,
|
.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT,
|
||||||
.fAllocateNetBuffer = TRUE,
|
.fAllocateNetBuffer = TRUE,
|
||||||
.PoolTag = TUN_HTONL(TUN_MEMORY_TAG)};
|
.PoolTag = TUN_HTONL(TUN_MEMORY_TAG)
|
||||||
|
};
|
||||||
#pragma warning( \
|
#pragma warning( \
|
||||||
suppress : 6014) /* Leaking memory 'ctx->NBLPool'. Note: 'ctx->NBLPool' is freed in TunHaltEx; or on failure. */
|
suppress : 6014) /* Leaking memory 'ctx->NBLPool'. Note: 'ctx->NBLPool' is freed in TunHaltEx; or on failure. */
|
||||||
ctx->NBLPool = NdisAllocateNetBufferListPool(MiniportAdapterHandle, &nbl_pool_param);
|
ctx->NBLPool = NdisAllocateNetBufferListPool(MiniportAdapterHandle, &nbl_pool_param);
|
||||||
@ -1283,7 +1284,8 @@ TunInitializeEx(
|
|||||||
: NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2 },
|
: NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2 },
|
||||||
.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND | NDIS_MINIPORT_ATTRIBUTES_SURPRISE_REMOVE_OK,
|
.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND | NDIS_MINIPORT_ATTRIBUTES_SURPRISE_REMOVE_OK,
|
||||||
.InterfaceType = NdisInterfaceInternal,
|
.InterfaceType = NdisInterfaceInternal,
|
||||||
.MiniportAdapterContext = ctx};
|
.MiniportAdapterContext = ctx
|
||||||
|
};
|
||||||
if (!NT_SUCCESS(
|
if (!NT_SUCCESS(
|
||||||
status = NdisMSetMiniportAttributes(MiniportAdapterHandle, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&attr)))
|
status = NdisMSetMiniportAttributes(MiniportAdapterHandle, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&attr)))
|
||||||
{
|
{
|
||||||
@ -1299,7 +1301,8 @@ TunInitializeEx(
|
|||||||
: NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2 },
|
: NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2 },
|
||||||
.MinMagicPacketWakeUp = NdisDeviceStateUnspecified,
|
.MinMagicPacketWakeUp = NdisDeviceStateUnspecified,
|
||||||
.MinPatternWakeUp = NdisDeviceStateUnspecified,
|
.MinPatternWakeUp = NdisDeviceStateUnspecified,
|
||||||
.MinLinkChangeWakeUp = NdisDeviceStateUnspecified};
|
.MinLinkChangeWakeUp = NdisDeviceStateUnspecified
|
||||||
|
};
|
||||||
static NDIS_OID suported_oids[] = { OID_GEN_MAXIMUM_TOTAL_SIZE,
|
static NDIS_OID suported_oids[] = { OID_GEN_MAXIMUM_TOTAL_SIZE,
|
||||||
OID_GEN_CURRENT_LOOKAHEAD,
|
OID_GEN_CURRENT_LOOKAHEAD,
|
||||||
OID_GEN_TRANSMIT_BUFFER_SPACE,
|
OID_GEN_TRANSMIT_BUFFER_SPACE,
|
||||||
@ -1347,7 +1350,8 @@ TunInitializeEx(
|
|||||||
NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED | NDIS_LINK_STATE_PAUSE_FUNCTIONS_AUTO_NEGOTIATED,
|
NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED | NDIS_LINK_STATE_PAUSE_FUNCTIONS_AUTO_NEGOTIATED,
|
||||||
.SupportedOidList = suported_oids,
|
.SupportedOidList = suported_oids,
|
||||||
.SupportedOidListLength = sizeof(suported_oids),
|
.SupportedOidListLength = sizeof(suported_oids),
|
||||||
.PowerManagementCapabilitiesEx = &pmcap};
|
.PowerManagementCapabilitiesEx = &pmcap
|
||||||
|
};
|
||||||
if (!NT_SUCCESS(
|
if (!NT_SUCCESS(
|
||||||
status = NdisMSetMiniportAttributes(MiniportAdapterHandle, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&gen)))
|
status = NdisMSetMiniportAttributes(MiniportAdapterHandle, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&gen)))
|
||||||
{
|
{
|
||||||
@ -1626,7 +1630,8 @@ TunOidQuery(_Inout_ TUN_CTX *ctx, _Inout_ NDIS_OID_REQUEST *OidRequest)
|
|||||||
.Header = { .Type = NDIS_OBJECT_TYPE_DEFAULT,
|
.Header = { .Type = NDIS_OBJECT_TYPE_DEFAULT,
|
||||||
.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1,
|
.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1,
|
||||||
.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1 },
|
.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1 },
|
||||||
.InterruptModeration = NdisInterruptModerationNotSupported};
|
.InterruptModeration = NdisInterruptModerationNotSupported
|
||||||
|
};
|
||||||
return TunOidQueryWriteBuf(OidRequest, &intp, (UINT)sizeof(intp));
|
return TunOidQueryWriteBuf(OidRequest, &intp, (UINT)sizeof(intp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1769,7 +1774,8 @@ DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)
|
|||||||
|
|
||||||
NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport = {
|
NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport = {
|
||||||
.Header = { .Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS,
|
.Header = { .Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS,
|
||||||
.Revision = NdisVersion < NDIS_RUNTIME_VERSION_680 ? NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2
|
.Revision = NdisVersion < NDIS_RUNTIME_VERSION_680
|
||||||
|
? NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2
|
||||||
: NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3,
|
: NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3,
|
||||||
.Size = NdisVersion < NDIS_RUNTIME_VERSION_680
|
.Size = NdisVersion < NDIS_RUNTIME_VERSION_680
|
||||||
? NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2
|
? NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2
|
||||||
@ -1795,7 +1801,8 @@ DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)
|
|||||||
.CancelOidRequestHandler = TunCancelOidRequest,
|
.CancelOidRequestHandler = TunCancelOidRequest,
|
||||||
.DirectOidRequestHandler = TunDirectOidRequest,
|
.DirectOidRequestHandler = TunDirectOidRequest,
|
||||||
.CancelDirectOidRequestHandler = TunCancelDirectOidRequest,
|
.CancelDirectOidRequestHandler = TunCancelDirectOidRequest,
|
||||||
.SynchronousOidRequestHandler = TunSynchronousOidRequest};
|
.SynchronousOidRequestHandler = TunSynchronousOidRequest
|
||||||
|
};
|
||||||
if (!NT_SUCCESS(
|
if (!NT_SUCCESS(
|
||||||
status =
|
status =
|
||||||
NdisMRegisterMiniportDriver(DriverObject, RegistryPath, NULL, &miniport, &NdisMiniportDriverHandle)))
|
NdisMRegisterMiniportDriver(DriverObject, RegistryPath, NULL, &miniport, &NdisMiniportDriverHandle)))
|
||||||
|
Loading…
Reference in New Issue
Block a user