~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to src/pkg/syscall/zsyscall_windows_amd64.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        procGetQueuedCompletionStatus        = modkernel32.NewProc("GetQueuedCompletionStatus")
50
50
        procPostQueuedCompletionStatus       = modkernel32.NewProc("PostQueuedCompletionStatus")
51
51
        procCancelIo                         = modkernel32.NewProc("CancelIo")
 
52
        procCancelIoEx                       = modkernel32.NewProc("CancelIoEx")
52
53
        procCreateProcessW                   = modkernel32.NewProc("CreateProcessW")
53
54
        procOpenProcess                      = modkernel32.NewProc("OpenProcess")
54
55
        procTerminateProcess                 = modkernel32.NewProc("TerminateProcess")
103
104
        procRegQueryInfoKeyW                 = modadvapi32.NewProc("RegQueryInfoKeyW")
104
105
        procRegEnumKeyExW                    = modadvapi32.NewProc("RegEnumKeyExW")
105
106
        procRegQueryValueExW                 = modadvapi32.NewProc("RegQueryValueExW")
 
107
        procGetCurrentProcessId              = modkernel32.NewProc("GetCurrentProcessId")
 
108
        procGetConsoleMode                   = modkernel32.NewProc("GetConsoleMode")
 
109
        procWriteConsoleW                    = modkernel32.NewProc("WriteConsoleW")
 
110
        procReadConsoleW                     = modkernel32.NewProc("ReadConsoleW")
106
111
        procWSAStartup                       = modws2_32.NewProc("WSAStartup")
107
112
        procWSACleanup                       = modws2_32.NewProc("WSACleanup")
108
113
        procWSAIoctl                         = modws2_32.NewProc("WSAIoctl")
109
114
        procsocket                           = modws2_32.NewProc("socket")
110
115
        procsetsockopt                       = modws2_32.NewProc("setsockopt")
 
116
        procgetsockopt                       = modws2_32.NewProc("getsockopt")
111
117
        procbind                             = modws2_32.NewProc("bind")
112
118
        procconnect                          = modws2_32.NewProc("connect")
113
119
        procgetsockname                      = modws2_32.NewProc("getsockname")
127
133
        procgetprotobyname                   = modws2_32.NewProc("getprotobyname")
128
134
        procDnsQuery_W                       = moddnsapi.NewProc("DnsQuery_W")
129
135
        procDnsRecordListFree                = moddnsapi.NewProc("DnsRecordListFree")
 
136
        procGetAddrInfoW                     = modws2_32.NewProc("GetAddrInfoW")
 
137
        procFreeAddrInfoW                    = modws2_32.NewProc("FreeAddrInfoW")
130
138
        procGetIfEntry                       = modiphlpapi.NewProc("GetIfEntry")
131
139
        procGetAdaptersInfo                  = modiphlpapi.NewProc("GetAdaptersInfo")
132
140
        procTranslateNameW                   = modsecur32.NewProc("TranslateNameW")
142
150
        procOpenProcessToken                 = modadvapi32.NewProc("OpenProcessToken")
143
151
        procGetTokenInformation              = modadvapi32.NewProc("GetTokenInformation")
144
152
        procGetUserProfileDirectoryW         = moduserenv.NewProc("GetUserProfileDirectoryW")
145
 
        procgetCurrentProcessId              = modkernel32.NewProc("GetCurrentProcessId")
146
153
)
147
154
 
148
155
func GetLastError() (lasterr error) {
154
161
}
155
162
 
156
163
func LoadLibrary(libname string) (handle Handle, err error) {
157
 
        r0, _, e1 := Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0)
 
164
        var _p0 *uint16
 
165
        _p0, err = UTF16PtrFromString(libname)
 
166
        if err != nil {
 
167
                return
 
168
        }
 
169
        r0, _, e1 := Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0)
158
170
        handle = Handle(r0)
