4b8f879fd6
Rather than every client reinvent the art of using the Wintun and its ring buffers, we offer helper structs and functions to unify and simplify Wintun usage. Signed-off-by: Simon Rozman <simon@rozman.si>
27 lines
513 B
C
27 lines
513 B
C
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Windows.h>
|
|
|
|
static __forceinline VOID
|
|
InterlockedSetU(_Inout_ _Interlocked_operand_ ULONG volatile *Target, _In_ ULONG Value)
|
|
{
|
|
*Target = Value;
|
|
}
|
|
|
|
static __forceinline LONG
|
|
InterlockedGet(_In_ _Interlocked_operand_ LONG volatile *Value)
|
|
{
|
|
return *Value;
|
|
}
|
|
|
|
static __forceinline ULONG
|
|
InterlockedGetU(_In_ _Interlocked_operand_ ULONG volatile *Value)
|
|
{
|
|
return *Value;
|
|
}
|