blob: 21257ed6b22e5aa40632317f6e50c5b5f1b1e290 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "pch.h"
static HMODULE NciModule;
DWORD(WINAPI *NciSetConnectionName)(_In_ const GUID *Guid, _In_z_ const WCHAR *NewName);
DWORD(WINAPI *NciGetConnectionName)
(_In_ const GUID *Guid,
_Out_z_bytecap_(InDestNameBytes) WCHAR *Name,
_In_ DWORD InDestNameBytes,
_Out_opt_ DWORD *OutDestNameBytes);
void
NciInit(void)
{
NciModule = LoadLibraryExW(L"nci.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (!NciModule)
abort();
NciSetConnectionName =
(DWORD(WINAPI *)(const GUID *, const WCHAR *))GetProcAddress(NciModule, "NciSetConnectionName");
NciGetConnectionName =
(DWORD(WINAPI *)(const GUID *, WCHAR *, DWORD, DWORD *))GetProcAddress(NciModule, "NciGetConnectionName");
}
void
NciCleanup(void)
{
if (NciModule)
FreeLibrary(NciModule);
}
|