aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/api.h38
-rw-r--r--api/devmgmt.c40
-rw-r--r--api/namespace.c2
-rw-r--r--api/nci.c4
-rw-r--r--api/registry.c20
5 files changed, 52 insertions, 52 deletions
diff --git a/api/api.h b/api/api.h
index ef3f669..4013a9a 100644
--- a/api/api.h
+++ b/api/api.h
@@ -8,7 +8,7 @@
#include <Windows.h>
#include <IPExport.h>
-typedef _Return_type_success_(return == ERROR_SUCCESS) DWORD WINSTATUS;
+typedef _Return_type_success_(return == ERROR_SUCCESS) DWORD WINTUN_STATUS;
extern HINSTANCE ResourceModule;
_Check_return_
@@ -24,9 +24,9 @@ NamespaceInit();
void
NamespaceCleanup();
-extern WINSTATUS(WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
+extern DWORD(WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
-extern WINSTATUS(WINAPI *NciGetConnectionName)(
+extern DWORD(WINAPI *NciGetConnectionName)(
_In_ LPCGUID Guid,
_Out_z_bytecap_(InDestNameBytes) LPWSTR Name,
_In_ DWORD InDestNameBytes,
@@ -38,7 +38,7 @@ NciInit();
void
NciCleanup();
-WINSTATUS
+WINTUN_STATUS
RegistryOpenKeyWait(
_In_ HKEY Key,
_In_z_count_c_(MAX_PATH) LPCWSTR Path,
@@ -46,28 +46,28 @@ RegistryOpenKeyWait(
_In_ DWORD Timeout,
_Out_ HKEY *KeyOut);
-WINSTATUS
+WINTUN_STATUS
RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_PATH) LPCWSTR Path, _In_ DWORD Timeout);
-WINSTATUS
+WINTUN_STATUS
RegistryGetString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType);
-WINSTATUS
+WINTUN_STATUS
RegistryGetMultiString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType);
-WINSTATUS
+WINTUN_STATUS
RegistryQueryString(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ LPWSTR *Value);
-WINSTATUS
+WINTUN_STATUS
RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _In_ DWORD Timeout, _Out_ LPWSTR *Value);
-WINSTATUS
+WINTUN_STATUS
RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ DWORD *Value);
-WINSTATUS
+WINTUN_STATUS
RegistryQueryDWORDWait(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _In_ DWORD Timeout, _Out_ DWORD *Value);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetVersion(
_Out_ DWORD *DriverVersionMaj,
_Out_ DWORD *DriverVersionMin,
@@ -89,13 +89,13 @@ typedef struct _WINTUN_ADAPTER
VOID WINAPI
WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapter(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_z_ LPCWSTR Name, _Out_ WINTUN_ADAPTER **Adapter);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapterName(_In_ const WINTUN_ADAPTER *Adapter, _Out_cap_c_(MAX_ADAPTER_NAME) LPWSTR Name);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunSetAdapterName(_In_ const WINTUN_ADAPTER *Adapter, _In_z_count_c_(MAX_ADAPTER_NAME) LPCWSTR Name);
void WINAPI
@@ -104,10 +104,10 @@ WintunGetAdapterGUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ GUID *Guid);
void WINAPI
WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ LUID *Luid);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunCreateAdapter(
_In_z_count_c_(MAX_POOL) LPCWSTR Pool,
_In_z_ LPCWSTR Name,
@@ -115,10 +115,10 @@ WintunCreateAdapter(
_Out_ WINTUN_ADAPTER **Adapter,
_Inout_ BOOL *RebootRequired);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _Inout_ BOOL *RebootRequired);
typedef BOOL(CALLBACK *WINTUN_ENUMPROC)(_In_ const WINTUN_ADAPTER *Adapter, _In_ LPARAM Param);
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunEnumAdapters(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_ WINTUN_ENUMPROC Func, _In_ LPARAM Param);
diff --git a/api/devmgmt.c b/api/devmgmt.c
index 4325c2a..b8b594d 100644
--- a/api/devmgmt.c
+++ b/api/devmgmt.c
@@ -23,7 +23,7 @@ const static GUID ADAPTER_NET_GUID = { 0xcac88484L,
/**
* Returns the version of the Wintun driver and NDIS system currently loaded.
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetVersion(
_Out_ DWORD *DriverVersionMaj,
_Out_ DWORD *DriverVersionMin,
@@ -72,7 +72,7 @@ cleanupKey:
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
GetDeviceRegistryProperty(
_In_ HDEVINFO DevInfo,
_In_ SP_DEVINFO_DATA *DevInfoData,
@@ -122,7 +122,7 @@ GetDeviceRegistryProperty(
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
GetDeviceRegistryString(
_In_ HDEVINFO DevInfo,
_In_ SP_DEVINFO_DATA *DevInfoData,
@@ -164,7 +164,7 @@ GetDeviceRegistryString(
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
GetDeviceRegistryMultiString(
_In_ HDEVINFO DevInfo,
_In_ SP_DEVINFO_DATA *DevInfoData,
@@ -246,7 +246,7 @@ GetPoolDeviceTypeName(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _Out_cap_c_(MAX_POO
/**
* Checks if SPDRP_DEVICEDESC or SPDRP_FRIENDLYNAME match device type name.
*/
-static WINSTATUS
+static WINTUN_STATUS
IsPoolMember(
_In_z_count_c_(MAX_POOL) LPCWSTR Pool,
_In_ HDEVINFO DevInfo,
@@ -300,7 +300,7 @@ cleanupDeviceDesc:
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
GetDriverInfoDetail(
_In_ HDEVINFO DevInfo,
_In_ SP_DEVINFO_DATA *DevInfoData,
@@ -330,7 +330,7 @@ GetDriverInfoDetail(
/**
* Check if the device is using Wintun driver.
*/
-static WINSTATUS
+static WINTUN_STATUS
IsUsingOurDriver(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData, _Out_ BOOL *IsOurDriver)
{
if (!SetupDiBuildDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER))
@@ -378,7 +378,7 @@ IsUsingOurDriver(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData, _Out_
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
GetNetCfgInstanceId(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData, _Out_ GUID *CfgInstanceID)
{
HKEY Key = SetupDiOpenDevRegKey(DevInfo, DevInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_QUERY_VALUE);
@@ -410,7 +410,7 @@ cleanupKey:
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
CreateAdapterData(
_In_ HDEVINFO DevInfo,
_In_ SP_DEVINFO_DATA *DevInfoData,
@@ -508,7 +508,7 @@ GetTcpipAdapterRegPath(_In_ const WINTUN_ADAPTER *Adapter, _Out_cap_c_(MAX_PATH)
/**
* Returns the interface-specific TCP/IP network registry key path.
*/
-static WINSTATUS
+static WINTUN_STATUS
GetTcpipInterfaceRegPath(_In_ const WINTUN_ADAPTER *Adapter, _Out_cap_c_(MAX_PATH) LPWSTR Path)
{
DWORD Result;
@@ -560,7 +560,7 @@ WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter)
* ERROR_FILE_NOT_FOUND if adapter with given name is not found;
* ERROR_ALREADY_EXISTS if adapter is found but not a Wintun-class or not a member of the pool
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapter(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_z_ LPCWSTR Name, _Out_ WINTUN_ADAPTER **Adapter)
{
DWORD Result;
@@ -648,13 +648,13 @@ cleanupMutex:
/**
* Returns the name of the Wintun interface.
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapterName(_In_ const WINTUN_ADAPTER *Adapter, _Out_cap_c_(MAX_ADAPTER_NAME) LPWSTR Name)
{
return NciGetConnectionName(&Adapter->CfgInstanceID, Name, MAX_ADAPTER_NAME * sizeof(WCHAR), NULL);
}
-static WINSTATUS
+static WINTUN_STATUS
InterfaceGuidFromAlias(_In_z_ LPCWSTR Alias, _Out_ GUID *Guid)
{
NET_LUID Luid;
@@ -667,7 +667,7 @@ InterfaceGuidFromAlias(_In_z_ LPCWSTR Alias, _Out_ GUID *Guid)
/**
* Sets name of the Wintun interface.
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunSetAdapterName(_In_ const WINTUN_ADAPTER *Adapter, _In_z_count_c_(MAX_ADAPTER_NAME) LPCWSTR Name)
{
DWORD Result;
@@ -759,7 +759,7 @@ WintunGetAdapterLUID(_In_ const WINTUN_ADAPTER *Adapter, _Out_ LUID *Luid)
/**
* Returns a handle to the adapter device object.
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunGetAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *Handle)
{
HANDLE Heap = GetProcessHeap();
@@ -800,7 +800,7 @@ cleanupBuf:
/**
* Sets device install parameters for a quiet installation.
*/
-static WINSTATUS
+static WINTUN_STATUS
SetQuietInstall(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData)
{
SP_DEVINSTALL_PARAMS_W DevInstallParams = { .cbSize = sizeof(SP_DEVINSTALL_PARAMS_W) };
@@ -870,7 +870,7 @@ CheckReboot(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData)
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunCreateAdapter(
_In_z_count_c_(MAX_POOL) LPCWSTR Pool,
_In_z_ LPCWSTR Name,
@@ -1118,7 +1118,7 @@ cleanupMutex:
* Returns TUN device info list handle and interface device info data. The device info list handle must be closed after
* use. In case the device is not found, ERROR_OBJECT_NOT_FOUND is returned.
*/
-static WINSTATUS
+static WINTUN_STATUS
GetDevInfoData(_In_ const GUID *CfgInstanceID, _Out_ HDEVINFO *DevInfo, _Out_ SP_DEVINFO_DATA *DevInfoData)
{
DWORD Result;
@@ -1163,7 +1163,7 @@ GetDevInfoData(_In_ const GUID *CfgInstanceID, _Out_ HDEVINFO *DevInfo, _Out_ SP
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise. This function succeeds if the interface was not found.
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _Inout_ BOOL *RebootRequired)
{
HDEVINFO DevInfo;
@@ -1198,7 +1198,7 @@ WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _Inout_ BOOL *RebootRequ
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS WINAPI
+WINTUN_STATUS WINAPI
WintunEnumAdapters(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_ WINTUN_ENUMPROC Func, _In_ LPARAM Param)
{
DWORD Result;
diff --git a/api/namespace.c b/api/namespace.c
index 98abf12..6020469 100644
--- a/api/namespace.c
+++ b/api/namespace.c
@@ -46,7 +46,7 @@ Bin2Hex(_In_bytecount_(Size) const void *Source, size_t Size, _Out_capcount_(Siz
}
}
-static DWORD
+static WINTUN_STATUS
NamespaceRuntimeInit()
{
DWORD Result;
diff --git a/api/nci.c b/api/nci.c
index b2eca5c..52b8e54 100644
--- a/api/nci.c
+++ b/api/nci.c
@@ -7,9 +7,9 @@
static HMODULE NciModule;
-WINSTATUS(WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
+DWORD(WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
-WINSTATUS(WINAPI *NciGetConnectionName)
+DWORD(WINAPI *NciGetConnectionName)
(_In_ LPCGUID Guid,
_Out_z_bytecap_(InDestNameBytes) LPWSTR Name,
_In_ DWORD InDestNameBytes,
diff --git a/api/registry.c b/api/registry.c
index 52a3d66..53af8bb 100644
--- a/api/registry.c
+++ b/api/registry.c
@@ -7,7 +7,7 @@
#include <string.h>
#include <wchar.h>
-static WINSTATUS
+static WINTUN_STATUS
OpenKeyWait(_In_ HKEY Key, _Inout_z_ LPWSTR Path, _In_ DWORD Access, _In_ ULONGLONG Deadline, _Out_ HKEY *KeyOut)
{
DWORD Result;
@@ -65,7 +65,7 @@ OpenKeyWait(_In_ HKEY Key, _Inout_z_ LPWSTR Path, _In_ DWORD Access, _In_ ULONGL
*
* @return ERROR_SUCCESS on success; WAIT_TIMEOUT on timeout; error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryOpenKeyWait(
_In_ HKEY Key,
_In_z_count_c_(MAX_PATH) LPCWSTR Path,
@@ -78,7 +78,7 @@ RegistryOpenKeyWait(
return OpenKeyWait(Key, Buf, Access, GetTickCount64() + Timeout, KeyOut);
}
-WINSTATUS
+WINTUN_STATUS
RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_PATH) LPCWSTR Path, _In_ DWORD Timeout)
{
HKEY k;
@@ -104,7 +104,7 @@ RegistryWaitForKey(_In_ HKEY Key, _In_z_count_c_(MAX_PATH) LPCWSTR Path, _In_ DW
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryGetString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType)
{
HANDLE Heap = GetProcessHeap();
@@ -168,7 +168,7 @@ RegistryGetString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType)
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryGetMultiString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType)
{
HANDLE Heap = GetProcessHeap();
@@ -241,7 +241,7 @@ RegistryGetMultiString(_Inout_ LPWSTR *Buf, _In_ DWORD Len, _In_ DWORD ValueType
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-static WINSTATUS
+static WINTUN_STATUS
RegistryQuery(
_In_ HKEY Key,
_In_opt_z_ LPCWSTR Name,
@@ -279,7 +279,7 @@ RegistryQuery(
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryQueryString(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ LPWSTR *Value)
{
DWORD ValueType, Size = 256 * sizeof(WCHAR);
@@ -318,7 +318,7 @@ RegistryQueryString(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ LPWSTR *Value)
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _In_ DWORD Timeout, _Out_ LPWSTR *Value)
{
DWORD Result;
@@ -356,7 +356,7 @@ RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _In_ DWORD Timeo
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ DWORD *Value)
{
DWORD ValueType, Size = sizeof(DWORD);
@@ -384,7 +384,7 @@ RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _Out_ DWORD *Value)
*
* @return ERROR_SUCCESS on success; Win32 error code otherwise
*/
-WINSTATUS
+WINTUN_STATUS
RegistryQueryDWORDWait(_In_ HKEY Key, _In_opt_z_ LPCWSTR Name, _In_ DWORD Timeout, _Out_ DWORD *Value)
{
DWORD Result;