1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-06 07:44:57 +03:00

v4.19-9599-beta

This commit is contained in:
dnobori
2015-10-19 21:30:51 +09:00
parent 4e862a7e40
commit d3a1b26413
1085 changed files with 2275 additions and 1979 deletions

View File

@ -12609,6 +12609,14 @@ NT_API *MsLoadNtApiFunctions()
(BOOL (__stdcall *)(HANDLE,DWORD,LPWSTR,PDWORD))
GetProcAddress(nt->hKernel32, "QueryFullProcessImageNameW");
nt->RegLoadKeyW =
(LSTATUS (__stdcall *)(HKEY,LPCWSTR,LPCWSTR))
GetProcAddress(nt->hAdvapi32, "RegLoadKeyW");
nt->RegUnLoadKeyW =
(LSTATUS (__stdcall *)(HKEY,LPCWSTR))
GetProcAddress(nt->hAdvapi32, "RegUnLoadKeyW");
if (info.dwMajorVersion >= 5)
{
nt->UpdateDriverForPlugAndPlayDevicesW =
@ -12957,6 +12965,59 @@ DWORD MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit)
return 0;
}
// Load the hive
bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename)
{
LONG ret;
if (keyname == NULL || filename == NULL)
{
WHERE;
return false;
}
if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL)
{
WHERE;
return false;
}
ret = ms->nt->RegLoadKeyW(MsGetRootKeyFromInt(root), keyname, filename);
if (ret != ERROR_SUCCESS)
{
Debug("RegLoadKeyW: %S %S %u\n", keyname, filename, GetLastError());
return false;
}
WHERE;
return true;
}
// Unload the hive
bool MsRegUnloadHive(UINT root, wchar_t *keyname)
{
LONG ret;
if (keyname == NULL)
{
return false;
}
if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL)
{
return false;
}
ret = ms->nt->RegUnLoadKeyW(MsGetRootKeyFromInt(root), keyname);
if (ret != ERROR_SUCCESS)
{
Debug("RegUnLoadKeyW: %u\n", GetLastError());
return false;
}
return true;
}
// Delete the value
bool MsRegDeleteValue(UINT root, char *keyname, char *valuename)
{

View File

@ -495,6 +495,8 @@ typedef struct NT_API
BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, DWORD, DWORD, DWORD, PSID);
HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *);
BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPDWORD);
LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR);
LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR);
} NT_API;
typedef struct MS_EVENTLOG
@ -725,6 +727,9 @@ bool MsRegDeleteValue(UINT root, char *keyname, char *valuename);
bool MsRegDeleteValueEx(UINT root, char *keyname, char *valuename, bool force32bit);
bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit);
bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename);
bool MsRegUnloadHive(UINT root, wchar_t *keyname);
bool MsIsNt();
bool MsIsAdmin();
bool MsEnablePrivilege(char *name, bool enable);