2023-06-06 00:23:08 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-02-24 18:32:33 +02:00
|
|
|
#include <windows.h>
|
2023-06-06 00:23:08 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2023-08-10 01:00:24 +03:00
|
|
|
#define UTILS_COUNT(arr) (sizeof(arr) / sizeof(*arr))
|
|
|
|
|
|
2024-02-24 18:32:33 +02:00
|
|
|
struct file_mapping {
|
|
|
|
|
HANDLE file;
|
|
|
|
|
HANDLE mapping;
|
|
|
|
|
unsigned char *data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void utils_map_file(const wchar_t *path, struct file_mapping *map);
|
|
|
|
|
void utils_unmap_file(struct file_mapping *map);
|
|
|
|
|
|
2023-08-04 22:55:10 +03:00
|
|
|
int utils_path_exists(const wchar_t *filePath);
|
2023-08-04 21:09:16 +03:00
|
|
|
uint32_t utils_file_crc32c(const wchar_t *filePath);
|
2023-06-08 22:33:37 +03:00
|
|
|
|
2023-08-10 01:15:53 +03:00
|
|
|
void utils_create_parent_dirs(const wchar_t *path);
|
2023-08-04 22:55:10 +03:00
|
|
|
|
|
|
|
|
void utils_save_to_file(const wchar_t *filePath, const void *buf, size_t length);
|
|
|
|
|
|
2023-06-08 22:33:37 +03:00
|
|
|
char utils_env_enabled(const char *env);
|
2024-01-07 18:34:03 +02:00
|
|
|
|
2024-01-07 19:02:02 +02:00
|
|
|
void utils_write_protected_memory(void *addr, const void *buf, size_t size);
|