-
Notifications
You must be signed in to change notification settings - Fork 54
/
assembly.go
113 lines (103 loc) · 2.9 KB
/
assembly.go
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// +build windows
package clr
import (
"golang.org/x/sys/windows"
"syscall"
"unsafe"
)
// from mscorlib.tlh
type Assembly struct {
vtbl *AssemblyVtbl
}
type AssemblyVtbl struct {
QueryInterface uintptr
AddRef uintptr
Release uintptr
GetTypeInfoCount uintptr
GetTypeInfo uintptr
GetIDsOfNames uintptr
Invoke uintptr
get_ToString uintptr
Equals uintptr
GetHashCode uintptr
GetType uintptr
get_CodeBase uintptr
get_EscapedCodeBase uintptr
GetName uintptr
GetName_2 uintptr
get_FullName uintptr
get_EntryPoint uintptr
GetType_2 uintptr
GetType_3 uintptr
GetExportedTypes uintptr
GetTypes uintptr
GetManifestResourceStream uintptr
GetManifestResourceStream_2 uintptr
GetFile uintptr
GetFiles uintptr
GetFiles_2 uintptr
GetManifestResourceNames uintptr
GetManifestResourceInfo uintptr
get_Location uintptr
get_Evidence uintptr
GetCustomAttributes uintptr
GetCustomAttributes_2 uintptr
IsDefined uintptr
GetObjectData uintptr
add_ModuleResolve uintptr
remove_ModuleResolve uintptr
GetType_4 uintptr
GetSatelliteAssembly uintptr
GetSatelliteAssembly_2 uintptr
LoadModule uintptr
LoadModule_2 uintptr
CreateInstance uintptr
CreateInstance_2 uintptr
CreateInstance_3 uintptr
GetLoadedModules uintptr
GetLoadedModules_2 uintptr
GetModules uintptr
GetModules_2 uintptr
GetModule uintptr
GetReferencedAssemblies uintptr
get_GlobalAssemblyCache uintptr
}
func NewAssemblyFromPtr(ppv uintptr) *Assembly {
return (*Assembly)(unsafe.Pointer(ppv))
}
func (obj *Assembly) QueryInterface(riid *windows.GUID, ppvObject *uintptr) uintptr {
ret, _, _ := syscall.Syscall(
obj.vtbl.QueryInterface,
3,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(riid)),
uintptr(unsafe.Pointer(ppvObject)))
return ret
}
func (obj *Assembly) AddRef() uintptr {
ret, _, _ := syscall.Syscall(
obj.vtbl.AddRef,
1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return ret
}
func (obj *Assembly) Release() uintptr {
ret, _, _ := syscall.Syscall(
obj.vtbl.Release,
1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return ret
}
func (obj *Assembly) GetEntryPoint(pMethodInfo *uintptr) uintptr {
ret, _, _ := syscall.Syscall(
obj.vtbl.get_EntryPoint,
2,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(pMethodInfo)),
0)
return ret
}