Skip to content

Commit 8709326

Browse files
squeek502alexrp
authored andcommitted
windows: Delete obsolete environment variable kernel32 wrappers and bindings
These functions have been unused for a long time (since cfffb9c; the PEB is used for this stuff now), and the GetEnvironmentVariableW wrapper's parameter types don't make much sense to boot. Contributes towards: - #4426 - #1840
1 parent fa80737 commit 8709326

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

lib/std/os/windows.zig

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,32 +1905,6 @@ pub fn SetFileCompletionNotificationModes(handle: HANDLE, flags: UCHAR) !void {
19051905
}
19061906
}
19071907

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-
19341908
pub const CreateProcessError = error{
19351909
FileNotFound,
19361910
AccessDenied,

lib/std/os/windows/kernel32.zig

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -340,21 +340,6 @@ pub extern "kernel32" fn GetExitCodeProcess(
340340
// TODO: Already a wrapper for this, see `windows.GetCurrentProcess`.
341341
pub extern "kernel32" fn GetCurrentProcess() callconv(.winapi) HANDLE;
342342

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-
358343
// TODO: Wrapper around RtlSetEnvironmentVar.
359344
pub extern "kernel32" fn SetEnvironmentVariableW(
360345
lpName: LPCWSTR,

0 commit comments

Comments
 (0)