@@ -60,7 +60,7 @@ pub fn CreateFile(
6060}
6161
6262pub 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
427427pub 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
620620pub 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
734734const 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
746746pub const TerminateProcessError = error {Unexpected };
@@ -779,11 +779,11 @@ pub fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) SetCon
779779
780780pub 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 ,
0 commit comments