Commit Graph

79 Commits

Author SHA1 Message Date
Jonathan Marler dc9648f868 new allocator interface 2020-06-26 13:34:48 -06:00
Andrew Kelley da549a72e1 zig fmt 2020-06-20 18:39:15 -04:00
Andrew Kelley c6764fd254 Merge pull request #5475 from marler8997/windowsDns
support name resolution on windows
2020-06-01 15:33:05 -04:00
Jonathan Marler 58fb5b29b6 more windows network fixes
* support posix SOCK_NONBLOCK and SOCK_CLOEXEC flags on windows
* fix bugs in os.socket and os.connect to return at the correct place
2020-05-31 10:07:51 -06:00
Alexandros Naskos dbdacb0938 Fix WSARecvFrom signature
The lpFromLen should be a pointer.
2020-05-30 16:46:32 +03:00
Jonathan Marler 2eaab1e65e more windows network support, including dns 2020-05-29 22:38:48 -06:00
Andrew Kelley ba43492c0e Merge pull request #5268 from tadeokondrak/remove-callconv-redundant-syntax
Remove syntax redundant with callconv
2020-05-07 12:42:26 -04:00
Jens Goldberg 20c1696865 Removed GetModuleHandleA from user32
GetModuleHandleA is an kernel32 function and already defined there, it doesn't belong in user32.
2020-05-07 12:38:46 -04:00
Jens Goldberg 25810bc1e6 Removed duplicate WM_ACTIVATE 2020-05-07 12:38:46 -04:00
Tadeo Kondrak 6745a6f6f6 zig fmt 2020-05-05 09:38:02 -06:00
Tadeo Kondrak 17e41f6cd3 @OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
LemonBoy 155e631aa6 std: Implement progress for Windows
Use the Win32 API instead of using the VT escape sequences.
2020-04-22 12:58:02 +02:00
Vexu ca3bf6e6ad translate-c cleanup and zig fmt 2020-04-15 15:15:32 +03:00
Jakub 1e23a3cd91 Added gdi32.zig and More user32 definitions 2020-04-14 16:20:48 -04:00
daurnimator 8e9e126d41 std: add some basic windows user32 definitions 2020-04-12 02:28:52 -04:00
Andrew Kelley 66e76a0209 zig build system: correctly handle multiple output artifacts
Previously the zig build system incorrectly assumed that the only build
artifact was a binary. Now, when you enable the cache, only the output
dir is printed to stdout, and the zig build system iterates over the
files in that directory, copying them to the output directory.

To support this change:

 * Add `std.os.renameat`, `std.os.renameatZ`, and `std.os.renameatW`.
 * Fix `std.os.linux.renameat` not compiling due to typos.
 * Deprecate `std.fs.updateFile` and `std.fs.updateFileMode`.
 * Add `std.fs.Dir.updateFile`, which supports using open directory
   handles for both the source and destination paths, as well as an
   options parameter which allows overriding the mode.
 * Update `std.fs.AtomicFile` to support operating based on an open
   directory handle. Instead of `std.fs.AtomicFile.init`, use
   `std.fs.Dir.atomicFile`.
 * `std.fs.AtomicFile` deinit() better handles the situation when the
    rename fails but the temporary file still exists, by still
    attempting to remove the temporary file.
 * `std.fs.Dir.openFileWindows` is moved to `std.os.windows.OpenFileW`.
 * `std.os.RenameError` gains the error codes `NoDevice`,
   `SharingViolation`, and `PipeBusy` which have been observed from
   Windows.

Closes #4733
2020-03-13 21:22:08 -04:00
LemonBoy de53537f10 Add NtDll-based ftruncate implementation 2020-03-13 08:45:37 +01:00
LemonBoy 11df0d0cf8 std: Add setEndPos to fs.file
Allow the user to shrink/grow the file size as needed.
2020-03-12 09:43:45 +01:00
Andrew Kelley 7df9169081 Merge pull request #4651 from LemonBoy/fix-4645
std: Nicer way to access the PEB
2020-03-06 17:33:05 -05:00
Andrew Kelley 3163a16617 ?HMODULE instead of HMODULE 2020-03-06 16:57:59 -05:00
LemonBoy 2e04b61275 std: Work around unexported NtCurrentTeb
Apparently NtCurrentTeb is only exported for i386 and some other
platforms but not for x86_64 nor AArch64. Let's go with the flow and
provide our own NtCurrentTeb like the Windows headers do.

