New messagebox system

This commit is contained in:
mkrsym1
2023-06-08 21:44:42 +03:00
parent 38dbf82f7f
commit 8662c84a0a
10 changed files with 64 additions and 47 deletions

View File

@ -1,14 +1,14 @@
#include <windows.h>
#include <crc32.h>
#include <err.h>
#include <msg.h>
#include <utils.h>
uint32_t utils_file_crc32c(const char *filePath) {
HANDLE file = CreateFileA(filePath, FILE_READ_ACCESS, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (!file) {
err_mb_a("Could not open file: %s", filePath);
msg_err_a("Could not open file: %s", filePath);
}
LARGE_INTEGER fileSize;
@ -17,7 +17,7 @@ uint32_t utils_file_crc32c(const char *filePath) {
HANDLE hMap = CreateFileMappingA(file, NULL, PAGE_READONLY, 0, 0, NULL);
char *map = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
if (!map) {
err_mb_a("Could not create file mapping for %s", filePath);
msg_err_a("Could not create file mapping for %s", filePath);
}
uint32_t crc = crc32c(0, (unsigned char*)map, fileSize.QuadPart);