Skip to content

Instantly share code, notes, and snippets.

@donnaken15
Last active September 23, 2020 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donnaken15/5725c850071de4f8ad7079afa53973b3 to your computer and use it in GitHub Desktop.
Save donnaken15/5725c850071de4f8ad7079afa53973b3 to your computer and use it in GitHub Desktop.
Exile's GH3+ loader with some additions
; this is ran near functions executed with WinMain
mov eax, core
push eax
push space ; mightve forgot to add this, but dont know what its for
call dword ptr ds:LoadLibraryA
; invoke syntax: LoadLibraryA, eax
; maybe since eax is already set just call LL
; though pushing vals/regs is still required in some way
cmp eax, 0
jz nocore
retn 0
nocore:
push 1
call ds:exit
; invoke ExitProcess,1
;if we want to get exact, exit code should be 110 or 1114 or 1276
;hence ERROR_FILE_NOT_FOUND / ERROR_DLL_INIT_FAILED / ERROR_INVALID_IMPORT_OF_NON_DLL
core db 'PLUGINS\core.dll',0
space db 8 dup (0)
; improvise and act more friendly if no core exists
; lol V
cmp eax, 0
jnz corefound
invoke MessageBoxA, corefail, corefailcap, MB_ICONERROR ; or use MB_ICONWARNING or exclamation
corefound:
retn 0
corefail db 'GH3+ core cannot be found!',0ah,'Plugins will not load.',0
corefailcap db 'GH3+ Injection Error',0
; another idea, add INI setting to ignore message box if error occurs
; blind test allowing checking core again
coreload:
mov eax, core
push eax
push space ; mightve forgot to add this, but dont know what its for
call dword ptr ds:LoadLibraryA
; invoke LoadLibrary, space, core ; forgot push order xd
cmp eax, 0
jnz corefound
invoke MessageBoxA, corefail, corefailcap, MB_ICONERROR+MB_ABORTRETRYIGNORE
cmp eax, 5 ; 11
je corefound
cmp eax, 4 ; CANCELTRYCONTINUE: 10
je coreload
cmp eax, 3 ; 2
je nocore
nocore:
push 1
call ds:exit
; virgin exit vs chad ExitProcess
; i just remembered as im writing this
; also wont need msvcrt if EP used instead
corefound:
retn 0
; insert to use with FASM
;beginning
format binary
include 'win32a.inc'
;beginning
; end
section 'HATRED' import data readable writeable
library kernel, 'KERNEL32.DLL',\
user, 'USER32.DLL'
import kernel,\
LoadLibraryA,'LoadLibraryA',\
ExitProcess,'ExitProcess'
import user,\
MessageBoxA,'MessageBoxA'
; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment