diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a4e9313..25fd901 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,7 +15,7 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Configure
- run: nix develop --command make -j4 slipstream
+ run: nix develop --command make -j8 all
- name: Upload
uses: actions/upload-artifact@v2
with:
diff --git a/Makefile b/Makefile
index d8b9eeb..70330aa 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ CFLAGS :=
LDFLAGS := -nodefaultlibs -nostartfiles -lkernel32 -luser32 -Wl,--enable-stdcall-fixup -s
+LDFLAGS_MSVCRT := third_party/msvcrt/msvcrt.lib third_party/msvcrt/rtsyms.o
+
OBJS := \
obj/dll/rugburn/main.o \
obj/hooks/kernel32/inject.o \
@@ -22,15 +24,12 @@ OBJS := \
obj/common.o \
obj/config.o \
obj/hex.o \
- obj/ijl.o \
obj/json.o \
obj/patch.o \
obj/regex.o
IJL15OBJS := $(wildcard third_party/ijl/*.obj)
-LDFLAGS_MSVCRT := third_party/msvcrt/msvcrt.lib third_party/msvcrt/exceptlist.o
-
TESTOBJS := \
$(OBJS) \
obj/exe/test/main.o
diff --git a/rugburn.vcxproj b/rugburn.vcxproj
index 51dab30..24ec5bf 100644
--- a/rugburn.vcxproj
+++ b/rugburn.vcxproj
@@ -106,7 +106,8 @@
true
export.def
DllMain
- kernel32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;shlwapi.lib;$(ProjectDir)\third_party\msvcrt\msvcrt.lib;%(AdditionalDependencies)
+ false
@@ -126,7 +127,8 @@
true
export.def
DllMain
- kernel32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;shlwapi.lib;$(ProjectDir)\third_party\msvcrt\msvcrt.lib;%(AdditionalDependencies)
+ false
@@ -149,7 +151,8 @@
true
export.def
DllMain
- kernel32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;shlwapi.lib;$(ProjectDir)\third_party\msvcrt\msvcrt.lib;%(AdditionalDependencies)
+ false
@@ -172,11 +175,11 @@
true
export.def
DllMain
- kernel32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;shlwapi.lib;$(ProjectDir)\third_party\msvcrt\msvcrt.lib;%(AdditionalDependencies)
+ false
-
@@ -187,7 +190,6 @@
-
@@ -201,6 +203,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rugburn.vcxproj.filters b/rugburn.vcxproj.filters
index 719c0cd..1dc421f 100644
--- a/rugburn.vcxproj.filters
+++ b/rugburn.vcxproj.filters
@@ -1,7 +1,6 @@
-
@@ -9,7 +8,6 @@
-
@@ -21,9 +19,130 @@
-
+
-
+
+
+ {749b9e28-ce49-4aa7-999d-be4bb1077fc1}
+
+
+ {94f8af0b-1247-4f4a-929d-819e5285c358}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/common.c b/src/common.c
index 45ace6b..bc56005 100644
--- a/src/common.c
+++ b/src/common.c
@@ -75,6 +75,33 @@ VOID InitCommon() {
#pragma function(memset)
#endif
+// MSVCRT runtime functions
+#ifdef _MSC_VER
+void __declspec(naked) _aullshr() {
+ __asm {
+ cmp cl,40h
+ jae RETZERO
+ cmp cl,20h
+ jae MORE32
+ shrd eax,edx,cl
+ shr edx,cl
+ ret
+MORE32:
+ mov eax,edx
+ xor edx,edx
+ and cl,1Fh
+ shr eax,cl
+ ret
+RETZERO:
+ xor eax,eax
+ xor edx,edx
+ ret
+ }
+}
+#else
+unsigned long long __stdcall _aullshr(unsigned long long a, long b) { return a >> b; }
+#endif
+
// C standard library functions
int strcmp(LPCSTR dest, LPCSTR src) {
int cmp;
diff --git a/src/ijl.c b/src/ijl.c
deleted file mode 100644
index 94847bd..0000000
--- a/src/ijl.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Exports ijl15 symbols.
- */
-
-#ifdef __MINGW32__
-
-unsigned long long __stdcall _aullshr(unsigned long long a, long b)
-{
- return a >> b;
-}
-
-#endif
diff --git a/third_party/msvcrt/exceptlist.o b/third_party/msvcrt/rtsyms.o
similarity index 52%
rename from third_party/msvcrt/exceptlist.o
rename to third_party/msvcrt/rtsyms.o
index 1695a58..7086f07 100644
Binary files a/third_party/msvcrt/exceptlist.o and b/third_party/msvcrt/rtsyms.o differ