Thank you Microsoft.
2020-03-06 09:17:14 +01:00
LemonBoy b9a1d67637 std: Nicer way to access the PEB
Use the NtCurrentTeb API instead of using some inline asm, this is much
nicer and also more portable.

Closes #4645
2020-03-06 09:06:26 +01:00
Andrew Kelley ae99fabfe4 Merge pull request #4585 from LemonBoy/fix-4581
target: Implement OS version detection for Windows
2020-03-01 02:53:51 -05:00
daurnimator d0c22619f5 Complete windows PEB_LDR_DATA definition 2020-03-01 02:10:29 +11:00
daurnimator 513076ee9c Fill out PEB definition 2020-03-01 00:12:08 +11:00
LemonBoy f072b0c056 target: Implement OS version detection for Windows
Closes #4581
2020-02-29 12:02:40 +01:00
Andrew Kelley cfffb9c5e9 improve handling of environment variables on Windows
std.os.getenv and std.os.getenvZ have nice compile errors when not linking
libc and using Windows.

std.os.getenvW is provided as a Windows-only API that does not require
an allocator. It uses the Process Environment Block.
std.process.getEnvVarOwned is improved to be a simple wrapper on top of
std.os.getenvW.

std.process.getEnvMap is improved to use the Process Environment Block
rather than calling GetEnvironmentVariableW.

std.zig.system.NativePaths uses process.getEnvVarOwned instead of
std.os.getenvZ, which works on Windows as well as POSIX.
2020-02-22 17:35:36 -05:00
Andrew Kelley 8173fbfb66 implement os.faccessat for Windows 2020-02-16 17:10:43 -05:00
Andrew Kelley 702398dd0e Revert "windows: remove the 'A' versions of psapi functions"
This reverts commit 1cdefeb10b.

See #4426
2020-02-10 12:30:20 -05:00
Andrew Kelley 1cdefeb10b windows: remove the 'A' versions of psapi functions
See #534
2020-02-10 12:03:11 -05:00
Andrew Kelley a795c36d7b Merge pull request #4352 from LemonBoy/fix-4349
fmt: Respect trailing commas in field declarations
2020-02-02 15:27:53 -05:00
daurnimator 4f2652d504 Winsock errors can be an enum 2020-02-01 14:29:16 -05:00
LemonBoy 0bf91cce58 windows: Minor changes to psapi prototypes 2020-02-01 13:43:46 -05:00
LemonBoy 3640c682a2 Run zig fmt 2020-02-01 11:32:53 +01:00
Andrew Kelley e6a812c827 Merge pull request #4340 from daurnimator/ntstatus-as-enum
Windows error codes as non-exhaustive enums
2020-01-31 18:27:17 -05:00
LemonBoy c910aa8555 windows: Add GetCurrentProcess definition 2020-02-01 00:01:09 +01:00
LemonBoy 9ffc13b6c4 windows: Add psapi API
Export both the "old-style" definitions from psapi and the "new-style"
ones from kernel32.
2020-01-31 23:50:26 +01:00
daurnimator b9f720365c Turn win32 errors into a non-exhaustive enum 2020-01-31 22:33:55 +11:00
daurnimator 7cf0b02ab4 NTSTATUS is a non-exhaustive enum 2020-01-31 22:33:17 +11:00
Rocknest 94f29ae117 Remove intCast's 2020-01-30 08:53:38 +02:00
Rocknest b1884b3a62 Fix aarch64 2020-01-30 01:17:34 +02:00
Rocknest 4a4d6f2be9 Reorganize definitions 2020-01-29 23:15:17 +02:00
Andrew Kelley 7b73c7fe12 Merge branch 'std-utf16-sentinel-terminated' of https://github.com/daurnimator/zig 2020-01-07 16:13:34 -05:00
LemonBoy 563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
daurnimator 2662e50d27 std: sentinel terminated pointers for utf16 apis 2019-12-29 10:35:05 +11:00
Robin Voetter 4b4fbe3887 Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
daurnimator 8a71f77c4a std: lie about windows socklen_t signed-ness 2019-11-27 13:01:34 +11:00
daurnimator edc84e7ef7 std: add more winsock functions 2019-11-27 13:01:33 +11:00
daurnimator 19f26578c0 std: windows sockaddr constants come from ws2_32 2019-11-27 13:01:32 +11:00
daurnimator 8aa3d6019c std: add windows.USHORT definition 2019-11-27 13:01:30 +11:00