Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
113 lines (103 sloc)
2.9 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +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 | |
} |