aboutsummaryrefslogtreecommitdiff
path: root/win32/uc.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-01-07 13:39:17 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-01-07 13:39:17 +0900
commit09ea1fe272aca6ebb6840f02765acd44ac3ecebc (patch)
tree9221a90ae3b6d35394554d5ecae1a1c14cda4ca6 /win32/uc.c
parente8e394a10937bec18106d2f8c1c0a045c62f458f (diff)
win32
Diffstat (limited to 'win32/uc.c')
-rw-r--r--win32/uc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/win32/uc.c b/win32/uc.c
new file mode 100644
index 0000000..70d2e85
--- /dev/null
+++ b/win32/uc.c
@@ -0,0 +1,36 @@
+#include <string.h>
+#include <windows.h>
+
+int memcmp(const void *s1, const void *s2, size_t n) {
+ size_t i = RtlCompareMemory(s1, s2, n);
+ if (i == n) return 0;
+ return ((const unsigned char *)s1)[i] - ((const unsigned char *)s2)[i];
+}
+
+void *memset(void *s, int c, size_t n) {
+ RtlFillMemory(s, n, c);
+ return s;
+}
+
+void *memcpy(void *dest, const void *src, size_t n) {
+ RtlCopyMemory(dest, src, n);
+ return dest;
+}
+
+void *memmove(void *dest, const void *src, size_t n) {
+ RtlMoveMemory(dest, src, n);
+ return dest;
+}
+
+int CALLBACK wWinMain(HINSTANCE hinst, HINSTANCE hpinst,
+ wchar_t *cmdline, int cmdshow);
+
+DWORD CALLBACK entry(void *ptr) {
+ (void)ptr;
+ STARTUPINFO si;
+ GetStartupInfo(&si);
+ int cmdshow = si.wShowWindow;
+ if (si.dwFlags & STARTF_USESHOWWINDOW) cmdshow = SW_SHOWNORMAL;
+ DWORD ret = wWinMain(GetModuleHandle(0), 0, 0, cmdshow);
+ ExitProcess(ret);
+}