| author | |
| committer | |
| log | 8709326088b71246bb4825c5a883bccef552f3a8 |
| tree | d1e0a3db0833eed1fc8fefca5a8302281db15b87 |
| parent | fa8073795aff0fedd4422df0fe8c386b2121895d |
These functions have been unused for a long time (since cfffb9c5e96eeeae43cd724e2d02ec8c2b7714e0; the PEB is used for this stuff now), and the GetEnvironmentVariableW wrapper's parameter types don't make much sense to boot.
Contributes towards:
- https://github.com/ziglang/zig/issues/4426
- https://github.com/ziglang/zig/issues/18402 files changed, 0 insertions(+), 41 deletions(-)
lib/std/os/windows.zig-26| ... | @@ -1905,32 +1905,6 @@ pub fn SetFileCompletionNotificationModes(handle: HANDLE, flags: UCHAR) !void { | ... | @@ -1905,32 +1905,6 @@ pub fn SetFileCompletionNotificationModes(handle: HANDLE, flags: UCHAR) !void { |
| 1905 | } | 1905 | } |
| 1906 | } | 1906 | } |
| 1907 | 1907 | ||
| 1908 | pub const GetEnvironmentStringsError = error{OutOfMemory}; | ||
| 1909 | |||
| 1910 | pub fn GetEnvironmentStringsW() GetEnvironmentStringsError![*:0]u16 { | ||
| 1911 | return kernel32.GetEnvironmentStringsW() orelse return error.OutOfMemory; | ||
| 1912 | } | ||
| 1913 | |||
| 1914 | pub fn FreeEnvironmentStringsW(penv: [*:0]u16) void { | ||
| 1915 | assert(kernel32.FreeEnvironmentStringsW(penv) != 0); | ||
| 1916 | } | ||
| 1917 | |||
| 1918 | pub const GetEnvironmentVariableError = error{ | ||
| 1919 | EnvironmentVariableNotFound, | ||
| 1920 | Unexpected, | ||
| 1921 | }; | ||
| 1922 | |||
| 1923 | pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) GetEnvironmentVariableError!DWORD { | ||
| 1924 | const rc = kernel32.GetEnvironmentVariableW(lpName, lpBuffer, nSize); | ||
| 1925 | if (rc == 0) { | ||
| 1926 | switch (GetLastError()) { | ||
| 1927 | .ENVVAR_NOT_FOUND => return error.EnvironmentVariableNotFound, | ||
| 1928 | else => |err| return unexpectedError(err), | ||
| 1929 | } | ||
| 1930 | } | ||
| 1931 | return rc; | ||
| 1932 | } | ||
| 1933 | |||
| 1934 | pub const CreateProcessError = error{ | 1908 | pub const CreateProcessError = error{ |
| 1935 | FileNotFound, | 1909 | FileNotFound, |
| 1936 | AccessDenied, | 1910 | AccessDenied, |
lib/std/os/windows/kernel32.zig-15| ... | @@ -340,21 +340,6 @@ pub extern "kernel32" fn GetExitCodeProcess( | ... | @@ -340,21 +340,6 @@ pub extern "kernel32" fn GetExitCodeProcess( |
| 340 | // TODO: Already a wrapper for this, see `windows.GetCurrentProcess`. | 340 | // TODO: Already a wrapper for this, see `windows.GetCurrentProcess`. |
| 341 | pub extern "kernel32" fn GetCurrentProcess() callconv(.winapi) HANDLE; | 341 | pub extern "kernel32" fn GetCurrentProcess() callconv(.winapi) HANDLE; |
| 342 | 342 | ||
| 343 | // TODO: memcpy peb().ProcessParameters.Environment, mem.span(0). Requires locking the PEB. | ||
| 344 | pub extern "kernel32" fn GetEnvironmentStringsW() callconv(.winapi) ?LPWSTR; | ||
| 345 | |||
| 346 | // TODO: RtlFreeHeap on the output of GetEnvironmentStringsW. | ||
| 347 | pub extern "kernel32" fn FreeEnvironmentStringsW( | ||
| 348 | penv: LPWSTR, | ||
| 349 | ) callconv(.winapi) BOOL; | ||
| 350 | |||
| 351 | // TODO: Wrapper around RtlQueryEnvironmentVariable. | ||
| 352 | pub extern "kernel32" fn GetEnvironmentVariableW( | ||
| 353 | lpName: ?LPCWSTR, | ||
| 354 | lpBuffer: ?[*]WCHAR, | ||
| 355 | nSize: DWORD, | ||
| 356 | ) callconv(.winapi) DWORD; | ||
| 357 | |||
| 358 | // TODO: Wrapper around RtlSetEnvironmentVar. | 343 | // TODO: Wrapper around RtlSetEnvironmentVar. |
| 359 | pub extern "kernel32" fn SetEnvironmentVariableW( | 344 | pub extern "kernel32" fn SetEnvironmentVariableW( |
| 360 | lpName: LPCWSTR, | 345 | lpName: LPCWSTR, |