-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathutils.h
More file actions
22 lines (20 loc) · 737 Bytes
/
utils.h
File metadata and controls
22 lines (20 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <string>
#include <iostream>
using namespace std;
#include "windows.h"
#include "Psapi.h"
// util function prototypes
string basename(string path);
wstring basename(wstring path);
wstring to_wstring(string s);
wstring to_upper(wstring ws);
void print_format(string s, unsigned int width, string delim);
int to_int(string s);
HMODULE to_hex(string s);
DWORD64 to_hex(char c);
long double parse_float(DWORD64 value, size_t size);
// WINAPI utilities
bool check_winapi_error(DWORD expected, DWORD result, string function_name, bool error_exit);
enum PROCESS_MODE { USER_MODE, KERNEL_MODE };
void remove_permissions(HANDLE process_handle, PROCESS_MODE process_mode);
HMODULE get_base_address(HANDLE process_handle, wstring path);