aboutsummaryrefslogtreecommitdiff
path: root/malware.c
blob: 6d9e981562335d03fff29a172c90ecba4766de29 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#if defined(plat_windows)

/* Because Windows is made by retards and
 * windows.h overlaps with some of my shit. */

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#include <stdio.h>
#include <stdlib.h>

void platform_log(const char* message, ...) {
	va_list args;
	va_start(args, message);
	vfprintf(stdout, message, args);
	va_end(args);
}

void platform_err(const char* message, ...) {
	va_list args;
	HANDLE console;

	console = GetStdHandle(STD_OUTPUT_HANDLE);

	va_start(args, message);

	SetConsoleTextAttribute(console, 4);
	vfprintf(stderr, message, args);
	SetConsoleTextAttribute(console, 7);

	va_end(args);
}

void platform_abort(int code) {
#if defined(DEBUG) && defined(plat_x86)
	__asm__("int3;");
#else
	exit(code);
#endif
}
#endif

/* Because empty translation units aren't allowed. */
void malware_dummy_() {}