aboutsummaryrefslogtreecommitdiff
path: root/os.h
blob: 594ccadeb2e5a673114102b64b433e2bc3e5d835 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: ISC
// SPDX-FileCopyrightText: 2024 Matthew Wozniak <me@woz.blue>

#ifndef OS_H
#define OS_H

#include <Windows.h>
#include "intdef.h"

/* This is really just here because Windows API functions are ugly. Maybe this
 * will be cross platform one day... */

#define os_dlopen LoadLibraryA
#define os_dlsym (void *)GetProcAddress
#define os_dlhandle GetModuleHandleA 
#define os_dlclose FreeLibrary

inline bool os_mprot(void *mem, int len, int mode) {
	ulong old;
	return !!VirtualProtect(mem, len, mode, &old);
}

#endif

// vi: sw=4 ts=4 noet tw=80 cc=80