當前位置: 首頁>>代碼示例>>Golang>>正文


Golang syscall.DLL類代碼示例

本文整理匯總了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
}
開發者ID:cero-t,項目名稱:cero-macro.go,代碼行數:7,代碼來源:vjoyInterface_windows.go

示例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)
}
開發者ID:wheelcomplex,項目名稱:go-1,代碼行數:8,代碼來源:syscall_windows_test.go

示例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
}
開發者ID:Xiahl1990,項目名稱:go,代碼行數:48,代碼來源:syscall_windows_test.go

示例4: UnloadDll

//卸載dll
func UnloadDll(dll *syscall.DLL) {
	if dll != nil {
		dll.Release()
	}
}
開發者ID:kity-xu,項目名稱:xuxiaodong,代碼行數:6,代碼來源:dllinterop.go

示例5: init

func init() {
	var modkernel32 *syscall.DLL
	if modkernel32, findProcErr = syscall.LoadDLL("kernel32.dll"); findProcErr == nil {
		procGetFileInformationByHandleEx, findProcErr = modkernel32.FindProc("GetFileInformationByHandleEx")
	}
}
開發者ID:neurocline,項目名稱:catalog,代碼行數:6,代碼來源:ctime_windows.go


注:本文中的syscall.DLL類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。