Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
3153395e
Commit
3153395e
authored
Oct 14, 2011
by
Mikkel Krautz
Committed by
Russ Cox
Oct 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypto/tls: fetch root CA from Windows store
R=rsc CC=golang-dev
https://golang.org/cl/5281044
parent
812249fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
329 additions
and
185 deletions
+329
-185
Makefile
src/pkg/crypto/tls/Makefile
+1
-1
root_windows.go
src/pkg/crypto/tls/root_windows.go
+55
-0
syscall_windows.go
src/pkg/syscall/syscall_windows.go
+3
-0
zsyscall_windows_386.go
src/pkg/syscall/zsyscall_windows_386.go
+131
-92
zsyscall_windows_amd64.go
src/pkg/syscall/zsyscall_windows_amd64.go
+131
-92
ztypes_windows.go
src/pkg/syscall/ztypes_windows.go
+8
-0
No files found.
src/pkg/crypto/tls/Makefile
View file @
3153395e
...
@@ -28,7 +28,7 @@ GOFILES_freebsd+=root_unix.go
...
@@ -28,7 +28,7 @@ GOFILES_freebsd+=root_unix.go
GOFILES_linux
+=
root_unix.go
GOFILES_linux
+=
root_unix.go
GOFILES_openbsd
+=
root_unix.go
GOFILES_openbsd
+=
root_unix.go
GOFILES_plan9
+=
root_stub.go
GOFILES_plan9
+=
root_stub.go
GOFILES_windows
+=
root_
stub
.go
GOFILES_windows
+=
root_
windows
.go
GOFILES
+=
$
(
GOFILES_
$(GOOS)
)
GOFILES
+=
$
(
GOFILES_
$(GOOS)
)
ifneq
($(CGOFILES_$(GOOS)),)
ifneq
($(CGOFILES_$(GOOS)),)
...
...
src/pkg/crypto/tls/root_windows.go
0 → 100644
View file @
3153395e
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
tls
import
(
"crypto/x509"
"reflect"
"syscall"
"unsafe"
)
func
loadStore
(
roots
*
x509
.
CertPool
,
name
string
)
{
store
,
errno
:=
syscall
.
CertOpenSystemStore
(
syscall
.
InvalidHandle
,
syscall
.
StringToUTF16Ptr
(
name
))
if
errno
!=
0
{
return
}
var
prev
*
syscall
.
CertContext
for
{
cur
:=
syscall
.
CertEnumCertificatesInStore
(
store
,
prev
)
if
cur
==
nil
{
break
}
var
buf
[]
byte
hdrp
:=
(
*
reflect
.
SliceHeader
)(
unsafe
.
Pointer
(
&
buf
))
hdrp
.
Data
=
cur
.
EncodedCert
hdrp
.
Len
=
int
(
cur
.
Length
)
hdrp
.
Cap
=
int
(
cur
.
Length
)
cert
,
err
:=
x509
.
ParseCertificate
(
buf
)
if
err
!=
nil
{
continue
}
roots
.
AddCert
(
cert
)
prev
=
cur
}
syscall
.
CertCloseStore
(
store
,
0
)
}
func
initDefaultRoots
()
{
roots
:=
x509
.
NewCertPool
()
// Roots
loadStore
(
roots
,
"ROOT"
)
// Intermediates
loadStore
(
roots
,
"CA"
)
varDefaultRoots
=
roots
}
src/pkg/syscall/syscall_windows.go
View file @
3153395e
...
@@ -221,6 +221,9 @@ func NewCallback(fn interface{}) uintptr
...
@@ -221,6 +221,9 @@ func NewCallback(fn interface{}) uintptr
//sys VirtualLock(addr uintptr, length uintptr) (errno int)
//sys VirtualLock(addr uintptr, length uintptr) (errno int)
//sys VirtualUnlock(addr uintptr, length uintptr) (errno int)
//sys VirtualUnlock(addr uintptr, length uintptr) (errno int)
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) = mswsock.TransmitFile
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) = mswsock.TransmitFile
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, errno int) = crypt32.CertOpenSystemStoreW
//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext) = crypt32.CertEnumCertificatesInStore
//sys CertCloseStore(store Handle, flags uint32) (errno int) = crypt32.CertCloseStore
// syscall interface implementation for other packages
// syscall interface implementation for other packages
...
...
src/pkg/syscall/zsyscall_windows_386.go
View file @
3153395e
...
@@ -10,102 +10,106 @@ var (
...
@@ -10,102 +10,106 @@ var (
modadvapi32
=
NewLazyDLL
(
"advapi32.dll"
)
modadvapi32
=
NewLazyDLL
(
"advapi32.dll"
)
modshell32
=
NewLazyDLL
(
"shell32.dll"
)
modshell32
=
NewLazyDLL
(
"shell32.dll"
)
modmswsock
=
NewLazyDLL
(
"mswsock.dll"
)
modmswsock
=
NewLazyDLL
(
"mswsock.dll"
)
modcrypt32
=
NewLazyDLL
(
"crypt32.dll"
)
modws2_32
=
NewLazyDLL
(
"ws2_32.dll"
)
modws2_32
=
NewLazyDLL
(
"ws2_32.dll"
)
moddnsapi
=
NewLazyDLL
(
"dnsapi.dll"
)
moddnsapi
=
NewLazyDLL
(
"dnsapi.dll"
)
modiphlpapi
=
NewLazyDLL
(
"iphlpapi.dll"
)
modiphlpapi
=
NewLazyDLL
(
"iphlpapi.dll"
)
procGetLastError
=
modkernel32
.
NewProc
(
"GetLastError"
)
procGetLastError
=
modkernel32
.
NewProc
(
"GetLastError"
)
procLoadLibraryW
=
modkernel32
.
NewProc
(
"LoadLibraryW"
)
procLoadLibraryW
=
modkernel32
.
NewProc
(
"LoadLibraryW"
)
procFreeLibrary
=
modkernel32
.
NewProc
(
"FreeLibrary"
)
procFreeLibrary
=
modkernel32
.
NewProc
(
"FreeLibrary"
)
procGetProcAddress
=
modkernel32
.
NewProc
(
"GetProcAddress"
)
procGetProcAddress
=
modkernel32
.
NewProc
(
"GetProcAddress"
)
procGetVersion
=
modkernel32
.
NewProc
(
"GetVersion"
)
procGetVersion
=
modkernel32
.
NewProc
(
"GetVersion"
)
procFormatMessageW
=
modkernel32
.
NewProc
(
"FormatMessageW"
)
procFormatMessageW
=
modkernel32
.
NewProc
(
"FormatMessageW"
)
procExitProcess
=
modkernel32
.
NewProc
(
"ExitProcess"
)
procExitProcess
=
modkernel32
.
NewProc
(
"ExitProcess"
)
procCreateFileW
=
modkernel32
.
NewProc
(
"CreateFileW"
)
procCreateFileW
=
modkernel32
.
NewProc
(
"CreateFileW"
)
procReadFile
=
modkernel32
.
NewProc
(
"ReadFile"
)
procReadFile
=
modkernel32
.
NewProc
(
"ReadFile"
)
procWriteFile
=
modkernel32
.
NewProc
(
"WriteFile"
)
procWriteFile
=
modkernel32
.
NewProc
(
"WriteFile"
)
procSetFilePointer
=
modkernel32
.
NewProc
(
"SetFilePointer"
)
procSetFilePointer
=
modkernel32
.
NewProc
(
"SetFilePointer"
)
procCloseHandle
=
modkernel32
.
NewProc
(
"CloseHandle"
)
procCloseHandle
=
modkernel32
.
NewProc
(
"CloseHandle"
)
procGetStdHandle
=
modkernel32
.
NewProc
(
"GetStdHandle"
)
procGetStdHandle
=
modkernel32
.
NewProc
(
"GetStdHandle"
)
procFindFirstFileW
=
modkernel32
.
NewProc
(
"FindFirstFileW"
)
procFindFirstFileW
=
modkernel32
.
NewProc
(
"FindFirstFileW"
)
procFindNextFileW
=
modkernel32
.
NewProc
(
"FindNextFileW"
)
procFindNextFileW
=
modkernel32
.
NewProc
(
"FindNextFileW"
)
procFindClose
=
modkernel32
.
NewProc
(
"FindClose"
)
procFindClose
=
modkernel32
.
NewProc
(
"FindClose"
)
procGetFileInformationByHandle
=
modkernel32
.
NewProc
(
"GetFileInformationByHandle"
)
procGetFileInformationByHandle
=
modkernel32
.
NewProc
(
"GetFileInformationByHandle"
)
procGetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"GetCurrentDirectoryW"
)
procGetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"GetCurrentDirectoryW"
)
procSetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"SetCurrentDirectoryW"
)
procSetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"SetCurrentDirectoryW"
)
procCreateDirectoryW
=
modkernel32
.
NewProc
(
"CreateDirectoryW"
)
procCreateDirectoryW
=
modkernel32
.
NewProc
(
"CreateDirectoryW"
)
procRemoveDirectoryW
=
modkernel32
.
NewProc
(
"RemoveDirectoryW"
)
procRemoveDirectoryW
=
modkernel32
.
NewProc
(
"RemoveDirectoryW"
)
procDeleteFileW
=
modkernel32
.
NewProc
(
"DeleteFileW"
)
procDeleteFileW
=
modkernel32
.
NewProc
(
"DeleteFileW"
)
procMoveFileW
=
modkernel32
.
NewProc
(
"MoveFileW"
)
procMoveFileW
=
modkernel32
.
NewProc
(
"MoveFileW"
)
procGetComputerNameW
=
modkernel32
.
NewProc
(
"GetComputerNameW"
)
procGetComputerNameW
=
modkernel32
.
NewProc
(
"GetComputerNameW"
)
procSetEndOfFile
=
modkernel32
.
NewProc
(
"SetEndOfFile"
)
procSetEndOfFile
=
modkernel32
.
NewProc
(
"SetEndOfFile"
)
procGetSystemTimeAsFileTime
=
modkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procGetSystemTimeAsFileTime
=
modkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procSleep
=
modkernel32
.
NewProc
(
"Sleep"
)
procSleep
=
modkernel32
.
NewProc
(
"Sleep"
)
procGetTimeZoneInformation
=
modkernel32
.
NewProc
(
"GetTimeZoneInformation"
)
procGetTimeZoneInformation
=
modkernel32
.
NewProc
(
"GetTimeZoneInformation"
)
procCreateIoCompletionPort
=
modkernel32
.
NewProc
(
"CreateIoCompletionPort"
)
procCreateIoCompletionPort
=
modkernel32
.
NewProc
(
"CreateIoCompletionPort"
)
procGetQueuedCompletionStatus
=
modkernel32
.
NewProc
(
"GetQueuedCompletionStatus"
)
procGetQueuedCompletionStatus
=
modkernel32
.
NewProc
(
"GetQueuedCompletionStatus"
)
procCancelIo
=
modkernel32
.
NewProc
(
"CancelIo"
)
procCancelIo
=
modkernel32
.
NewProc
(
"CancelIo"
)
procCreateProcessW
=
modkernel32
.
NewProc
(
"CreateProcessW"
)
procCreateProcessW
=
modkernel32
.
NewProc
(
"CreateProcessW"
)
procOpenProcess
=
modkernel32
.
NewProc
(
"OpenProcess"
)
procOpenProcess
=
modkernel32
.
NewProc
(
"OpenProcess"
)
procTerminateProcess
=
modkernel32
.
NewProc
(
"TerminateProcess"
)
procTerminateProcess
=
modkernel32
.
NewProc
(
"TerminateProcess"
)
procGetExitCodeProcess
=
modkernel32
.
NewProc
(
"GetExitCodeProcess"
)
procGetExitCodeProcess
=
modkernel32
.
NewProc
(
"GetExitCodeProcess"
)
procGetStartupInfoW
=
modkernel32
.
NewProc
(
"GetStartupInfoW"
)
procGetStartupInfoW
=
modkernel32
.
NewProc
(
"GetStartupInfoW"
)
procGetCurrentProcess
=
modkernel32
.
NewProc
(
"GetCurrentProcess"
)
procGetCurrentProcess
=
modkernel32
.
NewProc
(
"GetCurrentProcess"
)
procDuplicateHandle
=
modkernel32
.
NewProc
(
"DuplicateHandle"
)
procDuplicateHandle
=
modkernel32
.
NewProc
(
"DuplicateHandle"
)
procWaitForSingleObject
=
modkernel32
.
NewProc
(
"WaitForSingleObject"
)
procWaitForSingleObject
=
modkernel32
.
NewProc
(
"WaitForSingleObject"
)
procGetTempPathW
=
modkernel32
.
NewProc
(
"GetTempPathW"
)
procGetTempPathW
=
modkernel32
.
NewProc
(
"GetTempPathW"
)
procCreatePipe
=
modkernel32
.
NewProc
(
"CreatePipe"
)
procCreatePipe
=
modkernel32
.
NewProc
(
"CreatePipe"
)
procGetFileType
=
modkernel32
.
NewProc
(
"GetFileType"
)
procGetFileType
=
modkernel32
.
NewProc
(
"GetFileType"
)
procCryptAcquireContextW
=
modadvapi32
.
NewProc
(
"CryptAcquireContextW"
)
procCryptAcquireContextW
=
modadvapi32
.
NewProc
(
"CryptAcquireContextW"
)
procCryptReleaseContext
=
modadvapi32
.
NewProc
(
"CryptReleaseContext"
)
procCryptReleaseContext
=
modadvapi32
.
NewProc
(
"CryptReleaseContext"
)
procCryptGenRandom
=
modadvapi32
.
NewProc
(
"CryptGenRandom"
)
procCryptGenRandom
=
modadvapi32
.
NewProc
(
"CryptGenRandom"
)
procGetEnvironmentStringsW
=
modkernel32
.
NewProc
(
"GetEnvironmentStringsW"
)
procGetEnvironmentStringsW
=
modkernel32
.
NewProc
(
"GetEnvironmentStringsW"
)
procFreeEnvironmentStringsW
=
modkernel32
.
NewProc
(
"FreeEnvironmentStringsW"
)
procFreeEnvironmentStringsW
=
modkernel32
.
NewProc
(
"FreeEnvironmentStringsW"
)
procGetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"GetEnvironmentVariableW"
)
procGetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"GetEnvironmentVariableW"
)
procSetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"SetEnvironmentVariableW"
)
procSetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"SetEnvironmentVariableW"
)
procSetFileTime
=
modkernel32
.
NewProc
(
"SetFileTime"
)
procSetFileTime
=
modkernel32
.
NewProc
(
"SetFileTime"
)
procGetFileAttributesW
=
modkernel32
.
NewProc
(
"GetFileAttributesW"
)
procGetFileAttributesW
=
modkernel32
.
NewProc
(
"GetFileAttributesW"
)
procSetFileAttributesW
=
modkernel32
.
NewProc
(
"SetFileAttributesW"
)
procSetFileAttributesW
=
modkernel32
.
NewProc
(
"SetFileAttributesW"
)
procGetFileAttributesExW
=
modkernel32
.
NewProc
(
"GetFileAttributesExW"
)
procGetFileAttributesExW
=
modkernel32
.
NewProc
(
"GetFileAttributesExW"
)
procGetCommandLineW
=
modkernel32
.
NewProc
(
"GetCommandLineW"
)
procGetCommandLineW
=
modkernel32
.
NewProc
(
"GetCommandLineW"
)
procCommandLineToArgvW
=
modshell32
.
NewProc
(
"CommandLineToArgvW"
)
procCommandLineToArgvW
=
modshell32
.
NewProc
(
"CommandLineToArgvW"
)
procLocalFree
=
modkernel32
.
NewProc
(
"LocalFree"
)
procLocalFree
=
modkernel32
.
NewProc
(
"LocalFree"
)
procSetHandleInformation
=
modkernel32
.
NewProc
(
"SetHandleInformation"
)
procSetHandleInformation
=
modkernel32
.
NewProc
(
"SetHandleInformation"
)
procFlushFileBuffers
=
modkernel32
.
NewProc
(
"FlushFileBuffers"
)
procFlushFileBuffers
=
modkernel32
.
NewProc
(
"FlushFileBuffers"
)
procGetFullPathNameW
=
modkernel32
.
NewProc
(
"GetFullPathNameW"
)
procGetFullPathNameW
=
modkernel32
.
NewProc
(
"GetFullPathNameW"
)
procCreateFileMappingW
=
modkernel32
.
NewProc
(
"CreateFileMappingW"
)
procCreateFileMappingW
=
modkernel32
.
NewProc
(
"CreateFileMappingW"
)
procMapViewOfFile
=
modkernel32
.
NewProc
(
"MapViewOfFile"
)
procMapViewOfFile
=
modkernel32
.
NewProc
(
"MapViewOfFile"
)
procUnmapViewOfFile
=
modkernel32
.
NewProc
(
"UnmapViewOfFile"
)
procUnmapViewOfFile
=
modkernel32
.
NewProc
(
"UnmapViewOfFile"
)
procFlushViewOfFile
=
modkernel32
.
NewProc
(
"FlushViewOfFile"
)
procFlushViewOfFile
=
modkernel32
.
NewProc
(
"FlushViewOfFile"
)
procVirtualLock
=
modkernel32
.
NewProc
(
"VirtualLock"
)
procVirtualLock
=
modkernel32
.
NewProc
(
"VirtualLock"
)
procVirtualUnlock
=
modkernel32
.
NewProc
(
"VirtualUnlock"
)
procVirtualUnlock
=
modkernel32
.
NewProc
(
"VirtualUnlock"
)
procTransmitFile
=
modmswsock
.
NewProc
(
"TransmitFile"
)
procTransmitFile
=
modmswsock
.
NewProc
(
"TransmitFile"
)
procWSAStartup
=
modws2_32
.
NewProc
(
"WSAStartup"
)
procCertOpenSystemStoreW
=
modcrypt32
.
NewProc
(
"CertOpenSystemStoreW"
)
procWSACleanup
=
modws2_32
.
NewProc
(
"WSACleanup"
)
procCertEnumCertificatesInStore
=
modcrypt32
.
NewProc
(
"CertEnumCertificatesInStore"
)
procWSAIoctl
=
modws2_32
.
NewProc
(
"WSAIoctl"
)
procCertCloseStore
=
modcrypt32
.
NewProc
(
"CertCloseStore"
)
procsocket
=
modws2_32
.
NewProc
(
"socket"
)
procWSAStartup
=
modws2_32
.
NewProc
(
"WSAStartup"
)
procsetsockopt
=
modws2_32
.
NewProc
(
"setsockopt"
)
procWSACleanup
=
modws2_32
.
NewProc
(
"WSACleanup"
)
procbind
=
modws2_32
.
NewProc
(
"bind"
)
procWSAIoctl
=
modws2_32
.
NewProc
(
"WSAIoctl"
)
procconnect
=
modws2_32
.
NewProc
(
"connect"
)
procsocket
=
modws2_32
.
NewProc
(
"socket"
)
procgetsockname
=
modws2_32
.
NewProc
(
"getsockname"
)
procsetsockopt
=
modws2_32
.
NewProc
(
"setsockopt"
)
procgetpeername
=
modws2_32
.
NewProc
(
"getpeername"
)
procbind
=
modws2_32
.
NewProc
(
"bind"
)
proclisten
=
modws2_32
.
NewProc
(
"listen"
)
procconnect
=
modws2_32
.
NewProc
(
"connect"
)
procshutdown
=
modws2_32
.
NewProc
(
"shutdown"
)
procgetsockname
=
modws2_32
.
NewProc
(
"getsockname"
)
procclosesocket
=
modws2_32
.
NewProc
(
"closesocket"
)
procgetpeername
=
modws2_32
.
NewProc
(
"getpeername"
)
procAcceptEx
=
modmswsock
.
NewProc
(
"AcceptEx"
)
proclisten
=
modws2_32
.
NewProc
(
"listen"
)
procGetAcceptExSockaddrs
=
modmswsock
.
NewProc
(
"GetAcceptExSockaddrs"
)
procshutdown
=
modws2_32
.
NewProc
(
"shutdown"
)
procWSARecv
=
modws2_32
.
NewProc
(
"WSARecv"
)
procclosesocket
=
modws2_32
.
NewProc
(
"closesocket"
)
procWSASend
=
modws2_32
.
NewProc
(
"WSASend"
)
procAcceptEx
=
modmswsock
.
NewProc
(
"AcceptEx"
)
procWSARecvFrom
=
modws2_32
.
NewProc
(
"WSARecvFrom"
)
procGetAcceptExSockaddrs
=
modmswsock
.
NewProc
(
"GetAcceptExSockaddrs"
)
procWSASendTo
=
modws2_32
.
NewProc
(
"WSASendTo"
)
procWSARecv
=
modws2_32
.
NewProc
(
"WSARecv"
)
procgethostbyname
=
modws2_32
.
NewProc
(
"gethostbyname"
)
procWSASend
=
modws2_32
.
NewProc
(
"WSASend"
)
procgetservbyname
=
modws2_32
.
NewProc
(
"getservbyname"
)
procWSARecvFrom
=
modws2_32
.
NewProc
(
"WSARecvFrom"
)
procntohs
=
modws2_32
.
NewProc
(
"ntohs"
)
procWSASendTo
=
modws2_32
.
NewProc
(
"WSASendTo"
)
procgetprotobyname
=
modws2_32
.
NewProc
(
"getprotobyname"
)
procgethostbyname
=
modws2_32
.
NewProc
(
"gethostbyname"
)
procDnsQuery_W
=
moddnsapi
.
NewProc
(
"DnsQuery_W"
)
procgetservbyname
=
modws2_32
.
NewProc
(
"getservbyname"
)
procDnsRecordListFree
=
moddnsapi
.
NewProc
(
"DnsRecordListFree"
)
procntohs
=
modws2_32
.
NewProc
(
"ntohs"
)
procGetIfEntry
=
modiphlpapi
.
NewProc
(
"GetIfEntry"
)
procgetprotobyname
=
modws2_32
.
NewProc
(
"getprotobyname"
)
procGetAdaptersInfo
=
modiphlpapi
.
NewProc
(
"GetAdaptersInfo"
)
procDnsQuery_W
=
moddnsapi
.
NewProc
(
"DnsQuery_W"
)
procDnsRecordListFree
=
moddnsapi
.
NewProc
(
"DnsRecordListFree"
)
procGetIfEntry
=
modiphlpapi
.
NewProc
(
"GetIfEntry"
)
procGetAdaptersInfo
=
modiphlpapi
.
NewProc
(
"GetAdaptersInfo"
)
)
)
func
GetLastError
()
(
lasterrno
int
)
{
func
GetLastError
()
(
lasterrno
int
)
{
...
@@ -1043,6 +1047,41 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
...
@@ -1043,6 +1047,41 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
return
return
}
}
func
CertOpenSystemStore
(
hprov
Handle
,
name
*
uint16
)
(
store
Handle
,
errno
int
)
{
r0
,
_
,
e1
:=
Syscall
(
procCertOpenSystemStoreW
.
Addr
(),
2
,
uintptr
(
hprov
),
uintptr
(
unsafe
.
Pointer
(
name
)),
0
)
store
=
Handle
(
r0
)
if
store
==
0
{
if
e1
!=
0
{
errno
=
int
(
e1
)
}
else
{
errno
=
EINVAL
}
}
else
{
errno
=
0
}
return
}
func
CertEnumCertificatesInStore
(
store
Handle
,
prevContext
*
CertContext
)
(
context
*
CertContext
)
{
r0
,
_
,
_
:=
Syscall
(
procCertEnumCertificatesInStore
.
Addr
(),
2
,
uintptr
(
store
),
uintptr
(
unsafe
.
Pointer
(
prevContext
)),
0
)
context
=
(
*
CertContext
)(
unsafe
.
Pointer
(
r0
))
return
}
func
CertCloseStore
(
store
Handle
,
flags
uint32
)
(
errno
int
)
{
r1
,
_
,
e1
:=
Syscall
(
procCertCloseStore
.
Addr
(),
2
,
uintptr
(
store
),
uintptr
(
flags
),
0
)
if
int
(
r1
)
==
0
{
if
e1
!=
0
{
errno
=
int
(
e1
)
}
else
{
errno
=
EINVAL
}
}
else
{
errno
=
0
}
return
}
func
WSAStartup
(
verreq
uint32
,
data
*
WSAData
)
(
sockerrno
int
)
{
func
WSAStartup
(
verreq
uint32
,
data
*
WSAData
)
(
sockerrno
int
)
{
r0
,
_
,
_
:=
Syscall
(
procWSAStartup
.
Addr
(),
2
,
uintptr
(
verreq
),
uintptr
(
unsafe
.
Pointer
(
data
)),
0
)
r0
,
_
,
_
:=
Syscall
(
procWSAStartup
.
Addr
(),
2
,
uintptr
(
verreq
),
uintptr
(
unsafe
.
Pointer
(
data
)),
0
)
sockerrno
=
int
(
r0
)
sockerrno
=
int
(
r0
)
...
...
src/pkg/syscall/zsyscall_windows_amd64.go
View file @
3153395e
...
@@ -10,102 +10,106 @@ var (
...
@@ -10,102 +10,106 @@ var (
modadvapi32
=
NewLazyDLL
(
"advapi32.dll"
)
modadvapi32
=
NewLazyDLL
(
"advapi32.dll"
)
modshell32
=
NewLazyDLL
(
"shell32.dll"
)
modshell32
=
NewLazyDLL
(
"shell32.dll"
)
modmswsock
=
NewLazyDLL
(
"mswsock.dll"
)
modmswsock
=
NewLazyDLL
(
"mswsock.dll"
)
modcrypt32
=
NewLazyDLL
(
"crypt32.dll"
)
modws2_32
=
NewLazyDLL
(
"ws2_32.dll"
)
modws2_32
=
NewLazyDLL
(
"ws2_32.dll"
)
moddnsapi
=
NewLazyDLL
(
"dnsapi.dll"
)
moddnsapi
=
NewLazyDLL
(
"dnsapi.dll"
)
modiphlpapi
=
NewLazyDLL
(
"iphlpapi.dll"
)
modiphlpapi
=
NewLazyDLL
(
"iphlpapi.dll"
)
procGetLastError
=
modkernel32
.
NewProc
(
"GetLastError"
)
procGetLastError
=
modkernel32
.
NewProc
(
"GetLastError"
)
procLoadLibraryW
=
modkernel32
.
NewProc
(
"LoadLibraryW"
)
procLoadLibraryW
=
modkernel32
.
NewProc
(
"LoadLibraryW"
)
procFreeLibrary
=
modkernel32
.
NewProc
(
"FreeLibrary"
)
procFreeLibrary
=
modkernel32
.
NewProc
(
"FreeLibrary"
)
procGetProcAddress
=
modkernel32
.
NewProc
(
"GetProcAddress"
)
procGetProcAddress
=
modkernel32
.
NewProc
(
"GetProcAddress"
)
procGetVersion
=
modkernel32
.
NewProc
(
"GetVersion"
)
procGetVersion
=
modkernel32
.
NewProc
(
"GetVersion"
)
procFormatMessageW
=
modkernel32
.
NewProc
(
"FormatMessageW"
)
procFormatMessageW
=
modkernel32
.
NewProc
(
"FormatMessageW"
)
procExitProcess
=
modkernel32
.
NewProc
(
"ExitProcess"
)
procExitProcess
=
modkernel32
.
NewProc
(
"ExitProcess"
)
procCreateFileW
=
modkernel32
.
NewProc
(
"CreateFileW"
)
procCreateFileW
=
modkernel32
.
NewProc
(
"CreateFileW"
)
procReadFile
=
modkernel32
.
NewProc
(
"ReadFile"
)
procReadFile
=
modkernel32
.
NewProc
(
"ReadFile"
)
procWriteFile
=
modkernel32
.
NewProc
(
"WriteFile"
)
procWriteFile
=
modkernel32
.
NewProc
(
"WriteFile"
)
procSetFilePointer
=
modkernel32
.
NewProc
(
"SetFilePointer"
)
procSetFilePointer
=
modkernel32
.
NewProc
(
"SetFilePointer"
)
procCloseHandle
=
modkernel32
.
NewProc
(
"CloseHandle"
)
procCloseHandle
=
modkernel32
.
NewProc
(
"CloseHandle"
)
procGetStdHandle
=
modkernel32
.
NewProc
(
"GetStdHandle"
)
procGetStdHandle
=
modkernel32
.
NewProc
(
"GetStdHandle"
)
procFindFirstFileW
=
modkernel32
.
NewProc
(
"FindFirstFileW"
)
procFindFirstFileW
=
modkernel32
.
NewProc
(
"FindFirstFileW"
)
procFindNextFileW
=
modkernel32
.
NewProc
(
"FindNextFileW"
)
procFindNextFileW
=
modkernel32
.
NewProc
(
"FindNextFileW"
)
procFindClose
=
modkernel32
.
NewProc
(
"FindClose"
)
procFindClose
=
modkernel32
.
NewProc
(
"FindClose"
)
procGetFileInformationByHandle
=
modkernel32
.
NewProc
(
"GetFileInformationByHandle"
)
procGetFileInformationByHandle
=
modkernel32
.
NewProc
(
"GetFileInformationByHandle"
)
procGetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"GetCurrentDirectoryW"
)
procGetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"GetCurrentDirectoryW"
)
procSetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"SetCurrentDirectoryW"
)
procSetCurrentDirectoryW
=
modkernel32
.
NewProc
(
"SetCurrentDirectoryW"
)
procCreateDirectoryW
=
modkernel32
.
NewProc
(
"CreateDirectoryW"
)
procCreateDirectoryW
=
modkernel32
.
NewProc
(
"CreateDirectoryW"
)
procRemoveDirectoryW
=
modkernel32
.
NewProc
(
"RemoveDirectoryW"
)
procRemoveDirectoryW
=
modkernel32
.
NewProc
(
"RemoveDirectoryW"
)
procDeleteFileW
=
modkernel32
.
NewProc
(
"DeleteFileW"
)
procDeleteFileW
=
modkernel32
.
NewProc
(
"DeleteFileW"
)
procMoveFileW
=
modkernel32
.
NewProc
(
"MoveFileW"
)
procMoveFileW
=
modkernel32
.
NewProc
(
"MoveFileW"
)
procGetComputerNameW
=
modkernel32
.
NewProc
(
"GetComputerNameW"
)
procGetComputerNameW
=
modkernel32
.
NewProc
(
"GetComputerNameW"
)
procSetEndOfFile
=
modkernel32
.
NewProc
(
"SetEndOfFile"
)
procSetEndOfFile
=
modkernel32
.
NewProc
(
"SetEndOfFile"
)
procGetSystemTimeAsFileTime
=
modkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procGetSystemTimeAsFileTime
=
modkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procSleep
=
modkernel32
.
NewProc
(
"Sleep"
)
procSleep
=
modkernel32
.
NewProc
(
"Sleep"
)
procGetTimeZoneInformation
=
modkernel32
.
NewProc
(
"GetTimeZoneInformation"
)
procGetTimeZoneInformation
=
modkernel32
.
NewProc
(
"GetTimeZoneInformation"
)
procCreateIoCompletionPort
=
modkernel32
.
NewProc
(
"CreateIoCompletionPort"
)
procCreateIoCompletionPort
=
modkernel32
.
NewProc
(
"CreateIoCompletionPort"
)
procGetQueuedCompletionStatus
=
modkernel32
.
NewProc
(
"GetQueuedCompletionStatus"
)
procGetQueuedCompletionStatus
=
modkernel32
.
NewProc
(
"GetQueuedCompletionStatus"
)
procCancelIo
=
modkernel32
.
NewProc
(
"CancelIo"
)
procCancelIo
=
modkernel32
.
NewProc
(
"CancelIo"
)
procCreateProcessW
=
modkernel32
.
NewProc
(
"CreateProcessW"
)
procCreateProcessW
=
modkernel32
.
NewProc
(
"CreateProcessW"
)
procOpenProcess
=
modkernel32
.
NewProc
(
"OpenProcess"
)
procOpenProcess
=
modkernel32
.
NewProc
(
"OpenProcess"
)
procTerminateProcess
=
modkernel32
.
NewProc
(
"TerminateProcess"
)
procTerminateProcess
=
modkernel32
.
NewProc
(
"TerminateProcess"
)
procGetExitCodeProcess
=
modkernel32
.
NewProc
(
"GetExitCodeProcess"
)
procGetExitCodeProcess
=
modkernel32
.
NewProc
(
"GetExitCodeProcess"
)
procGetStartupInfoW
=
modkernel32
.
NewProc
(
"GetStartupInfoW"
)
procGetStartupInfoW
=
modkernel32
.
NewProc
(
"GetStartupInfoW"
)
procGetCurrentProcess
=
modkernel32
.
NewProc
(
"GetCurrentProcess"
)
procGetCurrentProcess
=
modkernel32
.
NewProc
(
"GetCurrentProcess"
)
procDuplicateHandle
=
modkernel32
.
NewProc
(
"DuplicateHandle"
)
procDuplicateHandle
=
modkernel32
.
NewProc
(
"DuplicateHandle"
)
procWaitForSingleObject
=
modkernel32
.
NewProc
(
"WaitForSingleObject"
)
procWaitForSingleObject
=
modkernel32
.
NewProc
(
"WaitForSingleObject"
)
procGetTempPathW
=
modkernel32
.
NewProc
(
"GetTempPathW"
)
procGetTempPathW
=
modkernel32
.
NewProc
(
"GetTempPathW"
)
procCreatePipe
=
modkernel32
.
NewProc
(
"CreatePipe"
)
procCreatePipe
=
modkernel32
.
NewProc
(
"CreatePipe"
)
procGetFileType
=
modkernel32
.
NewProc
(
"GetFileType"
)
procGetFileType
=
modkernel32
.
NewProc
(
"GetFileType"
)
procCryptAcquireContextW
=
modadvapi32
.
NewProc
(
"CryptAcquireContextW"
)
procCryptAcquireContextW
=
modadvapi32
.
NewProc
(
"CryptAcquireContextW"
)
procCryptReleaseContext
=
modadvapi32
.
NewProc
(
"CryptReleaseContext"
)
procCryptReleaseContext
=
modadvapi32
.
NewProc
(
"CryptReleaseContext"
)
procCryptGenRandom
=
modadvapi32
.
NewProc
(
"CryptGenRandom"
)
procCryptGenRandom
=
modadvapi32
.
NewProc
(
"CryptGenRandom"
)
procGetEnvironmentStringsW
=
modkernel32
.
NewProc
(
"GetEnvironmentStringsW"
)
procGetEnvironmentStringsW
=
modkernel32
.
NewProc
(
"GetEnvironmentStringsW"
)
procFreeEnvironmentStringsW
=
modkernel32
.
NewProc
(
"FreeEnvironmentStringsW"
)
procFreeEnvironmentStringsW
=
modkernel32
.
NewProc
(
"FreeEnvironmentStringsW"
)
procGetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"GetEnvironmentVariableW"
)
procGetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"GetEnvironmentVariableW"
)
procSetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"SetEnvironmentVariableW"
)
procSetEnvironmentVariableW
=
modkernel32
.
NewProc
(
"SetEnvironmentVariableW"
)
procSetFileTime
=
modkernel32
.
NewProc
(
"SetFileTime"
)
procSetFileTime
=
modkernel32
.
NewProc
(
"SetFileTime"
)
procGetFileAttributesW
=
modkernel32
.
NewProc
(
"GetFileAttributesW"
)
procGetFileAttributesW
=
modkernel32
.
NewProc
(
"GetFileAttributesW"
)
procSetFileAttributesW
=
modkernel32
.
NewProc
(
"SetFileAttributesW"
)
procSetFileAttributesW
=
modkernel32
.
NewProc
(
"SetFileAttributesW"
)
procGetFileAttributesExW
=
modkernel32
.
NewProc
(
"GetFileAttributesExW"
)
procGetFileAttributesExW
=
modkernel32
.
NewProc
(
"GetFileAttributesExW"
)
procGetCommandLineW
=
modkernel32
.
NewProc
(
"GetCommandLineW"
)
procGetCommandLineW
=
modkernel32
.
NewProc
(
"GetCommandLineW"
)
procCommandLineToArgvW
=
modshell32
.
NewProc
(
"CommandLineToArgvW"
)
procCommandLineToArgvW
=
modshell32
.
NewProc
(
"CommandLineToArgvW"
)
procLocalFree
=
modkernel32
.
NewProc
(
"LocalFree"
)
procLocalFree
=
modkernel32
.
NewProc
(
"LocalFree"
)
procSetHandleInformation
=
modkernel32
.
NewProc
(
"SetHandleInformation"
)
procSetHandleInformation
=
modkernel32
.
NewProc
(
"SetHandleInformation"
)
procFlushFileBuffers
=
modkernel32
.
NewProc
(
"FlushFileBuffers"
)
procFlushFileBuffers
=
modkernel32
.
NewProc
(
"FlushFileBuffers"
)
procGetFullPathNameW
=
modkernel32
.
NewProc
(
"GetFullPathNameW"
)
procGetFullPathNameW
=
modkernel32
.
NewProc
(
"GetFullPathNameW"
)
procCreateFileMappingW
=
modkernel32
.
NewProc
(
"CreateFileMappingW"
)
procCreateFileMappingW
=
modkernel32
.
NewProc
(
"CreateFileMappingW"
)
procMapViewOfFile
=
modkernel32
.
NewProc
(
"MapViewOfFile"
)
procMapViewOfFile
=
modkernel32
.
NewProc
(
"MapViewOfFile"
)
procUnmapViewOfFile
=
modkernel32
.
NewProc
(
"UnmapViewOfFile"
)
procUnmapViewOfFile
=
modkernel32
.
NewProc
(
"UnmapViewOfFile"
)
procFlushViewOfFile
=
modkernel32
.
NewProc
(
"FlushViewOfFile"
)
procFlushViewOfFile
=
modkernel32
.
NewProc
(
"FlushViewOfFile"
)
procVirtualLock
=
modkernel32
.
NewProc
(
"VirtualLock"
)
procVirtualLock
=
modkernel32
.
NewProc
(
"VirtualLock"
)
procVirtualUnlock
=
modkernel32
.
NewProc
(
"VirtualUnlock"
)
procVirtualUnlock
=
modkernel32
.
NewProc
(
"VirtualUnlock"
)
procTransmitFile
=
modmswsock
.
NewProc
(
"TransmitFile"
)
procTransmitFile
=
modmswsock
.
NewProc
(
"TransmitFile"
)
procWSAStartup
=
modws2_32
.
NewProc
(
"WSAStartup"
)
procCertOpenSystemStoreW
=
modcrypt32
.
NewProc
(
"CertOpenSystemStoreW"
)
procWSACleanup
=
modws2_32
.
NewProc
(
"WSACleanup"
)
procCertEnumCertificatesInStore
=
modcrypt32
.
NewProc
(
"CertEnumCertificatesInStore"
)
procWSAIoctl
=
modws2_32
.
NewProc
(
"WSAIoctl"
)
procCertCloseStore
=
modcrypt32
.
NewProc
(
"CertCloseStore"
)
procsocket
=
modws2_32
.
NewProc
(
"socket"
)
procWSAStartup
=
modws2_32
.
NewProc
(
"WSAStartup"
)
procsetsockopt
=
modws2_32
.
NewProc
(
"setsockopt"
)
procWSACleanup
=
modws2_32
.
NewProc
(
"WSACleanup"
)
procbind
=
modws2_32
.
NewProc
(
"bind"
)
procWSAIoctl
=
modws2_32
.
NewProc
(
"WSAIoctl"
)
procconnect
=
modws2_32
.
NewProc
(
"connect"
)
procsocket
=
modws2_32
.
NewProc
(
"socket"
)
procgetsockname
=
modws2_32
.
NewProc
(
"getsockname"
)
procsetsockopt
=
modws2_32
.
NewProc
(
"setsockopt"
)
procgetpeername
=
modws2_32
.
NewProc
(
"getpeername"
)
procbind
=
modws2_32
.
NewProc
(
"bind"
)
proclisten
=
modws2_32
.
NewProc
(
"listen"
)
procconnect
=
modws2_32
.
NewProc
(
"connect"
)
procshutdown
=
modws2_32
.
NewProc
(
"shutdown"
)
procgetsockname
=
modws2_32
.
NewProc
(
"getsockname"
)
procclosesocket
=
modws2_32
.
NewProc
(
"closesocket"
)
procgetpeername
=
modws2_32
.
NewProc
(
"getpeername"
)
procAcceptEx
=
modmswsock
.
NewProc
(
"AcceptEx"
)
proclisten
=
modws2_32
.
NewProc
(
"listen"
)
procGetAcceptExSockaddrs
=
modmswsock
.
NewProc
(
"GetAcceptExSockaddrs"
)
procshutdown
=
modws2_32
.
NewProc
(
"shutdown"
)
procWSARecv
=
modws2_32
.
NewProc
(
"WSARecv"
)
procclosesocket
=
modws2_32
.
NewProc
(
"closesocket"
)
procWSASend
=
modws2_32
.
NewProc
(
"WSASend"
)
procAcceptEx
=
modmswsock
.
NewProc
(
"AcceptEx"
)
procWSARecvFrom
=
modws2_32
.
NewProc
(
"WSARecvFrom"
)
procGetAcceptExSockaddrs
=
modmswsock
.
NewProc
(
"GetAcceptExSockaddrs"
)
procWSASendTo
=
modws2_32
.
NewProc
(
"WSASendTo"
)
procWSARecv
=
modws2_32
.
NewProc
(
"WSARecv"
)
procgethostbyname
=
modws2_32
.
NewProc
(
"gethostbyname"
)
procWSASend
=
modws2_32
.
NewProc
(
"WSASend"
)
procgetservbyname
=
modws2_32
.
NewProc
(
"getservbyname"
)
procWSARecvFrom
=
modws2_32
.
NewProc
(
"WSARecvFrom"
)
procntohs
=
modws2_32
.
NewProc
(
"ntohs"
)
procWSASendTo
=
modws2_32
.
NewProc
(
"WSASendTo"
)
procgetprotobyname
=
modws2_32
.
NewProc
(
"getprotobyname"
)
procgethostbyname
=
modws2_32
.
NewProc
(
"gethostbyname"
)
procDnsQuery_W
=
moddnsapi
.
NewProc
(
"DnsQuery_W"
)
procgetservbyname
=
modws2_32
.
NewProc
(
"getservbyname"
)
procDnsRecordListFree
=
moddnsapi
.
NewProc
(
"DnsRecordListFree"
)
procntohs
=
modws2_32
.
NewProc
(
"ntohs"
)
procGetIfEntry
=
modiphlpapi
.
NewProc
(
"GetIfEntry"
)
procgetprotobyname
=
modws2_32
.
NewProc
(
"getprotobyname"
)
procGetAdaptersInfo
=
modiphlpapi
.
NewProc
(
"GetAdaptersInfo"
)
procDnsQuery_W
=
moddnsapi
.
NewProc
(
"DnsQuery_W"
)
procDnsRecordListFree
=
moddnsapi
.
NewProc
(
"DnsRecordListFree"
)
procGetIfEntry
=
modiphlpapi
.
NewProc
(
"GetIfEntry"
)
procGetAdaptersInfo
=
modiphlpapi
.
NewProc
(
"GetAdaptersInfo"
)
)
)
func
GetLastError
()
(
lasterrno
int
)
{
func
GetLastError
()
(
lasterrno
int
)
{
...
@@ -1043,6 +1047,41 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
...
@@ -1043,6 +1047,41 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint
return
return
}
}
func
CertOpenSystemStore
(
hprov
Handle
,
name
*
uint16
)
(
store
Handle
,
errno
int
)
{
r0
,
_
,
e1
:=
Syscall
(
procCertOpenSystemStoreW
.
Addr
(),
2
,
uintptr
(
hprov
),
uintptr
(
unsafe
.
Pointer
(
name
)),
0
)
store
=
Handle
(
r0
)
if
store
==
0
{
if
e1
!=
0
{
errno
=
int
(
e1
)
}
else
{
errno
=
EINVAL
}
}
else
{
errno
=
0
}
return
}
func
CertEnumCertificatesInStore
(
store
Handle
,
prevContext
*
CertContext
)
(
context
*
CertContext
)
{
r0
,
_
,
_
:=
Syscall
(
procCertEnumCertificatesInStore
.
Addr
(),
2
,
uintptr
(
store
),
uintptr
(
unsafe
.
Pointer
(
prevContext
)),
0
)
context
=
(
*
CertContext
)(
unsafe
.
Pointer
(
r0
))
return
}
func
CertCloseStore
(
store
Handle
,
flags
uint32
)
(
errno
int
)
{
r1
,
_
,
e1
:=
Syscall
(
procCertCloseStore
.
Addr
(),
2
,
uintptr
(
store
),
uintptr
(
flags
),
0
)
if
int
(
r1
)
==
0
{
if
e1
!=
0
{
errno
=
int
(
e1
)
}
else
{
errno
=
EINVAL
}
}
else
{
errno
=
0
}
return
}
func
WSAStartup
(
verreq
uint32
,
data
*
WSAData
)
(
sockerrno
int
)
{
func
WSAStartup
(
verreq
uint32
,
data
*
WSAData
)
(
sockerrno
int
)
{
r0
,
_
,
_
:=
Syscall
(
procWSAStartup
.
Addr
(),
2
,
uintptr
(
verreq
),
uintptr
(
unsafe
.
Pointer
(
data
)),
0
)
r0
,
_
,
_
:=
Syscall
(
procWSAStartup
.
Addr
(),
2
,
uintptr
(
verreq
),
uintptr
(
unsafe
.
Pointer
(
data
)),
0
)
sockerrno
=
int
(
r0
)
sockerrno
=
int
(
r0
)
...
...
src/pkg/syscall/ztypes_windows.go
View file @
3153395e
...
@@ -617,3 +617,11 @@ type MibIfRow struct {
...
@@ -617,3 +617,11 @@ type MibIfRow struct {
DescrLen
uint32
DescrLen
uint32
Descr
[
MAXLEN_IFDESCR
]
byte
Descr
[
MAXLEN_IFDESCR
]
byte
}
}
type
CertContext
struct
{
EncodingType
uint32
EncodedCert
uintptr
Length
uint32
CertInfo
uintptr
Store
Handle
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment