in reply to A little help with Win32::API?

"On input, [*pcchBuf] is the full size of the buffer, including a space for a terminating null character.", so you're telling Windows $path has can accommodate 0 bytes. (A very useful trick is to call such functions twice, once to get the size needed, and once with the proper buffer size.)

my( $path, $pathLength ) = ( "\0" x 260, "\0" x 8 );

should be

use constant MAX_PATH => 260; my $path = "\0" x MAX_PATH; my $pathLength = pack('L', MAX_PATH);

By the way, 8 bytes was longer than needed.

Replies are listed 'Best First'.
Re^2: A little help with Win32::API? (solution)
by flamey (Scribe) on Apr 25, 2010 at 07:38 UTC
    thank you so much for explanation! and of course this fixes everything