2020-07-07 15:32:06 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
2020-07-21 16:57:36 +02:00
|
|
|
#include "pch.h"
|
2020-07-07 15:32:06 +02:00
|
|
|
|
|
|
|
static HMODULE NciModule;
|
|
|
|
|
2020-07-21 18:19:15 +02:00
|
|
|
DWORD(WINAPI *NciSetConnectionName)(_In_ const GUID *Guid, _In_z_ const WCHAR *NewName);
|
2020-07-07 15:32:06 +02:00
|
|
|
|
2020-07-21 16:43:34 +02:00
|
|
|
DWORD(WINAPI *NciGetConnectionName)
|
2020-07-21 18:19:15 +02:00
|
|
|
(_In_ const GUID *Guid,
|
|
|
|
_Out_z_bytecap_(InDestNameBytes) WCHAR *Name,
|
2020-07-21 11:11:14 +02:00
|
|
|
_In_ DWORD InDestNameBytes,
|
|
|
|
_Out_opt_ DWORD *OutDestNameBytes);
|
2020-07-07 15:32:06 +02:00
|
|
|
|
|
|
|
void
|
2020-10-30 06:03:21 +01:00
|
|
|
NciInit(void)
|
2020-07-07 15:32:06 +02:00
|
|
|
{
|
2020-10-30 11:43:47 +01:00
|
|
|
NciModule = LoadLibraryExW(L"nci.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
2020-07-07 15:32:06 +02:00
|
|
|
if (!NciModule)
|
2020-10-30 11:43:47 +01:00
|
|
|
abort();
|
2020-07-21 18:19:15 +02:00
|
|
|
NciSetConnectionName =
|
|
|
|
(DWORD(WINAPI *)(const GUID *, const WCHAR *))GetProcAddress(NciModule, "NciSetConnectionName");
|
2020-07-21 11:11:14 +02:00
|
|
|
NciGetConnectionName =
|
2020-07-21 18:19:15 +02:00
|
|
|
(DWORD(WINAPI *)(const GUID *, WCHAR *, DWORD, DWORD *))GetProcAddress(NciModule, "NciGetConnectionName");
|
2020-07-07 15:32:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-10-30 06:03:21 +01:00
|
|
|
NciCleanup(void)
|
2020-07-07 15:32:06 +02:00
|
|
|
{
|
|
|
|
if (NciModule)
|
|
|
|
FreeLibrary(NciModule);
|
|
|
|
}
|