diff --git a/README.md b/README.md index d09d740..1884c03 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ Compiles and runs under ## Version -1.8.2 -Last changed: 10.09.2024 +1.8.3 +Last changed: 17.09.2024 ## REQUIREMENTS diff --git a/src/hexter.c b/src/hexter.c index 976f1c3..5c209c7 100644 --- a/src/hexter.c +++ b/src/hexter.c @@ -36,8 +36,8 @@ #include "utils/Strings.h" #define BIN_NAME ("hexter") -#define BIN_VS "1.8.2" -#define BIN_LAST_CHANGED "10.09.2024" +#define BIN_VS "1.8.3" +#define BIN_LAST_CHANGED "17.09.2024" #define LIN_PARAM_IDENTIFIER ('-') #define WIN_PARAM_IDENTIFIER ('/') diff --git a/src/utils/win/processes.h b/src/utils/win/processes.h index dd747a5..835ab21 100644 --- a/src/utils/win/processes.h +++ b/src/utils/win/processes.h @@ -11,38 +11,38 @@ typedef struct _MODULE_INFO { */ INT AddPrivileges( PCHAR *Privileges, - UINT32 PrivilegeCount + UINT32 PrivilegesCount ) { INT s = 0; - HANDLE htoken; + HANDLE token; ULONG i; - TOKEN_PRIVILEGES* p = NULL; + TOKEN_PRIVILEGES* tp = NULL; - if ( OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &htoken) ) + if ( OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token) ) { - size_t htokenSize = sizeof(TOKEN_PRIVILEGES) + (PrivilegeCount-1) * sizeof(LUID_AND_ATTRIBUTES); - p = (PTOKEN_PRIVILEGES)malloc(htokenSize); - if ( !p ) + size_t tpSize = sizeof(TOKEN_PRIVILEGES) + (PrivilegesCount-1) * sizeof(LUID_AND_ATTRIBUTES); + tp = (PTOKEN_PRIVILEGES)malloc(tpSize); + if ( !tp ) { s = GetLastError(); goto clean; } - for ( i = 0; i < PrivilegeCount; i++ ) + for ( i = 0; i < PrivilegesCount; i++ ) { - if ( !LookupPrivilegeValueA(NULL, Privileges[i], &(p->Privileges[i].Luid)) ) + if ( !LookupPrivilegeValueA(NULL, Privileges[i], &(tp->Privileges[i].Luid)) ) { s = GetLastError(); goto clean; } - p->Privileges[i].Attributes = SE_PRIVILEGE_ENABLED; + tp->Privileges[i].Attributes = SE_PRIVILEGE_ENABLED; } - p->PrivilegeCount = PrivilegeCount; + tp->PrivilegeCount = PrivilegesCount; - if ( !AdjustTokenPrivileges(htoken, FALSE, p, (ULONG)htokenSize, NULL, NULL) + if ( !AdjustTokenPrivileges(token, FALSE, tp, (ULONG)tpSize, NULL, NULL) || GetLastError() != ERROR_SUCCESS ) { s = GetLastError(); @@ -56,8 +56,8 @@ INT AddPrivileges( } clean: - if ( p ) - free(p); + if ( tp ) + free(tp); return s; } @@ -71,12 +71,12 @@ BOOL IsProcessElevated() if ( !OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken) ) { - goto clean; // if Failed, we treat as False + goto clean; } - if (!GetTokenInformation(hToken, TokenElevation, &elevation, sizeof(elevation), &dwSize)) + if ( !GetTokenInformation(hToken, TokenElevation, &elevation, sizeof(elevation), &dwSize) ) { - goto clean;// if Failed, we treat as False + goto clean; } fIsElevated = elevation.TokenIsElevated;