format PE GUI 4.0 large DLL at $07000000
include 'win32wxp.inc'
entry DllMain
checksum = $01285366
code_size = $00E0D000
section '.text' code readable executable
proc DllMain this_module, call_reason, reserved
mov eax, TRUE
ret
endp
proc ApplyPatches
push esi
push edi
sub esp, 4
invoke VirtualProtect, $00401000, code_size, PAGE_EXECUTE_READWRITE, esp
add esp, 4
cld
push ebx
push ecx
mov eax, Patches-4
align 16
.next_patch:
add eax, 4
mov esi, [eax]
test esi, esi
jz .finished_attach
add eax, 4
mov ebx, esi
mov edx, [eax]
align 16
.patch_code:
add eax, 4
mov edi, [eax]
test edi, edi
jz .next_patch
mov esi, ebx
mov ecx, edx
rep movsb
jmp .patch_code
.finished_attach:
sub esp, 4
invoke VirtualProtect, $00401000, code_size, PAGE_EXECUTE_READ, esp
add esp, 4
pop ecx
pop ebx
pop edi
pop esi
ret
endp
include 'Code.inc'
; SKSE plugin API
struct SKSEInterface
skseVersion dd ?
runtimeVersion dd ?
editorVersion dd ?
isEditor dd ?
QueryInterface dd ?
ends
struct PluginInfo
infoVersion dd ?
name dd ?
version dd ?
ends
proc SKSEPlugin_Query c skse, info
; fill out info struct
mov eax, [info]
mov [eax+PluginInfo.infoVersion], 1
mov [eax+PluginInfo.name], plugin_name
mov [eax+PluginInfo.version], 2
; check context
mov eax, [skse]
cmp [eax+SKSEInterface.isEditor], 0
jnz .badVersion
cmp [eax+SKSEInterface.runtimeVersion], $030A0000 ; 1.3.10.0
jnz .badVersion
; version checks pass
mov eax, 1
ret
.badVersion:
xor eax, eax
ret
endp
proc SKSEPlugin_Load c skse
stdcall ApplyPatches
mov eax, 1
ret
endp
section '.data' data readable writeable
plugin_name db "TESVAL", 0
include 'Table.inc'
section '.idata' import data readable writeable
library kernel, 'kernel32.dll'
import kernel, \
VirtualProtect, 'VirtualProtect'
section '.edata' export data readable
export 'tesval.dll', \
SKSEPlugin_Query, 'SKSEPlugin_Query', \
SKSEPlugin_Load, 'SKSEPlugin_Load'
section '.reloc' fixups data discardable