summaryrefslogtreecommitdiff
path: root/injector/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'injector/main.cpp')
-rw-r--r--injector/main.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/injector/main.cpp b/injector/main.cpp
deleted file mode 100644
index f3d3511..0000000
--- a/injector/main.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <stdio.h>
-#include "winapi.h"
-
-const wchar_t* const kernel32_str = L"KERNEL32.DLL";
-const wchar_t* const ucrtbase_str = L"ucrtbase.dll";
-const char* const loadlib_str = "LoadLibraryA";
-const char* const printf_str = "printf";
-
-const char* const printf_fmt = "print: %08x\n\0";
-const char* const fail_msg = "k32 null\n";
-const char* const pause_str = "pause";
-const char* const system_str = "system";
-
-uintptr_t printf_addr = ( uintptr_t )&printf;
-uintptr_t system_addr = 0;
-
-//i dont even
-//unfinished btw
-
-__declspec( naked ) int print_var( uint32_t var ) {
- __asm {
- push ebp
- mov ebp, esp
- sub esp, __LOCAL_SIZE
-
- mov eax, var
- push eax
- push printf_fmt
- call printf_addr
-
- add esp, 8
- mov esp, ebp
- pop ebp
-
- mov eax, 0
- ret
- }
-}
-
-__declspec( naked ) void print_error( const char* err ) {
- __asm {
- push ebp
- mov ebp, esp
- sub esp, __LOCAL_SIZE
-
- mov eax, err
- push eax
- call printf_addr
-
- add esp, 8
- mov esp, ebp
- pop ebp
- }
-}
-
-__declspec( naked ) int main( void ) {
- void* k32;
- void* ucrtbase;
- uintptr_t loadlib;
-
- __asm {
- push ebp
- mov ebp, esp
- sub esp, __LOCAL_SIZE
-
- mov eax, ds:ucrtbase_str
- push eax
- call winapi::k32::get_module_handle
- add esp, 4
- mov ucrtbase, eax
-
- mov eax, ds:system_str
- push eax
- mov ecx, ucrtbase
- push ecx
- call winapi::k32::get_proc_address
- add esp, 4
- mov system_addr, eax
-
- mov eax, ds:kernel32_str
- push eax
- call winapi::k32::get_module_handle
- add esp, 4
- mov k32, eax
-
- mov eax, k32
- push eax
- call print_var
-
- cmp k32, 0
- je K32_FAIL
-
- mov eax, ds:loadlib_str
- push eax
- mov ecx, k32
- push ecx
- call winapi::k32::get_proc_address
-
- add esp, 8
- mov loadlib, eax
-
- mov eax, loadlib
- push eax
- call print_var
-
- jmp END
-
- K32_FAIL:
- mov eax, fail_msg
- push eax
- call printf_addr
-
- END:
- mov eax, pause_str
- push eax
- call system_addr
- mov esp, ebp
- pop ebp
- ret
- }
-} \ No newline at end of file