| author | |
| committer | |
| log | 6e22b63edb8f87144b93dfd593e162f7c4129e8e |
| tree | 27fb1583d4d28c0d55aacc5ec6193841ab74a65e |
| parent | 901c3e96368bd9fa9ee9858c0295ee05ef1d7146 |
2 files changed, 18 insertions(+), 13 deletions(-)
lib/std/os.zig+1-13| ... | ... | @@ -1944,19 +1944,7 @@ pub fn getenvW(key: [*:0]const u16) ?[:0]const u16 { |
| 1944 | 1944 | while (ptr[i] != 0) : (i += 1) {} |
| 1945 | 1945 | const this_value = ptr[value_start..i :0]; |
| 1946 | 1946 | |
| 1947 | const key_string_bytes = @intCast(u16, key_slice.len * 2); | |
| 1948 | const key_string = windows.UNICODE_STRING{ | |
| 1949 | .Length = key_string_bytes, | |
| 1950 | .MaximumLength = key_string_bytes, | |
| 1951 | .Buffer = @intToPtr([*]u16, @ptrToInt(key)), | |
| 1952 | }; | |
| 1953 | const this_key_string_bytes = @intCast(u16, this_key.len * 2); | |
| 1954 | const this_key_string = windows.UNICODE_STRING{ | |
| 1955 | .Length = this_key_string_bytes, | |
| 1956 | .MaximumLength = this_key_string_bytes, | |
| 1957 | .Buffer = this_key.ptr, | |
| 1958 | }; | |
| 1959 | if (windows.ntdll.RtlEqualUnicodeString(&key_string, &this_key_string, windows.TRUE) == windows.TRUE) { | |
| 1947 | if (windows.eqlIgnoreCaseWTF16(key_slice, this_key)) { | |
| 1960 | 1948 | return this_value; |
| 1961 | 1949 | } |
| 1962 | 1950 |
lib/std/os/windows.zig+17| ... | ... | @@ -1824,6 +1824,23 @@ pub fn nanoSecondsToFileTime(ns: i128) FILETIME { |
| 1824 | 1824 | }; |
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | /// Compares two WTF16 strings using RtlEqualUnicodeString | |
| 1828 | pub fn eqlIgnoreCaseWTF16(a: []const u16, b: []const u16) bool { | |
| 1829 | const a_bytes = @intCast(u16, a.len * 2); | |
| 1830 | const a_string = UNICODE_STRING{ | |
| 1831 | .Length = a_bytes, | |
| 1832 | .MaximumLength = a_bytes, | |
| 1833 | .Buffer = @intToPtr([*]u16, @ptrToInt(a.ptr)), | |
| 1834 | }; | |
| 1835 | const b_bytes = @intCast(u16, b.len * 2); | |
| 1836 | const b_string = UNICODE_STRING{ | |
| 1837 | .Length = b_bytes, | |
| 1838 | .MaximumLength = b_bytes, | |
| 1839 | .Buffer = @intToPtr([*]u16, @ptrToInt(b.ptr)), | |
| 1840 | }; | |
| 1841 | return ntdll.RtlEqualUnicodeString(&a_string, &b_string, TRUE) == TRUE; | |
| 1842 | } | |
| 1843 | ||
| 1827 | 1844 | pub const PathSpace = struct { |
| 1828 | 1845 | data: [PATH_MAX_WIDE:0]u16, |
| 1829 | 1846 | len: usize, |