feat: procmon library to monitor system calls #281

Open
icex2 wants to merge 22 commits from icex2/procmon-launcher into development
2 changed files with 52 additions and 1 deletions
Showing only changes of commit 0eda352f96 - Show all commits
+49 -1
View File
@@ -1,7 +1,55 @@
#include <windows.h>
#define LOG_MODULE "util-proc"
#include <windows.h>
#include <winnt.h>
#include <stdbool.h>
#include <stdint.h>
#include "util/log.h"
bool proc_is_running_as_admin_user()
{
SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
PSID sid;
BOOL res;
BOOL is_admin;
res = AllocateAndInitializeSid(
&authority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0,
0,
0,
0,
0,
0,
&sid);
if (!res) {
log_warning(
"Failed to allocate memory for is admin check: %lX",
GetLastError());
return false;
}
is_admin = false;
res = CheckTokenMembership(NULL, sid, &is_admin);
if (!res) {
log_warning(
"Failed to check admin group membership: %lX", GetLastError());
return false;
}
FreeSid(sid);
return is_admin;
}
void proc_terminate_current_process(uint32_t exit_code)
{
HANDLE hnd;
+3
View File
@@ -1,5 +1,8 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
bool proc_is_running_as_admin_user();
void proc_terminate_current_process(uint32_t exit_code);