159
171
        if handle == 0 {
160
172
                if e1 != 0 {
168
180
 
169
181
func FreeLibrary(handle Handle) (err error) {
170
182
        r1, _, e1 := Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
171
 
        if int(r1) == 0 {
 
183
        if r1 == 0 {
172
184
                if e1 != 0 {
173
185
                        err = error(e1)
174
186
                } else {
179
191
}
180
192
 
181
193
func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
182
 
        r0, _, e1 := Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0)
 
194
        var _p0 *byte
 
195
        _p0, err = BytePtrFromString(procname)
 
196
        if err != nil {
 
197
                return
 
198
        }
 
199
        r0, _, e1 := Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(_p0)), 0)
183
200
        proc = uintptr(r0)
184
201
        if proc == 0 {
185
202
                if e1 != 0 {
245
262
                _p0 = &buf[0]
246
263
        }
247
264
        r1, _, e1 := Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
248
 
        if int(r1) == 0 {
 
265
        if r1 == 0 {
249
266
                if e1 != 0 {
250
267
                        err = error(e1)
251
268
                } else {
261
278
                _p0 = &buf[0]
262
279
        }
263
280
        r1, _, e1 := Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
264
 
        if int(r1) == 0 {
 
281
        if r1 == 0 {
265
282
                if e1 != 0 {
266
283
                        err = error(e1)
267
284
                } else {
286
303
 
287
304
func CloseHandle(handle Handle) (err error) {
288
305
        r1, _, e1 := Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
289
 
        if int(r1) == 0 {
 
306
        if r1 == 0 {
290
307
                if e1 != 0 {
291
308
                        err = error(e1)
292
309
                } else {
324
341
 
325
342
func findNextFile1(handle Handle, data *win32finddata1) (err error) {
326
343
        r1, _, e1 := Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
327
 
        if int(r1) == 0 {
 
344
        if r1 == 0 {
328
345
                if e1 != 0 {
329
346
                        err = error(e1)
330
347
                } else {
336
353
 
337
354
func FindClose(handle Handle) (err error) {
338
355
        r1, _, e1 := Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
339
 
        if int(r1) == 0 {
 
356
        if r1 == 0 {
340
357
                if e1 != 0 {
341
358
                        err = error(e1)
342
359
                } else {
348
365
 
349
366
func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
350
367
        r1, _, e1 := Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
351
 
        if int(r1) == 0 {
 
368
        if r1 == 0 {
352
369
                if e1 != 0 {
353
370
                        err = error(e1)
354
371
                } else {
373
390
 
374
391
func SetCurrentDirectory(path *uint16) (err error) {
375
392
        r1, _, e1 := Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
376
 
        if int(r1) == 0 {
 
393
        if r1 == 0 {
377
394
                if e1 != 0 {
378
395
                        err = error(e1)
379
396
                } else {
385
402
 
386
403
func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
387
404
        r1, _, e1 := Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
388
 
        if int(r1) == 0 {
 
405
        if r1 == 0 {
389
406
                if e1 != 0 {
390
407
                        err = error(e1)
391
408
                } else {
397
414
 
398
415
func RemoveDirectory(path *uint16) (err error) {
399
416
        r1, _, e1 := Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
400
 
        if int(r1) == 0 {
 
417
        if r1 == 0 {
401
418
                if e1 != 0 {
402
419
                        err = error(e1)
403
420
                } else {
409
426
 
410
427
func DeleteFile(path *uint16) (err error) {
411
428
        r1, _, e1 := Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
412
 
        if int(r1) == 0 {
 
429
        if r1 == 0 {
413
430
                if e1 != 0 {
414
431
                        err = error(e1)
415
432
                } else {
421
438
 
422
439
func MoveFile(from *uint16, to *uint16) (err error) {
423
440
        r1, _, e1 := Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
424
 
        if int(r1) == 0 {
 
441
        if r1 == 0 {
425
442
                if e1 != 0 {
426
443
                        err = error(e1)
427
444
                } else {
433
450
 
434
451
func GetComputerName(buf *uint16, n *uint32) (err error) {
435
452
        r1, _, e1 := Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
436
 
        if int(r1) == 0 {
 
453
        if r1 == 0 {
437
454
                if e1 != 0 {
438
455
                        err = error(e1)
439
456
                } else {
445
462
 
446
463
func SetEndOfFile(handle Handle) (err error) {
447
464
        r1, _, e1 := Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
448
 
        if int(r1) == 0 {
 
465
        if r1 == 0 {
449
466
                if e1 != 0 {
450
467
                        err = error(e1)
451
468
                } else {
488
505
 
489
506
func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
490
507
        r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
491
 
        if int(r1) == 0 {
 
508
        if r1 == 0 {
492
509
                if e1 != 0 {
493
510
                        err = error(e1)
494
511
                } else {
500
517
 
501
518
func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
502
519
        r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
503
 
        if int(r1) == 0 {
 
520
        if r1 == 0 {
504
521
                if e1 != 0 {
505
522
                        err = error(e1)
506
523
                } else {
512
529
 
513
530
func CancelIo(s Handle) (err error) {
514
531
        r1, _, e1 := Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
515
 
        if int(r1) == 0 {
 
532
        if r1 == 0 {
 
533
                if e1 != 0 {
 
534
                        err = error(e1)
 
535
                } else {
 
536
                        err = EINVAL
 
537
                }
 
538
        }
 
539
        return
 
540
}
 
541
 
 
542
func CancelIoEx(s Handle, o *Overlapped) (err error) {
 
543
        r1, _, e1 := Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
 
544
        if r1 == 0 {
516
545
                if e1 != 0 {
517
546
                        err = error(e1)
518
547
                } else {
530
559
                _p0 = 0
531
560
        }
532
561
        r1, _, e1 := Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0)
533
 
        if int(r1) == 0 {
 
562
        if r1 == 0 {
534
563
                if e1 != 0 {
535
564
                        err = error(e1)
536
565
                } else {
561
590
 
562
591
func TerminateProcess(handle Handle, exitcode uint32) (err error) {
563
592
        r1, _, e1 := Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
564
 
        if int(r1) == 0 {
 
593
        if r1 == 0 {
565
594
                if e1 != 0 {
566
595
                        err = error(e1)
567
596
                } else {
573
602
 
574
603
func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
575
604
        r1, _, e1 := Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
576
 
        if int(r1) == 0 {
 
605
        if r1 == 0 {
577
606
                if e1 != 0 {
578
607
                        err = error(e1)
579
608
                } else {
585
614
 
586
615
func GetStartupInfo(startupInfo *StartupInfo) (err error) {
587
616
        r1, _, e1 := Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
588
 
        if int(r1) == 0 {
 
617
        if r1 == 0 {
589
618
                if e1 != 0 {
590
619
                        err = error(e1)
591
620
                } else {
610
639
 
611
640
func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
612
641
        r1, _, e1 := Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
613
 
        if int(r1) == 0 {
 
642
        if r1 == 0 {
614
643
                if e1 != 0 {
615
644
                        err = error(e1)
616
645
                } else {
628
657
                _p0 = 0
629
658
        }
630
659
        r1, _, e1 := Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
631
 
        if int(r1) == 0 {
 
660
        if r1 == 0 {
632
661
                if e1 != 0 {
633
662
                        err = error(e1)
634
663
                } else {
666
695
 
667
696
func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
668
697
        r1, _, e1 := Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
669
 
        if int(r1) == 0 {
 
698
        if r1 == 0 {
670
699
                if e1 != 0 {
671
700
                        err = error(e1)
672
701
                } else {
691
720
 
692
721
func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
693
722
        r1, _, e1 := Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
694
 
        if int(r1) == 0 {
 
723
        if r1 == 0 {
695
724
                if e1 != 0 {
696
725
                        err = error(e1)
697
726
                } else {
703
732
 
704
733
func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
705
734
        r1, _, e1 := Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
706
 
        if int(r1) == 0 {
 
735
        if r1 == 0 {
707
736
                if e1 != 0 {
708
737
                        err = error(e1)
709
738
                } else {
715
744
 
716
745
func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
717
746
        r1, _, e1 := Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
718
 
        if int(r1) == 0 {
 
747
        if r1 == 0 {
719
748
                if e1 != 0 {
720
749
                        err = error(e1)
721
750
                } else {
740
769
 
741
770
func FreeEnvironmentStrings(envs *uint16) (err error) {
742
771
        r1, _, e1 := Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
743
 
        if int(r1) == 0 {
 
772
        if r1 == 0 {
744
773
                if e1 != 0 {
745
774
                        err = error(e1)
746
775
                } else {
765
794
 
766
795
func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
767
796
        r1, _, e1 := Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
768
 
        if int(r1) == 0 {
 
797
        if r1 == 0 {
769
798
                if e1 != 0 {
770
799
                        err = error(e1)
771
800
                } else {
777
806
 
778
807
func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
779
808
        r1, _, e1 := Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
780
 
        if int(r1) == 0 {
 
809
        if r1 == 0 {
781
810
                if e1 != 0 {
782
811
                        err = error(e1)
783
812
                } else {
802
831
 
803
832
func SetFileAttributes(name *uint16, attrs uint32) (err error) {
804
833
        r1, _, e1 := Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
805
 
        if int(r1) == 0 {
 
834
        if r1 == 0 {
806
835
                if e1 != 0 {
807
836
                        err = error(e1)
808
837
                } else {
814
843
 
815
844
func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
816
845
        r1, _, e1 := Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
817
 
        if int(r1) == 0 {
 
846
        if r1 == 0 {
818
847
                if e1 != 0 {
819
848
                        err = error(e1)
820
849
                } else {
858
887
 
859
888
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
860
889
        r1, _, e1 := Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
861
 
        if int(r1) == 0 {
 
890
        if r1 == 0 {
862
891
                if e1 != 0 {
863
892
                        err = error(e1)
864
893
                } else {
870
899
 
871
900
func FlushFileBuffers(handle Handle) (err error) {
872
901
        r1, _, e1 := Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
873
 
        if int(r1) == 0 {
 
902
        if r1 == 0 {
874
903
                if e1 != 0 {
875
904
                        err = error(e1)
876
905
                } else {
947
976
 
948
977
func UnmapViewOfFile(addr uintptr) (err error) {
949
978
        r1, _, e1 := Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
950
 
        if int(r1) == 0 {
 
979
        if r1 == 0 {
951
980
                if e1 != 0 {
952
981
                        err = error(e1)
953
982
                } else {
959
988
 
960
989
func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
961
990
        r1, _, e1 := Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
962
 
        if int(r1) == 0 {
 
991
        if r1 == 0 {
963
992
                if e1 != 0 {
964
993
                        err = error(e1)
965
994
                } else {
971
1000
 
972
1001
func VirtualLock(addr uintptr, length uintptr) (err error) {
973
1002
        r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
974
 
        if int(r1) == 0 {
 
1003
        if r1 == 0 {
975
1004
                if e1 != 0 {
976
1005
                        err = error(e1)
977
1006
                } else {
983
1012
 
984
1013
func VirtualUnlock(addr uintptr, length uintptr) (err error) {
985
1014
        r1, _, e1 := Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
986
 
        if int(r1) == 0 {
 
1015
        if r1 == 0 {
987
1016
                if e1 != 0 {
988
1017
                        err = error(e1)
989
1018
                } else {
995
1024
 
996
1025
func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
997
1026
        r1, _, e1 := Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0)
998
 
        if int(r1) == 0 {
 
1027
        if r1 == 0 {
999
1028
                if e1 != 0 {
1000
1029
                        err = error(e1)
1001
1030
                } else {
1013
1042
                _p0 = 0
1014
1043
        }
1015
1044
        r1, _, e1 := Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0)
1016
 
        if int(r1) == 0 {
 
1045
        if r1 == 0 {
1017
1046
                if e1 != 0 {
1018
1047
                        err = error(e1)
1019
1048
                } else {
1064
1093
 
1065
1094
func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
1066
1095
        r1, _, e1 := Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
1067
 
        if int(r1) == 0 {
 
1096
        if r1 == 0 {
1068
1097
                if e1 != 0 {
1069
1098
                        err = error(e1)
1070
1099
                } else {
1076
1105
 
1077
1106
func CertCloseStore(store Handle, flags uint32) (err error) {
1078
1107
        r1, _, e1 := Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
1079
 
        if int(r1) == 0 {
 
1108
        if r1 == 0 {
1080
1109
                if e1 != 0 {
1081
1110
                        err = error(e1)
1082
1111
                } else {
1088
1117
 
1089
1118
func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
1090
1119
        r1, _, e1 := Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0)
1091
 
        if int(r1) == 0 {
 
1120
        if r1 == 0 {
1092
1121
                if e1 != 0 {
1093
1122
                        err = error(e1)
1094
1123
                } else {
1118
1147
 
1119
1148
func CertFreeCertificateContext(ctx *CertContext) (err error) {
1120
1149
        r1, _, e1 := Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
1121
 
        if int(r1) == 0 {
 
1150
        if r1 == 0 {
1122
1151
                if e1 != 0 {
1123
1152
                        err = error(e1)
1124
1153
                } else {
1130
1159
 
1131
1160
func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
1132
1161
        r1, _, e1 := Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
1133
 
        if int(r1) == 0 {
 
1162
        if r1 == 0 {
1134
1163
                if e1 != 0 {
1135
1164
                        err = error(e1)
1136
1165
                } else {
1180
1209
        return
1181
1210
}
1182
1211
 
 
1212
func getCurrentProcessId() (pid uint32) {
 
1213
        r0, _, _ := Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
 
1214
        pid = uint32(r0)
 
1215
        return
 
1216
}
 
1217
 
 
1218
func GetConsoleMode(console Handle, mode *uint32) (err error) {
 
1219
        r1, _, e1 := Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
 
1220
        if r1 == 0 {
 
1221
                if e1 != 0 {
 
1222
                        err = error(e1)
 
1223
                } else {
 
1224
                        err = EINVAL
 
1225
                }
 
1226
        }
 
1227
        return
 
1228
}
 
1229
 
 
1230
func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
 
1231
        r1, _, e1 := Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
 
1232
        if r1 == 0 {
 
1233
                if e1 != 0 {
 
1234
                        err = error(e1)
 
1235
                } else {
 
1236
                        err = EINVAL
 
1237
                }
 
1238
        }
 
1239
        return
 
1240
}
 
1241
 
 
1242
func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
 
1243
        r1, _, e1 := Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
 
1244
        if r1 == 0 {
 
1245
                if e1 != 0 {
 
1246
                        err = error(e1)
 
1247
                } else {
 
1248
                        err = EINVAL
 
1249
                }
 
1250
        }
 
1251
        return
 
1252
}
 
1253
 
1183
1254
func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
1184
1255
        r0, _, _ := Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
1185
1256
        if r0 != 0 {
1190
1261
 
1191
1262
func WSACleanup() (err error) {
1192
1263
        r1, _, e1 := Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
1193
 
        if int(r1) == -1 {
 
1264
        if r1 == socket_error {
1194
1265
                if e1 != 0 {
1195
1266
                        err = error(e1)
1196
1267
                } else {
1202
1273
 
1203
1274
func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
1204
1275
        r1, _, e1 := Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine))
1205
 
        if int(r1) == -1 {
 
1276
        if r1 == socket_error {
1206
1277
                if e1 != 0 {
1207
1278
                        err = error(e1)
1208
1279
                } else {
1227
1298
 
1228
1299
func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
1229
1300
        r1, _, e1 := Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
1230
 
        if int(r1) == -1 {
 
1301
        if r1 == socket_error {
 
1302
                if e1 != 0 {
 
1303
                        err = error(e1)
 
1304
                } else {
 
1305
                        err = EINVAL
 
1306
                }
 
1307
        }
 
1308
        return
 
1309
}
 
1310
 
 
1311
func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
 
1312
        r1, _, e1 := Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
 
1313
        if r1 == socket_error {
1231
1314
                if e1 != 0 {
1232
1315
                        err = error(e1)
1233
1316
                } else {
1239
1322
 
1240
1323
func bind(s Handle, name uintptr, namelen int32) (err error) {
1241
1324
        r1, _, e1 := Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
1242
 
        if int(r1) == -1 {
 
1325
        if r1 == socket_error {
1243
1326
                if e1 != 0 {
1244
1327
                        err = error(e1)
1245
1328
                } else {
1251
1334
 
1252
1335
func connect(s Handle, name uintptr, namelen int32) (err error) {
1253
1336
        r1, _, e1 := Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
1254
 
        if int(r1) == -1 {
 
1337
        if r1 == socket_error {
1255
1338
                if e1 != 0 {
1256
1339
                        err = error(e1)
1257
1340
                } else {
1263
1346
 
1264
1347
func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
1265
1348
        r1, _, e1 := Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1266
 
        if int(r1) == -1 {
 
1349
        if r1 == socket_error {
1267
1350
                if e1 != 0 {
1268
1351
                        err = error(e1)
1269
1352
                } else {
1275
1358
 
1276
1359
func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
1277
1360
        r1, _, e1 := Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1278
 
        if int(r1) == -1 {
 
1361
        if r1 == socket_error {
1279
1362
                if e1 != 0 {
1280
1363
                        err = error(e1)
1281
1364
                } else {
1287
1370
 
1288
1371
func listen(s Handle, backlog int32) (err error) {
1289
1372
        r1, _, e1 := Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
1290
 
        if int(r1) == -1 {
 
1373
        if r1 == socket_error {
1291
1374
                if e1 != 0 {
1292
1375
                        err = error(e1)
1293
1376
                } else {
1299
1382
 
1300
1383
func shutdown(s Handle, how int32) (err error) {
1301
1384
        r1, _, e1 := Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
1302
 
        if int(r1) == -1 {
 
1385
        if r1 == socket_error {
1303
1386
                if e1 != 0 {
1304
1387
                        err = error(e1)
1305
1388
                } else {
1311
1394
 
1312
1395
func Closesocket(s Handle) (err error) {
1313
1396
        r1, _, e1 := Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
1314
 
        if int(r1) == -1 {
 
1397
        if r1 == socket_error {
1315
1398
                if e1 != 0 {
1316
1399
                        err = error(e1)
1317
1400
                } else {
1323
1406
 
1324
1407
func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
1325
1408
        r1, _, e1 := Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0)
1326
 
        if int(r1) == 0 {
 
1409
        if r1 == 0 {
1327
1410
                if e1 != 0 {
1328
1411
                        err = error(e1)
1329
1412
                } else {
1340
1423
 
1341
1424
func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
1342
1425
        r1, _, e1 := Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
1343
 
        if int(r1) == -1 {
 
1426
        if r1 == socket_error {
1344
1427
                if e1 != 0 {
1345
1428
                        err = error(e1)
1346
1429
                } else {
1352
1435
 
1353
1436
func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
1354
1437
        r1, _, e1 := Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
1355
 
        if int(r1) == -1 {
 
1438
        if r1 == socket_error {
1356
1439
                if e1 != 0 {
1357
1440
                        err = error(e1)
1358
1441
                } else {
1364
1447
 
1365
1448
func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
1366
1449
        r1, _, e1 := Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
1367
 
        if int(r1) == -1 {
 
1450
        if r1 == socket_error {
1368
1451
                if e1 != 0 {
1369
1452
                        err = error(e1)
1370
1453
                } else {
1376
1459
 
1377
1460
func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
1378
1461
        r1, _, e1 := Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
1379
 
        if int(r1) == -1 {
 
1462
        if r1 == socket_error {
1380
1463
                if e1 != 0 {
1381
1464
                        err = error(e1)
1382
1465
                } else {
1387
1470
}
1388
1471
 
1389
1472
func GetHostByName(name string) (h *Hostent, err error) {
1390
 
        r0, _, e1 := Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(StringBytePtr(name))), 0, 0)
 
1473
        var _p0 *byte
 
1474
        _p0, err = BytePtrFromString(name)
 
1475
        if err != nil {
 
1476
                return
 
1477
        }
 
1478
        r0, _, e1 := Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0)
1391
1479
        h = (*Hostent)(unsafe.Pointer(r0))
1392
1480
        if h == nil {
1393
1481
                if e1 != 0 {
1400
1488
}
1401
1489
 
1402
1490
func GetServByName(name string, proto string) (s *Servent, err error) {
1403
 
        r0, _, e1 := Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(StringBytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(proto))), 0)
 
1491
        var _p0 *byte
 
1492
        _p0, err = BytePtrFromString(name)
 
1493
        if err != nil {
 
1494
                return
 
1495
        }
 
1496
        var _p1 *byte
 
1497
        _p1, err = BytePtrFromString(proto)
 
1498
        if err != nil {
 
1499
                return
 
1500
        }
 
1501
        r0, _, e1 := Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1404
1502
        s = (*Servent)(unsafe.Pointer(r0))
1405
1503
        if s == nil {
1406
1504
                if e1 != 0 {
1419
1517
}
1420
1518
 
1421
1519
func GetProtoByName(name string) (p *Protoent, err error) {
1422
 
        r0, _, e1 := Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(StringBytePtr(name))), 0, 0)
 
1520
        var _p0 *byte
 
1521
        _p0, err = BytePtrFromString(name)
 
1522
        if err != nil {
 
1523
                return
 
1524
        }
 
1525
        r0, _, e1 := Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0)
1423
1526
        p = (*Protoent)(unsafe.Pointer(r0))
1424
1527
        if p == nil {
1425
1528
                if e1 != 0 {
1432
1535
}
1433
1536
 
1434
1537
func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
1435
 
        r0, _, _ := Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(StringToUTF16Ptr(name))), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
 
1538
        var _p0 *uint16
 
1539
        _p0, status = UTF16PtrFromString(name)
 
1540
        if status != nil {
 
1541
                return
 
1542
        }
 
1543
        r0, _, _ := Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(_p0)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
1436
1544
        if r0 != 0 {
1437
1545
                status = Errno(r0)
1438
1546
        }
1444
1552
        return
1445
1553
}
1446
1554
 
 
1555
func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
 
1556
        r0, _, _ := Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
 
1557
        if r0 != 0 {
 
1558
                sockerr = Errno(r0)
 
1559
        }
 
1560
        return
 
1561
}
 
1562
 
 
1563
func FreeAddrInfoW(addrinfo *AddrinfoW) {
 
1564
        Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
 
1565
        return
 
1566
}
 
1567
 
1447
1568
func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
1448
1569
        r0, _, _ := Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
1449
1570
        if r0 != 0 {
1462
1583
 
1463
1584
func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
1464
1585
        r1, _, e1 := Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
1465
 
        if int(r1)&0xff == 0 {
 
1586
        if r1&0xff == 0 {
1466
1587
                if e1 != 0 {
1467
1588
                        err = error(e1)
1468
1589
                } else {
1474
1595
 
1475
1596
func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
1476
1597
        r1, _, e1 := Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
1477
 
        if int(r1)&0xff == 0 {
 
1598
        if r1&0xff == 0 {
1478
1599
                if e1 != 0 {
1479
1600
                        err = error(e1)
1480
1601
                } else {
1502
1623
 
1503
1624
func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
1504
1625
        r1, _, e1 := Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
1505
 
        if int(r1) == 0 {
 
1626
        if r1 == 0 {
1506
1627
                if e1 != 0 {
1507
1628
                        err = error(e1)
1508
1629
                } else {
1514
1635
 
1515
1636
func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
1516
1637
        r1, _, e1 := Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
1517
 
        if int(r1) == 0 {
 
1638
        if r1 == 0 {
1518
1639
                if e1 != 0 {
1519
1640
                        err = error(e1)
1520
1641
                } else {
1526
1647
 
1527
1648
func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
1528
1649
        r1, _, e1 := Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
1529
 
        if int(r1) == 0 {
 
1650
        if r1 == 0 {
1530
1651
                if e1 != 0 {
1531
1652
                        err = error(e1)
1532
1653
                } else {
1538
1659
 
1539
1660
func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
1540
1661
        r1, _, e1 := Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
1541
 
        if int(r1) == 0 {
 
1662
        if r1 == 0 {
1542
1663
                if e1 != 0 {
1543
1664
                        err = error(e1)
1544
1665
                } else {
1556
1677
 
1557
1678
func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
1558
1679
        r1, _, e1 := Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
1559
 
        if int(r1) == 0 {
 
1680
        if r1 == 0 {
1560
1681
                if e1 != 0 {
1561
1682
                        err = error(e1)
1562
1683
                } else {
1568
1689
 
1569
1690
func OpenProcessToken(h Handle, access uint32, token *Token) (err error) {
1570
1691
        r1, _, e1 := Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token)))
1571
 
        if int(r1) == 0 {
 
1692
        if r1 == 0 {
1572
1693
                if e1 != 0 {
1573
1694
                        err = error(e1)
1574
1695
                } else {
1580
1701
 
1581
1702
func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
1582
1703
        r1, _, e1 := Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
1583
 
        if int(r1) == 0 {
 
1704
        if r1 == 0 {
1584
1705
                if e1 != 0 {
1585
1706
                        err = error(e1)
1586
1707
                } else {
1592
1713
 
1593
1714
func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
1594
1715
        r1, _, e1 := Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
1595
 
        if int(r1) == 0 {
 
1716
        if r1 == 0 {
1596
1717
                if e1 != 0 {
1597
1718
                        err = error(e1)
1598
1719
                } else {
1601
1722
        }
1602
1723
        return
1603
1724
}
1604
 
 
1605
 
func getCurrentProcessId() (pid uint32) {
1606
 
        r0, _, _ := Syscall(procgetCurrentProcessId.Addr(), 0, 0, 0, 0)
1607
 
        pid = uint32(r0)
1608
 
        return
1609
 
}