Skip to content

Commit 2662e50

Browse files
committed
std: sentinel terminated pointers for utf16 apis
1 parent cb02125 commit 2662e50

File tree

13 files changed

+53
-64
lines changed

13 files changed

+53
-64
lines changed

lib/std/child_process.zig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,7 @@ pub const ChildProcess = struct {
582582
};
583583
var piProcInfo: windows.PROCESS_INFORMATION = undefined;
584584

585-
const cwd_slice = if (self.cwd) |cwd| try cstr.addNullByte(self.allocator, cwd) else null;
586-
defer if (cwd_slice) |cwd| self.allocator.free(cwd);
587-
const cwd_w = if (cwd_slice) |cwd| try unicode.utf8ToUtf16LeWithNull(self.allocator, cwd) else null;
585+
const cwd_w = if (self.cwd) |cwd| try unicode.utf8ToUtf16LeWithNull(self.allocator, cwd) else null;
588586
defer if (cwd_w) |cwd| self.allocator.free(cwd);
589587
const cwd_w_ptr = if (cwd_w) |cwd| cwd.ptr else null;
590588

@@ -701,7 +699,7 @@ pub const ChildProcess = struct {
701699
}
702700
};
703701

704-
fn windowsCreateProcess(app_name: [*]u16, cmd_line: [*]u16, envp_ptr: ?[*]u16, cwd_ptr: ?[*]u16, lpStartupInfo: *windows.STARTUPINFOW, lpProcessInformation: *windows.PROCESS_INFORMATION) !void {
702+
fn windowsCreateProcess(app_name: [*:0]u16, cmd_line: [*:0]u16, envp_ptr: ?[*]u16, cwd_ptr: ?[*:0]u16, lpStartupInfo: *windows.STARTUPINFOW, lpProcessInformation: *windows.PROCESS_INFORMATION) !void {
705703
// TODO the docs for environment pointer say:
706704
// > A pointer to the environment block for the new process. If this parameter
707705
// > is NULL, the new process uses the environment of the calling process.

lib/std/fs/file.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub const File = struct {
6060
}
6161

6262
/// Deprecated; call `std.fs.Dir.openFileW` directly.
63-
pub fn openReadW(path_w: [*]const u16) OpenError!File {
63+
pub fn openReadW(path_w: [*:0]const u16) OpenError!File {
6464
return std.fs.cwd().openFileW(path_w, .{});
6565
}
6666

lib/std/fs/get_app_data_dir.zig

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub const GetAppDataDirError = error{
1515
pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataDirError![]u8 {
1616
switch (builtin.os) {
1717
.windows => {
18-
var dir_path_ptr: [*]u16 = undefined;
18+
var dir_path_ptr: [*:0]u16 = undefined;
1919
switch (os.windows.shell32.SHGetKnownFolderPath(
2020
&os.windows.FOLDERID_LocalAppData,
2121
os.windows.KF_FLAG_CREATE,
@@ -24,7 +24,7 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD
2424
)) {
2525
os.windows.S_OK => {
2626
defer os.windows.ole32.CoTaskMemFree(@ptrCast(*c_void, dir_path_ptr));
27-
const global_dir = unicode.utf16leToUtf8Alloc(allocator, utf16lePtrSlice(dir_path_ptr)) catch |err| switch (err) {
27+
const global_dir = unicode.utf16leToUtf8Alloc(allocator, mem.toSliceConst(u16, dir_path_ptr)) catch |err| switch (err) {
2828
error.UnexpectedSecondSurrogateHalf => return error.AppDataDirUnavailable,
2929
error.ExpectedSecondSurrogateHalf => return error.AppDataDirUnavailable,
3030
error.DanglingSurrogateHalf => return error.AppDataDirUnavailable,
@@ -55,12 +55,6 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD
5555
}
5656
}
5757

58-
fn utf16lePtrSlice(ptr: [*]const u16) []const u16 {
59-
var index: usize = 0;
60-
while (ptr[index] != 0) : (index += 1) {}
61-
return ptr[0..index];
62-
}
63-
6458
test "getAppDataDir" {
6559
var buf: [512]u8 = undefined;
6660
const allocator = &std.heap.FixedBufferAllocator.init(buf[0..]).allocator;

lib/std/os.zig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,9 +2634,7 @@ pub fn realpathW(pathname: [*:0]const u16, out_buffer: *[MAX_PATH_BYTES]u8) Real
26342634
defer windows.CloseHandle(h_file);
26352635

26362636
var wide_buf: [windows.PATH_MAX_WIDE]u16 = undefined;
2637-
const wide_len = try windows.GetFinalPathNameByHandleW(h_file, &wide_buf, wide_buf.len, windows.VOLUME_NAME_DOS);
2638-
assert(wide_len <= wide_buf.len);
2639-
const wide_slice = wide_buf[0..wide_len];
2637+
const wide_slice = try windows.GetFinalPathNameByHandleW(h_file, &wide_buf, wide_buf.len, windows.VOLUME_NAME_DOS);
26402638

26412639
// Windows returns \\?\ prepended to the path.
26422640
// We strip it to make this function consistent across platforms.

lib/std/os/uefi/protocols/simple_text_output_protocol.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const Guid = uefi.Guid;
44
/// Character output devices
55
pub const SimpleTextOutputProtocol = extern struct {
66
_reset: extern fn (*const SimpleTextOutputProtocol, bool) usize,
7-
_output_string: extern fn (*const SimpleTextOutputProtocol, [*]const u16) usize,
8-
_test_string: extern fn (*const SimpleTextOutputProtocol, [*]const u16) usize,
7+
_output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize,
8+
_test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize,
99
_query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) usize,
1010
_set_mode: extern fn (*const SimpleTextOutputProtocol, usize) usize,
1111
_set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) usize,
@@ -20,12 +20,12 @@ pub const SimpleTextOutputProtocol = extern struct {
2020
}
2121

2222
/// Writes a string to the output device.
23-
pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*]const u16) usize {
23+
pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) usize {
2424
return self._output_string(self, msg);
2525
}
2626

2727
/// Verifies that all characters in a string can be output to the target device.
28-
pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*]const u16) usize {
28+
pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) usize {
2929
return self._test_string(self, msg);
3030
}
3131

lib/std/os/uefi/tables/runtime_services.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ pub const RuntimeServices = extern struct {
2525
convertPointer: usize, // TODO
2626

2727
/// Returns the value of a variable.
28-
getVariable: extern fn ([*]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize,
28+
getVariable: extern fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize,
2929

3030
/// Enumerates the current variable names.
3131
getNextVariableName: extern fn (*usize, [*]u16, *align(8) Guid) usize,
3232

3333
/// Sets the value of a variable.
34-
setVariable: extern fn ([*]const u16, *align(8) const Guid, u32, usize, *c_void) usize,
34+
setVariable: extern fn ([*:0]const u16, *align(8) const Guid, u32, usize, *c_void) usize,
3535

3636
getNextHighMonotonicCount: usize, // TODO
3737

lib/std/os/uefi/tables/system_table.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub const SystemTable = extern struct {
1919
hdr: TableHeader,
2020

2121
/// A null-terminated string that identifies the vendor that produces the system firmware of the platform.
22-
firmware_vendor: [*]u16,
22+
firmware_vendor: [*:0]u16,
2323
firmware_revision: u32,
2424
console_in_handle: ?Handle,
2525
con_in: ?*SimpleTextInputProtocol,

lib/std/os/windows.zig

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn CreateFile(
6060
}
6161

6262
pub fn CreateFileW(
63-
file_path_w: [*]const u16,
63+
file_path_w: [*:0]const u16,
6464
desired_access: DWORD,
6565
share_mode: DWORD,
6666
lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES,
@@ -425,8 +425,8 @@ pub fn CreateSymbolicLink(
425425
}
426426

427427
pub fn CreateSymbolicLinkW(
428-
sym_link_path: [*]const u16,
429-
target_path: [*]const u16,
428+
sym_link_path: [*:0]const u16,
429+
target_path: [*:0]const u16,
430430
flags: DWORD,
431431
) CreateSymbolicLinkError!void {
432432
if (kernel32.CreateSymbolicLinkW(sym_link_path, target_path, flags) == 0) {
@@ -449,7 +449,7 @@ pub fn DeleteFile(filename: []const u8) DeleteFileError!void {
449449
return DeleteFileW(&filename_w);
450450
}
451451

452-
pub fn DeleteFileW(filename: [*]const u16) DeleteFileError!void {
452+
pub fn DeleteFileW(filename: [*:0]const u16) DeleteFileError!void {
453453
if (kernel32.DeleteFileW(filename) == 0) {
454454
switch (kernel32.GetLastError()) {
455455
ERROR.FILE_NOT_FOUND => return error.FileNotFound,
@@ -471,7 +471,7 @@ pub fn MoveFileEx(old_path: []const u8, new_path: []const u8, flags: DWORD) Move
471471
return MoveFileExW(&old_path_w, &new_path_w, flags);
472472
}
473473

474-
pub fn MoveFileExW(old_path: [*]const u16, new_path: [*]const u16, flags: DWORD) MoveFileError!void {
474+
pub fn MoveFileExW(old_path: [*:0]const u16, new_path: [*:0]const u16, flags: DWORD) MoveFileError!void {
475475
if (kernel32.MoveFileExW(old_path, new_path, flags) == 0) {
476476
switch (kernel32.GetLastError()) {
477477
else => |err| return unexpectedError(err),
@@ -490,7 +490,7 @@ pub fn CreateDirectory(pathname: []const u8, attrs: ?*SECURITY_ATTRIBUTES) Creat
490490
return CreateDirectoryW(&pathname_w, attrs);
491491
}
492492

493-
pub fn CreateDirectoryW(pathname: [*]const u16, attrs: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!void {
493+
pub fn CreateDirectoryW(pathname: [*:0]const u16, attrs: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!void {
494494
if (kernel32.CreateDirectoryW(pathname, attrs) == 0) {
495495
switch (kernel32.GetLastError()) {
496496
ERROR.ALREADY_EXISTS => return error.PathAlreadyExists,
@@ -511,7 +511,7 @@ pub fn RemoveDirectory(dir_path: []const u8) RemoveDirectoryError!void {
511511
return RemoveDirectoryW(&dir_path_w);
512512
}
513513

514-
pub fn RemoveDirectoryW(dir_path_w: [*]const u16) RemoveDirectoryError!void {
514+
pub fn RemoveDirectoryW(dir_path_w: [*:0]const u16) RemoveDirectoryError!void {
515515
if (kernel32.RemoveDirectoryW(dir_path_w) == 0) {
516516
switch (kernel32.GetLastError()) {
517517
ERROR.PATH_NOT_FOUND => return error.FileNotFound,
@@ -602,7 +602,7 @@ pub fn GetFinalPathNameByHandleW(
602602
buf_ptr: [*]u16,
603603
buf_len: DWORD,
604604
flags: DWORD,
605-
) GetFinalPathNameByHandleError!DWORD {
605+
) GetFinalPathNameByHandleError![:0]u16 {
606606
const rc = kernel32.GetFinalPathNameByHandleW(hFile, buf_ptr, buf_len, flags);
607607
if (rc == 0) {
608608
switch (kernel32.GetLastError()) {
@@ -614,7 +614,7 @@ pub fn GetFinalPathNameByHandleW(
614614
else => |err| return unexpectedError(err),
615615
}
616616
}
617-
return rc;
617+
return buf_ptr[0..rc :0];
618618
}
619619

620620
pub const GetFileSizeError = error{Unexpected};
@@ -640,7 +640,7 @@ pub fn GetFileAttributes(filename: []const u8) GetFileAttributesError!DWORD {
640640
return GetFileAttributesW(&filename_w);
641641
}
642642

643-
pub fn GetFileAttributesW(lpFileName: [*]const u16) GetFileAttributesError!DWORD {
643+
pub fn GetFileAttributesW(lpFileName: [*:0]const u16) GetFileAttributesError!DWORD {
644644
const rc = kernel32.GetFileAttributesW(lpFileName);
645645
if (rc == INVALID_FILE_ATTRIBUTES) {
646646
switch (kernel32.GetLastError()) {
@@ -733,14 +733,14 @@ pub fn WSAIoctl(
733733

734734
const GetModuleFileNameError = error{Unexpected};
735735

736-
pub fn GetModuleFileNameW(hModule: ?HMODULE, buf_ptr: [*]u16, buf_len: DWORD) GetModuleFileNameError![]u16 {
736+
pub fn GetModuleFileNameW(hModule: ?HMODULE, buf_ptr: [*]u16, buf_len: DWORD) GetModuleFileNameError![:0]u16 {
737737
const rc = kernel32.GetModuleFileNameW(hModule, buf_ptr, buf_len);
738738
if (rc == 0) {
739739
switch (kernel32.GetLastError()) {
740740
else => |err| return unexpectedError(err),
741741
}
742742
}
743-
return buf_ptr[0..rc];
743+
return buf_ptr[0..rc :0];
744744
}
745745

746746
pub const TerminateProcessError = error{Unexpected};
@@ -779,11 +779,11 @@ pub fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) SetCon
779779

780780
pub const GetEnvironmentStringsError = error{OutOfMemory};
781781

782-
pub fn GetEnvironmentStringsW() GetEnvironmentStringsError![*]u16 {
782+
pub fn GetEnvironmentStringsW() GetEnvironmentStringsError![*:0]u16 {
783783
return kernel32.GetEnvironmentStringsW() orelse return error.OutOfMemory;
784784
}
785785

786-
pub fn FreeEnvironmentStringsW(penv: [*]u16) void {
786+
pub fn FreeEnvironmentStringsW(penv: [*:0]u16) void {
787787
assert(kernel32.FreeEnvironmentStringsW(penv) != 0);
788788
}
789789

@@ -792,7 +792,7 @@ pub const GetEnvironmentVariableError = error{
792792
Unexpected,
793793
};
794794

795-
pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: LPWSTR, nSize: DWORD) GetEnvironmentVariableError!DWORD {
795+
pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) GetEnvironmentVariableError!DWORD {
796796
const rc = kernel32.GetEnvironmentVariableW(lpName, lpBuffer, nSize);
797797
if (rc == 0) {
798798
switch (kernel32.GetLastError()) {
@@ -850,7 +850,7 @@ pub const LoadLibraryError = error{
850850
Unexpected,
851851
};
852852

853-
pub fn LoadLibraryW(lpLibFileName: [*]const u16) LoadLibraryError!HMODULE {
853+
pub fn LoadLibraryW(lpLibFileName: [*:0]const u16) LoadLibraryError!HMODULE {
854854
return kernel32.LoadLibraryW(lpLibFileName) orelse {
855855
switch (kernel32.GetLastError()) {
856856
ERROR.FILE_NOT_FOUND => return error.FileNotFound,

lib/std/os/windows/bits.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ pub const FARPROC = *@OpaqueType();
3333
pub const INT = c_int;
3434
pub const LPBYTE = *BYTE;
3535
pub const LPCH = *CHAR;
36-
pub const LPCSTR = [*]const CHAR;
37-
pub const LPCTSTR = [*]const TCHAR;
36+
pub const LPCSTR = [*:0]const CHAR;
37+
pub const LPCTSTR = [*:0]const TCHAR;
3838
pub const LPCVOID = *const c_void;
3939
pub const LPDWORD = *DWORD;
40-
pub const LPSTR = [*]CHAR;
40+
pub const LPSTR = [*:0]CHAR;
4141
pub const LPTSTR = if (UNICODE) LPWSTR else LPSTR;
4242
pub const LPVOID = *c_void;
43-
pub const LPWSTR = [*]WCHAR;
44-
pub const LPCWSTR = [*]const WCHAR;
43+
pub const LPWSTR = [*:0]WCHAR;
44+
pub const LPCWSTR = [*:0]const WCHAR;
4545
pub const PVOID = *c_void;
46-
pub const PWSTR = [*]WCHAR;
46+
pub const PWSTR = [*:0]WCHAR;
4747
pub const SIZE_T = usize;
4848
pub const TCHAR = if (UNICODE) WCHAR else u8;
4949
pub const UINT = c_uint;

lib/std/os/windows/kernel32.zig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub extern "kernel32" stdcallcc fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVE
77

88
pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL;
99

10-
pub extern "kernel32" stdcallcc fn CreateDirectoryW(lpPathName: [*]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) BOOL;
10+
pub extern "kernel32" stdcallcc fn CreateDirectoryW(lpPathName: [*:0]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) BOOL;
1111

1212
pub extern "kernel32" stdcallcc fn CreateEventExW(
1313
lpEventAttributes: ?*SECURITY_ATTRIBUTES,
@@ -17,7 +17,7 @@ pub extern "kernel32" stdcallcc fn CreateEventExW(
1717
) ?HANDLE;
1818

1919
pub extern "kernel32" stdcallcc fn CreateFileW(
20-
lpFileName: [*]const u16, // TODO null terminated pointer type
20+
lpFileName: [*:0]const u16,
2121
dwDesiredAccess: DWORD,
2222
dwShareMode: DWORD,
2323
lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES,
@@ -46,7 +46,7 @@ pub extern "kernel32" stdcallcc fn CreateProcessW(
4646
lpProcessInformation: *PROCESS_INFORMATION,
4747
) BOOL;
4848

49-
pub extern "kernel32" stdcallcc fn CreateSymbolicLinkW(lpSymlinkFileName: [*]const u16, lpTargetFileName: [*]const u16, dwFlags: DWORD) BOOLEAN;
49+
pub extern "kernel32" stdcallcc fn CreateSymbolicLinkW(lpSymlinkFileName: [*:0]const u16, lpTargetFileName: [*:0]const u16, dwFlags: DWORD) BOOLEAN;
5050

5151
pub extern "kernel32" stdcallcc fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) ?HANDLE;
5252

@@ -63,19 +63,19 @@ pub extern "kernel32" stdcallcc fn DeviceIoControl(
6363
lpOverlapped: ?*OVERLAPPED,
6464
) BOOL;
6565

66-
pub extern "kernel32" stdcallcc fn DeleteFileW(lpFileName: [*]const u16) BOOL;
66+
pub extern "kernel32" stdcallcc fn DeleteFileW(lpFileName: [*:0]const u16) BOOL;
6767

6868
pub extern "kernel32" stdcallcc fn DuplicateHandle(hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, lpTargetHandle: *HANDLE, dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwOptions: DWORD) BOOL;
6969

7070
pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn;
7171

72-
pub extern "kernel32" stdcallcc fn FindFirstFileW(lpFileName: [*]const u16, lpFindFileData: *WIN32_FIND_DATAW) HANDLE;
72+
pub extern "kernel32" stdcallcc fn FindFirstFileW(lpFileName: [*:0]const u16, lpFindFileData: *WIN32_FIND_DATAW) HANDLE;
7373
pub extern "kernel32" stdcallcc fn FindClose(hFindFile: HANDLE) BOOL;
7474
pub extern "kernel32" stdcallcc fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) BOOL;
7575

76-
pub extern "kernel32" stdcallcc fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: DWORD, dwLanguageId: DWORD, lpBuffer: LPWSTR, nSize: DWORD, Arguments: ?*va_list) DWORD;
76+
pub extern "kernel32" stdcallcc fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: DWORD, dwLanguageId: DWORD, lpBuffer: [*]u16, nSize: DWORD, Arguments: ?*va_list) DWORD;
7777

78-
pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsW(penv: [*]u16) BOOL;
78+
pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsW(penv: [*:0]u16) BOOL;
7979

8080
pub extern "kernel32" stdcallcc fn GetCommandLineA() LPSTR;
8181

@@ -88,9 +88,9 @@ pub extern "kernel32" stdcallcc fn GetCurrentDirectoryW(nBufferLength: DWORD, lp
8888
pub extern "kernel32" stdcallcc fn GetCurrentThread() HANDLE;
8989
pub extern "kernel32" stdcallcc fn GetCurrentThreadId() DWORD;
9090

91-
pub extern "kernel32" stdcallcc fn GetEnvironmentStringsW() ?[*]u16;
91+
pub extern "kernel32" stdcallcc fn GetEnvironmentStringsW() ?[*:0]u16;
9292

93-
pub extern "kernel32" stdcallcc fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: LPWSTR, nSize: DWORD) DWORD;
93+
pub extern "kernel32" stdcallcc fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) DWORD;
9494

9595
pub extern "kernel32" stdcallcc fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: *DWORD) BOOL;
9696

@@ -150,8 +150,8 @@ pub extern "kernel32" stdcallcc fn VirtualAlloc(lpAddress: ?LPVOID, dwSize: SIZE
150150
pub extern "kernel32" stdcallcc fn VirtualFree(lpAddress: ?LPVOID, dwSize: SIZE_T, dwFreeType: DWORD) BOOL;
151151

152152
pub extern "kernel32" stdcallcc fn MoveFileExW(
153-
lpExistingFileName: [*]const u16,
154-
lpNewFileName: [*]const u16,
153+
lpExistingFileName: [*:0]const u16,
154+
lpNewFileName: [*:0]const u16,
155155
dwFlags: DWORD,
156156
) BOOL;
157157

@@ -180,7 +180,7 @@ pub extern "kernel32" stdcallcc fn ReadFile(
180180
in_out_lpOverlapped: ?*OVERLAPPED,
181181
) BOOL;
182182

183-
pub extern "kernel32" stdcallcc fn RemoveDirectoryW(lpPathName: [*]const u16) BOOL;
183+
pub extern "kernel32" stdcallcc fn RemoveDirectoryW(lpPathName: [*:0]const u16) BOOL;
184184

185185
pub extern "kernel32" stdcallcc fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) BOOL;
186186

@@ -234,7 +234,7 @@ pub extern "kernel32" stdcallcc fn WriteFile(
234234

235235
pub extern "kernel32" stdcallcc fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) BOOL;
236236

237-
pub extern "kernel32" stdcallcc fn LoadLibraryW(lpLibFileName: [*]const u16) ?HMODULE;
237+
pub extern "kernel32" stdcallcc fn LoadLibraryW(lpLibFileName: [*:0]const u16) ?HMODULE;
238238

239239
pub extern "kernel32" stdcallcc fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) ?FARPROC;
240240

0 commit comments

Comments
 (0)