aboutsummaryrefslogtreecommitdiffstats
path: root/api/nci.c
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-07-21 11:11:14 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-30 16:50:58 +0100
commitc8bf62ac19ca81c9a488c71af0453da474a46b3b (patch)
tree202a2147e1167e8d785ba030ae2049bb5d748901 /api/nci.c
parentapi: port GetInterface member from wireguard-go (diff)
downloadwintun-c8bf62ac19ca81c9a488c71af0453da474a46b3b.tar.xz
wintun-c8bf62ac19ca81c9a488c71af0453da474a46b3b.zip
api: unify Win32 error type
This makes the code more readable and works around the clang-format.exe issues with _Return_type_success_ source annotation. Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/nci.c')
-rw-r--r--api/nci.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/api/nci.c b/api/nci.c
index c479f50..b2eca5c 100644
--- a/api/nci.c
+++ b/api/nci.c
@@ -7,13 +7,13 @@
static HMODULE NciModule;
-_Return_type_success_(return == 0) DWORD (WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
+WINSTATUS(WINAPI *NciSetConnectionName)(_In_ LPCGUID Guid, _In_z_ LPCWSTR NewName);
-_Return_type_success_(return == 0) DWORD (WINAPI *NciGetConnectionName)(
- _In_ LPCGUID Guid,
- _Out_z_bytecap_(InDestNameBytes) LPWSTR Name,
- _In_ DWORD InDestNameBytes,
- _Out_opt_ DWORD *OutDestNameBytes);
+WINSTATUS(WINAPI *NciGetConnectionName)
+(_In_ LPCGUID Guid,
+ _Out_z_bytecap_(InDestNameBytes) LPWSTR Name,
+ _In_ DWORD InDestNameBytes,
+ _Out_opt_ DWORD *OutDestNameBytes);
void
NciInit()
@@ -21,8 +21,9 @@ NciInit()
NciModule = LoadLibraryW(L"nci.dll");
if (!NciModule)
return;
- NciSetConnectionName = (DWORD (WINAPI *)(LPCGUID, LPCWSTR))GetProcAddress(NciModule, "NciSetConnectionName");
- NciGetConnectionName = (DWORD (WINAPI *)(LPCGUID, LPWSTR, DWORD, DWORD *))GetProcAddress(NciModule, "NciGetConnectionName");
+ NciSetConnectionName = (DWORD(WINAPI *)(LPCGUID, LPCWSTR))GetProcAddress(NciModule, "NciSetConnectionName");
+ NciGetConnectionName =
+ (DWORD(WINAPI *)(LPCGUID, LPWSTR, DWORD, DWORD *))GetProcAddress(NciModule, "NciGetConnectionName");
}
void