Debian Codegraph @

tests/inputs/issues/420/mixed_case_ext.Pl

raw
1 # https://stackoverflow.com/questions/1721807/how-do-i-create-then-use-long-windows-paths-from-perl#1722223
2 use Win32::API;
3 $cd = Win32::API->new('kernel32', 'CreateDirectoryW', 'PP', 'N');
4 $dir = '\\\\?\\c:\\Users\\IEUser\\!long_dir';
5
6 $res = 1;
7
8 my $i = 1;
9 do {
10 print 'path length: ' . length($dir) . "\n";
11 $dirname = pack('S*', unpack('C*', "$dir\0")); #dirty way to produce UTF-16LE string
12
13 $res = $cd->Call($dirname, 0);
14 print "$res\n";
15
16 $dir .= '\\' . sprintf "D%09d", $i;
17 ++$i;
18 $res = 0 if $i > 30;
19
20 } while ( $res );