mirror of
https://gitlab.com/niansa/PolicyToolLib.git
synced 2025-03-06 20:48:27 +01:00
Just another minor admin impersonation improvement
This commit is contained in:
parent
d5e1890801
commit
937417b6f8
1 changed files with 6 additions and 0 deletions
|
@ -16,6 +16,9 @@ class LibInherit : public ModuleBase {
|
|||
_In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment,
|
||||
_In_opt_ LPCSTR lpCurrentDirectory, _In_ LPSTARTUPINFOA lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation
|
||||
) {
|
||||
if (GetEnvironmentVariable("__POLICYTOOL_ADMINIMPERSONATE", buffer, sizeof(buffer)) && buffer[0] == '1') {
|
||||
SetEnvironmentVariableW(L"__COMPAT_LAYER", L"RunAsInvoker");
|
||||
}
|
||||
return DetourCreateProcessWithDllExA(lpApplicationName, lpCommandLine, lpProcessAttributes,
|
||||
lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory,
|
||||
lpStartupInfo, lpProcessInformation, sDetourLibrary, TrueCreateProcessA);
|
||||
|
@ -27,6 +30,9 @@ class LibInherit : public ModuleBase {
|
|||
_In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment,
|
||||
_In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation
|
||||
) {
|
||||
if (GetEnvironmentVariable("__POLICYTOOL_ADMINIMPERSONATE", buffer, sizeof(buffer)) && buffer[0] == '1') {
|
||||
SetEnvironmentVariableW(L"__COMPAT_LAYER", L"RunAsInvoker");
|
||||
}
|
||||
return DetourCreateProcessWithDllExW(lpApplicationName, lpCommandLine, lpProcessAttributes,
|
||||
lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory,
|
||||
lpStartupInfo, lpProcessInformation, sDetourLibrary, TrueCreateProcessW);
|
||||
|
|
Loading…
Add table
Reference in a new issue