-
Notifications
You must be signed in to change notification settings - Fork 1
/
version-shim.yasm
69 lines (62 loc) · 1.33 KB
/
version-shim.yasm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
%ifidn __OUTPUT_FORMAT__, win64
bits 64
%define ptrres resq 1
%define mangle(x) x
%macro declare 1
extern mangle(p%1) ptrres
section .text
global mangle(Shim%1)
mangle(Shim%1):
call shim_prepare2
jmp [rel mangle(p%1)]
%endmacro
section .text
shim_prepare2:
cmp dword [rel mangle(shim_prepared)], 0
jz _continue
ret
_continue:
push r9
push r8
push rdx
push rcx
call mangle(shim_prepare)
pop rcx
pop rdx
pop r8
pop r9
ret
%elifidn __OUTPUT_FORMAT__, win32
bits 32
%define ptrres resd 1
%define mangle(x) _ %+ x
%macro declare 1
extern mangle(p%1) ptrres
section .text
global mangle(Shim%1)
mangle(Shim%1):
call shim_prepare
jmp [mangle(p%1)]
%endmacro
%endif
section .text
align 8
extern mangle(shim_prepare) ptrres
extern mangle(shim_prepared) ptrres
declare GetFileVersionInfoA
declare GetFileVersionInfoByHandle
declare GetFileVersionInfoExA
declare GetFileVersionInfoExW
declare GetFileVersionInfoSizeA
declare GetFileVersionInfoSizeExA
declare GetFileVersionInfoSizeExW
declare GetFileVersionInfoSizeW
declare GetFileVersionInfoW
declare VerFindFileA
declare VerFindFileW
declare VerInstallFileA
declare VerInstallFileW
declare VerLanguageNameA
declare VerLanguageNameW
declare VerQueryValueA
declare VerQueryValueW