summaryrefslogtreecommitdiff
path: root/src/m_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/m_misc.c')
-rw-r--r--src/m_misc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/m_misc.c b/src/m_misc.c
index 9a5fb84a..31c87898 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -30,9 +30,9 @@
#include <ctype.h>
#include <errno.h>
-// for mkdir:
-
#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
#include <io.h>
#ifdef _MSC_VER
#include <direct.h>
@@ -206,3 +206,22 @@ boolean M_StrToInt(const char *str, int *result)
|| sscanf(str, " %d", result) == 1;
}
+#ifdef _WIN32
+
+char *M_OEMToUTF8(const char *oem)
+{
+ unsigned int len = strlen(oem) + 1;
+ wchar_t *tmp;
+ char *result;
+
+ tmp = malloc(len * sizeof(wchar_t));
+ MultiByteToWideChar(CP_OEMCP, 0, oem, len, tmp, len);
+ result = malloc(len * 4);
+ WideCharToMultiByte(CP_UTF8, 0, tmp, len, result, len * 4, NULL, NULL);
+ free(tmp);
+
+ return result;
+}
+
+#endif
+