aboutsummaryrefslogtreecommitdiff
path: root/src/internal/syscall/windows/zsyscall_windows.go
AgeCommit message (Collapse)Author
2023-01-24os: use handle based APIs to read directories on windowsqmuntal
This CL updates File.readdir() on windows so it uses GetFileInformationByHandleEx with FILE_ID_BOTH_DIR_INFO instead of Find* APIs. The former is more performant because it allows us to buffer IO calls and reduces the number of system calls, passing from 1 per file to 1 every ~100 files (depending on the size of the file name and the size of the buffer). This change improve performance of File.ReadDir by 20-30%. name old time/op new time/op delta ReadDir-12 562µs ±14% 385µs ± 9% -31.60% (p=0.000 n=9+9) name old alloc/op new alloc/op delta ReadDir-12 29.7kB ± 0% 29.5kB ± 0% -0.88% (p=0.000 n=8+10) name old allocs/op new allocs/op delta ReadDir-12 399 ± 0% 397 ± 0% -0.50% (p=0.000 n=10+10) This change also speeds up calls to os.SameFile when using FileStats returned from File.readdir(), as their file ID can be inferred while reading the directory. Change-Id: Id56a338ee66c39656b564105cac131099218fb5d Reviewed-on: https://go-review.googlesource.com/c/go/+/452995 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-20runtime/pprof: add memory mapping info for WindowsEgon Elbre
Fixes #43296 Change-Id: Ib277c2e82c95f71a7a9b7fe1b22215ead7a54a88 Reviewed-on: https://go-review.googlesource.com/c/go/+/416975 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-06-03cmd/go: add functions to read index fileMichael Matloob
The data read is used for three primary functions: ImportPackage, IsDirWithGoFiles and ScanDir. Functions are also provided to get this information from the intermediate package representation to cache the information from reads for non-indexed packages. Change-Id: I5eed629bb0d6ee5b88ab706d06b074475004c081 Reviewed-on: https://go-review.googlesource.com/c/go/+/403975 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2022-04-04Revert "os: add handling of os.Interrupt for windows"Bryan Mills
This reverts CL 367495. Reason for revert: broke `x/tools` tests on Windows. Change-Id: Iab6b33259181c9520cf8db1e5b6edfeba763f974 Reviewed-on: https://go-review.googlesource.com/c/go/+/397997 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-04-03os: add handling of os.Interrupt for windowsConstantin Konstantinidis
Add GenerateConsoleCtrlEvent call to internal syscall package. Define ErrProcessDone while reviewing handling of os.Signal(). Update test to run for windows using the added call. Fixes #42311 Fixes #46354 Change-Id: I460955efc76c4febe04b612ac9a0670e62ba5ff3 Reviewed-on: https://go-review.googlesource.com/c/go/+/367495 Trust: Patrik Nyblom <pnyb@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-15syscall: remove RtlGenRandom and move it into internal/syscallJason A. Donenfeld
There's on need to expose this to the frozen syscall package, and it also doesn't need to be unsafe. So we move it into internal/syscall and have the generator make a safer function signature. Fixes #43704. Change-Id: Iccae69dc273a0aa97ee6846eb537f1dc1412f2de Reviewed-on: https://go-review.googlesource.com/c/go/+/283992 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-11-02all: update dependency on golang.org/x/sys and regenerate Windows syscallsBryan C. Mills
Steps run: $ cd $(go env GOROOT)/src $ go get -d golang.org/x/sys $ go mod tidy $ go mod vendor $ go generate syscall/... internal/syscall/... $ cd cmd $ go get -d golang.org/x/sys $ go mod tidy $ go mod vendor $ cd .. $ git add . This change subsumes CL 260860. For #36905 Change-Id: I7c677c6aa1ad61b9cbd8cf9ed208ed5a30f29c87 Reviewed-on: https://go-review.googlesource.com/c/go/+/267103 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-11-02syscall: switch go:generate directives back to mksyscall_windows.goBryan C. Mills
Adjust mksyscall_windows.go to activate module mode and set -mod=readonly, and to suppress its own deprecation warning when run from within GOROOT/src. We can't vendor the mkwinsyscall tool in to the std module directly, because std-vendored dependencies (unlike the dependencies of all other modules) turn into actual, distinct packages in 'std' when viewed from outside the 'std' module. We don't want to introduce a binary in the 'std' meta-pattern, but we also don't particularly want to add more special-cases to the 'go' command right now when we have an existing wrapper program that can do the job. I also regenerated the affected packages to ensure that they are consistent with the current version of mksyscall, which produced some declaration-order changes in internal/syscall/windows/zsyscall_windows.go. Fixes #41916 Updates #25922 Change-Id: If6e6f8ba3dd372a7ecd6820ee6c0ca38d55f0f35 Reviewed-on: https://go-review.googlesource.com/c/go/+/261499 Trust: Bryan C. Mills <bcmills@google.com> Trust: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-09-11os: implement File.Chmod on WindowsConstantin Konstantinidis
Fixes: #39606 Change-Id: I4def67ef18bd3ff866b140f6e76cdabe5d51a1c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/250077 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-05-16os: pass correct environment when creating Windows processesJason A. Donenfeld
This is CVE-2019-11888. Previously, passing a nil environment but a non-nil token would result in the new potentially unprivileged process inheriting the parent potentially privileged environment, or would result in the new potentially privileged process inheriting the parent potentially unprivileged environment. Either way, it's bad. In the former case, it's an infoleak. In the latter case, it's a possible EoP, since things like PATH could be overwritten. Not specifying an environment currently means, "use the existing environment". This commit amends the behavior to be, "use the existing environment of the token the process is being created for." The behavior therefore stays the same when creating processes without specifying a token. And it does the correct thing when creating processes when specifying a token. Fixes #32000 Change-Id: Ia57f6e89b97bdbaf7274d6a89c1d9948b6d40ef5 Reviewed-on: https://go-review.googlesource.com/c/go/+/176619 Run-TryBot: Jason Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-11-02internal/syscall/windows: add LockFileEx and UnlockFileEx for use in cmd/goBryan C. Mills
Updates #26794 Change-Id: Ic1d3078176721f3d2e5d8188c234383037babbaf Reviewed-on: https://go-review.googlesource.com/c/145177 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-11-02os: use CreateFile for Stat of symlinksAlex Brainman
Stat uses Windows FindFirstFile + CreateFile to gather symlink information - FindFirstFile determines if file is a symlink, and then CreateFile follows symlink to capture target details. Lstat only uses FindFirstFile. This CL replaces current approach with just a call to CreateFile. Lstat uses FILE_FLAG_OPEN_REPARSE_POINT flag, that instructs CreateFile not to follow symlink. Other than that both Stat and Lstat look the same now. New code is simpler. CreateFile + GetFileInformationByHandle (unlike FindFirstFile) does not report reparse tag of a file. I tried to ignore reparse tag altogether. And it works for symlinks and mount points. Unfortunately (see https://github.com/moby/moby/issues/37026), files on deduped disk volumes are reported with FILE_ATTRIBUTE_REPARSE_POINT attribute set and reparse tag set to IO_REPARSE_TAG_DEDUP. So, if we ignore reparse tag, Lstat interprets deduped volume files as symlinks. That is incorrect. So I had to add GetFileInformationByHandleEx call to gather reparse tag after calling CreateFile and GetFileInformationByHandle. Fixes #27225 Fixes #27515 Change-Id: If60233bcf18836c147597cc17450d82f3f88c623 Reviewed-on: https://go-review.googlesource.com/c/143578 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
2018-06-14syscall, internal/syscall: follow convention for generated code commentTobias Klauser
Follow the convertion (https://golang.org/s/generatedcode) for generated code. Change-Id: I4ac8b99ac45f25dd2399d048ea831489e5394984 Reviewed-on: https://go-review.googlesource.com/118821 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-04os/user: obtain a user GID on WindowsLubomir I. Ivanov (VMware)
Add the following helpers in lookup_windows.go: 1) lookupGroupName() is used to obtain the SID of a group based on name. 2) listGroupsForUsernameAndDomain() uses NetUserGetLocalGroups() as a WINAPI backend to obtain the list of local groups for this user. 3) lookupUserPrimaryGroup() is now used to populate the User.Gid field when looking up a user by name. Implement listGroups(), lookupGroupId(), lookupGroup() and no longer return unimplemented errors. Do not skip Windows User.Gid tests in user_test.go. Change-Id: I81fd41b406da51f9a4cb24e50d392a333df81141 GitHub-Last-Rev: d1448fd55d6eaa0f41bf347df18b40da06791df1 GitHub-Pull-Request: golang/go#24222 Reviewed-on: https://go-review.googlesource.com/98137 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-24os/user: obtain a user home path on WindowsLubomir I. Ivanov (VMware)
newUserFromSid() is extended so that the retriaval of the user home path based on a user SID becomes possible. (1) The primary method it uses is to lookup the Windows registry for the following key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\[SID] If the key does not exist the user might not have logged in yet. If (1) fails it falls back to (2) (2) The second method the function uses is to look at the default home path for users (e.g. WINAPI's GetProfilesDirectory()) and append the username to that. The procedure is in the lines of: c:\Users + \ + <username> The function newUser() now requires the following arguments: uid, gid, dir, username, domain This is done to avoid multiple calls to usid.String() and usid.LookupAccount("") in the case of a newUserFromSid() call stack. The functions current() and newUserFromSid() both call newUser() supplying the arguments in question. The helpers lookupUsernameAndDomain() and findHomeDirInRegistry() are added. This commit also updates: - go/build/deps_test.go, so that the test now includes the "internal/syscall/windows/registry" import. - os/user/user_test.go, so that User.HomeDir is tested on Windows. GitHub-Last-Rev: 25423e2a3820121f4c42321e7a77a3977f409724 GitHub-Pull-Request: golang/go#23822 Change-Id: I6c3ad1c4ce3e7bc0d1add024951711f615b84ee5 Reviewed-on: https://go-review.googlesource.com/93935 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-07syscall: change SysProcAttr.Token type to TokenAlex Brainman
CL 75253 introduced new SysProcAttr.Token field as Handle. But we already have exact type for it - Token. Use Token instead of Handle everywhere - it saves few type conversions and provides better documentation for new API. Change-Id: Ibc5407a234a1f49804de15a24b27c8e6a6eba7e0 Reviewed-on: https://go-review.googlesource.com/76314 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-07net: use WSASocket instead of socket callAlex Brainman
WSASocket (unlike socket call) allows to create sockets that will not be inherited by child process. So call WSASocket to save on using syscall.ForkLock and calling syscall.CloseOnExec. Some very old versions of Windows do not have that functionality. Call socket, if WSASocket failed, to support these. Change-Id: I2dab9fa00d1a8609dd6feae1c9cc31d4e55b8cb5 Reviewed-on: https://go-review.googlesource.com/72590 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-06syscall: add Token to Windows SysProcAttrPaul Querna
Fixes #21105 Change-Id: Ia2dea9b82a356795f581ce75616198b46e97abb6 Reviewed-on: https://go-review.googlesource.com/75253 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-11-03cmd/link: restore windows stack commit size back to 4KBAlex Brainman
CL 49331 increased windows stack commit size to 2MB by mistake. Revert that change. Fixes #22439 Change-Id: I919e549e87da326f4ba45890b4d32f6d7046186f Reviewed-on: https://go-review.googlesource.com/74490 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-10-05path/filepath: re-implement windows EvalSymlinksAlex Brainman
CL 41834 used approach suggested by Raymond Chen in https://blogs.msdn.microsoft.com/oldnewthing/20100212-00/?p=14963/ to implement os.Stat by getting Windows I/O manager follow symbolic links. Do the same for filepath.EvalSymlinks, when existing strategy fails. Updates #19922 Fixes #20506 Change-Id: I15f3d3a80256bae86ac4fb321fd8877e84d8834f Reviewed-on: https://go-review.googlesource.com/55612 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-07internal/syscall/windows: add GetModuleFileNameShenghou Ma
For os.Executable. Updates #12773. Change-Id: Iff6593514b7453b6c5e1f20079e35cb4992cc74a Reviewed-on: https://go-review.googlesource.com/32877 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-22syscall: use ERROR_IO_PENDING value in errnoErrAlex Brainman
So errnoErr can be used in other packages. This is something I missed when I sent CL 28990. Fixes #17539 Change-Id: I8ee3b79c4d70ca1e5b29e5b40024f7ae9a86061e Reviewed-on: https://go-review.googlesource.com/29690 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-19os, syscall: fix incorrect offset calculation in Readlink on windowsHiroshi Ioka
Current implementation of syscall.Readlink mistakenly calculates the end offset of the PrintName field. Also, there are some cases that the PrintName field is empty. Instead, the CL uses SubstituteName with correct calculation. Fixes #15978 Fixes #16145 Change-Id: If3257137141129ac1c552d003726d5b9c08bb754 Reviewed-on: https://go-review.googlesource.com/31118 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-12os: add new tests for symbolic links and directory junctionsAlex Brainman
Updates #15978 Updates #16145 Change-Id: I161f5bc97d41c08bf5e1405ccafa86232d70886d Reviewed-on: https://go-review.googlesource.com/25320 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2016-09-21os: use GetConsoleCP() instead of GetACP()Yasuhiro Matsumoto
It is possible (and common) for Windows systems to use a different codepage for console applications from that used on normal windowed application (called ANSI codepage); for instance, most of the western Europe uses CP850 for console (for backward compatibility with MS-DOS), while windowed applications use a different codepage depending on the country (eg: CP1252 aka Latin-1). The usage being changed with this commit is specifically related to decoding input coming from the console, so the previous usage of the ANSI codepage was wrong. Also fixes an issue that previous did convert bytes as NFD. Go is designed to handle single Unicode code point. This fix change behaivor to NFC. Fixes #16857. Change-Id: I4f41ae83ece47321b6e9a79a2087ecbb8ac066dd Reviewed-on: https://go-review.googlesource.com/27575 Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-09-07syscall: avoid convT2I allocs for common Windows error valuesBrad Fitzpatrick
This is was already done for Unix in https://golang.org/cl/6701 + https://golang.org/cl/8192. Do it for Windows also. Fixes #16988 Change-Id: Ia7832b0d0d48566b0cd205652b85130df529592e Reviewed-on: https://go-review.googlesource.com/28484 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-05-11syscall: remove mksyscall_windows.go -xsys flagAlex Brainman
Also run "go generate" in internal/syscall/windows and internal/syscall/windows/registry Updates #15167 Change-Id: I0109226962f81857fe11d308b869d561ea8ed9f9 Reviewed-on: https://go-review.googlesource.com/23021 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-01runtime, syscall: only search for Windows DLLs in the System32 directoryBrad Fitzpatrick
Make sure that for any DLL that Go uses itself, we only look for the DLL in the Windows System32 directory, guarding against DLL preloading attacks. (Unless the Windows version is ancient and LoadLibraryEx is unavailable, in which case the user probably has bigger security problems anyway.) This does not change the behavior of syscall.LoadLibrary or NewLazyDLL if the DLL name is something unused by Go itself. This change also intentionally does not add any new API surface. Instead, x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in: https://golang.org/cl/21388 Updates #14959 Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9 Reviewed-on: https://go-review.googlesource.com/21140 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-08internal/syscall/windows: correct GetACP and MultiByteToWideCharAlex Brainman
CL 4310 introduced these functions, but their implementation does not match with their published documentation. Correct the implementation. Change-Id: I285e41f9c7c5fc4e550ff59b0adb8b2bcbf6737a Reviewed-on: https://go-review.googlesource.com/17997 Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-17os,internal/syscall/windows: use ReadFile/MultiByteToWideChar to read from ↵mattn
console Fixes #6303 Change-Id: Ib2cd15ac6106ef8e6b975943db8efc8d8ab21052 Reviewed-on: https://go-review.googlesource.com/4310 Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-10net, internal/syscall/windows: fix interface and address identification on ↵Mikio Hara
windows The current implementation including Go 1.5 through 1.5.2 misuses Windows API and mishandles the returned values from GetAdapterAddresses on Windows. This change fixes various issues related to network facility information by readjusting interface and interface address parsers. Updates #5395. Updates #10530. Updates #12301. Updates #12551. Updates #13542. Fixes #12691. Fixes #12811. Fixes #13476. Fixes #13544. Also fixes fragile screen scraping test cases in net_windows_test.go. Additional information for reviewers: It seems like almost all the issues above have the same root cause and it is misunderstanding of Windows API. If my interpretation of the information on MSDN is correctly, current implementation contains the following bugs: - SIO_GET_INTERFACE_LIST should not be used for IPv6. The behavior of SIO_GET_INTERFACE_LIST is different on kernels and probably it doesn't work correctly for IPv6 on old kernels such as Windows XP w/ SP2. Unfortunately MSDN doesn't describe the detail of SIO_GET_INTERFACE_LIST, but information on the net suggests so. - Fetching IP_ADAPTER_ADDRESSES structures with fixed size area may not work when using IPv6. IPv6 generates ton of interface addresses for various addressing scopes. We need to adjust the area appropriately. - PhysicalAddress field of IP_ADAPTER_ADDRESSES structure may have extra space. We cannot ignore PhysicalAddressLength field of IP_ADAPTER_ADDRESS structure. - Flags field of IP_ADAPTER_ADDRESSES structure doesn't represent any of administratively and operatinal statuses. It just represents settings for windows network adapter. - MTU field of IP_ADAPTER_ADDRESSES structure may have a uint32(-1) on 64-bit platform. We need to convert the value to interger appropriately. - IfType field of IP_ADAPTER_ADDRESSES structure is not a bit field. Bitwire operation for the field is completely wrong. - OperStatus field of IP_ADAPTER_ADDRESSES structure is not a bit field. Bitwire operation for the field is completely wrong. - IPv6IfIndex field of IP_ADAPTER_ADDRESSES structure is just a substitute for IfIndex field. We cannot prefer IPv6IfIndex to IfIndex. - Windows XP, 2003 server and below don't set OnLinkPrefixLength field of IP_ADAPTER_UNICAST_ADDRESS structure. We cannot rely on the field on old kernels. We can use FirstPrefix field of IP_ADAPTER_ADDRESSES structure and IP_ADAPTER_PREFIX structure instead. - Length field of IP_ADAPTER_{UNICAST,ANYCAST,MULTICAST}_ADDRESS sturecures doesn't represent an address prefix length. It just represents a socket address length. Change-Id: Icabdaf7bd1d41360a981d2dad0b830b02b584528 Reviewed-on: https://go-review.googlesource.com/17412 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-04-09os: windows Rename should overwrite destination file.Daniel Theophanes
Rename now uses MoveFileEx which was previously not available to use because it is not supported on Windows 2000. Change-Id: I583d029c4467c9be6d1574a790c423559b441e87 Reviewed-on: https://go-review.googlesource.com/6140 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-31crypto/x509: use syscall.GetVersion instead of ↵Alex Brainman
internal/syscall/windows.GetVersion cl8167 introduced internal/syscall/windows.GetVersion, but we already have that function in syscall.GetVersion. Use that instead. Also revert all internal/syscall/windows cl8167 changes. Change-Id: I512a5bf4b3b696e93aaf69e9e8b7df7022670ec0 Reviewed-on: https://go-review.googlesource.com/8302 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Reviewed-by: Minux Ma <minux@golang.org>
2015-03-30crypto/x509: skip SHA2 system verify test if not supported.Daniel Theophanes
Windows XP SP2 and Windows 2003 do not support SHA2. Change-Id: Ica5faed040e9ced8b79fe78d512586e0e8788b3f Reviewed-on: https://go-review.googlesource.com/8167 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-25os: Use GetComputerNameEx to get Hostname on win32Carlos Castillo
The existing Hostname function uses the GetComputerName system function in windows to determine the hostname. It has some downsides: - The name is limited to 15 characters. - The name returned is for NetBIOS, other OS's return a DNS name This change adds to the internal/syscall/windows package a GetComputerNameEx function, and related enum constants. They are used instead of the syscall.ComputerName function to implement os.Hostname on windows. Fixes #9982 Change-Id: Idc8782785eb1eea37e64022bd201699ce9c4b39c Reviewed-on: https://go-review.googlesource.com/5852 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Carlos Castillo <cookieo9@gmail.com> Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2015-02-10net: re-implement Interfaces and InterfaceAddrs for IPNet, IPv6 on Windowsmattn
Fixes #5395 Change-Id: I4322bc8a974d04d9bae6b48c71c5d32d9252973c Reviewed-on: https://go-review.googlesource.com/3024 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>