@@ -128,7 +128,10 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
128
128
.OBJECT_NAME_COLLISION = > return error .PathAlreadyExists ,
129
129
.FILE_IS_A_DIRECTORY = > return error .IsDir ,
130
130
.NOT_A_DIRECTORY = > return error .NotDir ,
131
- else = > return unexpectedStatus (rc ),
131
+ else = > {
132
+ std .debug .print ("OpenFile = {}\n " , .{rc });
133
+ return unexpectedStatus (rc );
134
+ },
132
135
}
133
136
}
134
137
}
@@ -212,7 +215,10 @@ pub fn DeviceIoControl(
212
215
switch (rc ) {
213
216
.SUCCESS = > {},
214
217
.INVALID_PARAMETER = > unreachable ,
215
- else = > return unexpectedStatus (rc ),
218
+ else = > {
219
+ std .debug .print ("DeviceIoControl = {}\n " , .{rc });
220
+ return unexpectedStatus (rc );
221
+ },
216
222
}
217
223
}
218
224
@@ -930,7 +936,10 @@ pub fn GetFinalPathNameByHandle(
930
936
switch (rc ) {
931
937
.SUCCESS = > {},
932
938
.INVALID_PARAMETER = > unreachable ,
933
- else = > return unexpectedStatus (rc ),
939
+ else = > {
940
+ std .debug .print ("FileNormalizedNameInformation = {}\n " , .{rc });
941
+ return unexpectedStatus (rc );
942
+ },
934
943
}
935
944
936
945
// Get NT volume name.
@@ -939,7 +948,10 @@ pub fn GetFinalPathNameByHandle(
939
948
switch (rc ) {
940
949
.SUCCESS = > {},
941
950
.INVALID_PARAMETER = > unreachable ,
942
- else = > return unexpectedStatus (rc ),
951
+ else = > {
952
+ std .debug .print ("FileVolumeNameInformation = {}\n " , .{rc });
953
+ return unexpectedStatus (rc );
954
+ },
943
955
}
944
956
945
957
const file_name = @ptrCast (* const FILE_NAME_INFORMATION , @alignCast (@alignOf (FILE_NAME_INFORMATION ), & path_buffer [0 ]));
@@ -986,6 +998,10 @@ pub fn GetFinalPathNameByHandle(
986
998
error .PipeBusy = > unreachable ,
987
999
error .PathAlreadyExists = > unreachable ,
988
1000
error .WouldBlock = > unreachable ,
1001
+ error .Unexpected = > {
1002
+ std .debug .print ("when opening \\ MountPointManager\n " , .{});
1003
+ return error .Unexpected ;
1004
+ },
989
1005
else = > | e | return e ,
990
1006
};
991
1007
defer CloseHandle (mgmt_handle );
@@ -1002,6 +1018,10 @@ pub fn GetFinalPathNameByHandle(
1002
1018
output_buf [0.. ],
1003
1019
);
1004
1020
const mount_points_struct = @ptrCast (* const MOUNTMGR_MOUNT_POINTS , @alignCast (@alignOf (MOUNTMGR_MOUNT_POINTS ), & output_buf [0 ]));
1021
+ {
1022
+ std .debug .print ("input_buf = {}\n " , .{input_buf });
1023
+ std .debug .print ("output_buf = {}\n " , .{output_buf });
1024
+ }
1005
1025
1006
1026
const mount_points = @ptrCast (
1007
1027
[* ]const MOUNTMGR_MOUNT_POINT ,
@@ -1014,6 +1034,11 @@ pub fn GetFinalPathNameByHandle(
1014
1034
[* ]const u16 ,
1015
1035
@alignCast (@alignOf (u16 ), & output_buf [mount_point .SymbolicLinkNameOffset ]),
1016
1036
)[0 .. mount_point .SymbolicLinkNameLength / 2 ];
1037
+ {
1038
+ var buf : [1024 ]u8 = undefined ;
1039
+ const len = std .unicode .utf16leToUtf8 (buf [0.. ], symlink ) catch unreachable ;
1040
+ std .debug .print ("symlink = {}\n " , .{buf [0.. len ]});
1041
+ }
1017
1042
1018
1043
// Look for `\DosDevices\` prefix. We don't really care if there are more than one symlinks
1019
1044
// with traditional DOS drive letters, so pick the first one available.
@@ -1023,6 +1048,11 @@ pub fn GetFinalPathNameByHandle(
1023
1048
if (idx != 0 ) continue ;
1024
1049
1025
1050
const drive_letter = std .mem .trimLeft (u16 , symlink , prefix );
1051
+ {
1052
+ var buf : [1024 ]u8 = undefined ;
1053
+ const len = std .unicode .utf16leToUtf8 (buf [0.. ], drive_letter ) catch unreachable ;
1054
+ std .debug .print ("drive_letter = {}\n " , .{buf [0.. len ]});
1055
+ }
1026
1056
1027
1057
if (out_buffer .len < drive_letter .len + file_name_u16 .len ) return error .NameTooLong ;
1028
1058
0 commit comments