|
|
@@ -182,6 +182,8 @@ var (
|
|
|
procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
|
|
|
procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
|
|
|
procProcess32NextW = modkernel32.NewProc("Process32NextW")
|
|
|
+ procThread32First = modkernel32.NewProc("Thread32First")
|
|
|
+ procThread32Next = modkernel32.NewProc("Thread32Next")
|
|
|
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
|
|
|
procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
|
|
|
procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
|
|
|
@@ -1929,6 +1931,30 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
|
|
|
+ r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
|
|
|
+ if r1 == 0 {
|
|
|
+ if e1 != 0 {
|
|
|
+ err = errnoErr(e1)
|
|
|
+ } else {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
|
|
|
+ r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
|
|
|
+ if r1 == 0 {
|
|
|
+ if e1 != 0 {
|
|
|
+ err = errnoErr(e1)
|
|
|
+ } else {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
|
|
|
r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
|
|
|
if r1 == 0 {
|