本文整理汇总了Golang中syscall.DLL类的典型用法代码示例。如果您正苦于以下问题:Golang DLL类的具体用法?Golang DLL怎么用?Golang DLL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DLL类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: initProc
func initProc(dll *syscall.DLL, name string) *syscall.Proc {
proc, _err := dll.FindProc(name)
if _err != nil {
log.Fatal("get proc vJoyEnabled", _err)
}
return proc
}
示例2: runOne
func (test *cbTest) runOne(t *testing.T, dll *syscall.DLL, proc string, cb uintptr) {
defer func() {
if r := recover(); r != nil {
t.Errorf("dll call %v(..., %d) failed: %v", proc, test.param, r)
}
}()
dll.MustFindProc(proc).Call(cb, test.param)
}
示例3: resumeChildThread
func resumeChildThread(kernel32 *syscall.DLL, childpid int) error {
_OpenThread := kernel32.MustFindProc("OpenThread")
_ResumeThread := kernel32.MustFindProc("ResumeThread")
_Thread32First := kernel32.MustFindProc("Thread32First")
_Thread32Next := kernel32.MustFindProc("Thread32Next")
snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPTHREAD, 0)
if err != nil {
return err
}
defer syscall.CloseHandle(snapshot)
const _THREAD_SUSPEND_RESUME = 0x0002
type ThreadEntry32 struct {
Size uint32
tUsage uint32
ThreadID uint32
OwnerProcessID uint32
BasePri int32
DeltaPri int32
Flags uint32
}
var te ThreadEntry32
te.Size = uint32(unsafe.Sizeof(te))
ret, _, err := _Thread32First.Call(uintptr(snapshot), uintptr(unsafe.Pointer(&te)))
if ret == 0 {
return err
}
for te.OwnerProcessID != uint32(childpid) {
ret, _, err = _Thread32Next.Call(uintptr(snapshot), uintptr(unsafe.Pointer(&te)))
if ret == 0 {
return err
}
}
h, _, err := _OpenThread.Call(_THREAD_SUSPEND_RESUME, 1, uintptr(te.ThreadID))
if h == 0 {
return err
}
defer syscall.Close(syscall.Handle(h))
ret, _, err = _ResumeThread.Call(h)
if ret == 0xffffffff {
return err
}
return nil
}
示例4: UnloadDll
//卸载dll
func UnloadDll(dll *syscall.DLL) {
if dll != nil {
dll.Release()
}
}
示例5: init
func init() {
var modkernel32 *syscall.DLL
if modkernel32, findProcErr = syscall.LoadDLL("kernel32.dll"); findProcErr == nil {
procGetFileInformationByHandleEx, findProcErr = modkernel32.FindProc("GetFileInformationByHandleEx")
}
}