I believe your declaration for WNetEnumResource is wrong: The MSDN declares it as
DWORD WNetEnumResource( HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize );
which I interpret as LPPP and not as PPPP. Try it with the following code:
my $WNetEnumResource= new Win32::API ("mpr", "WNetEnumResource", "VPPP +", "I") or die; my $count= pack ("V", -1); my $bufsize= 5000; $buffer= 'x' x (1+$bufsize); for (;;) { $bufsize= pack ("V", 5000); $result= $WNetEnumResource->Call ($handle, $count, $buffer, $bufsiz +e); print "result for WNetEnumResource is $result\n"; last if $result != 0; print "count=$count, bufsize=$bufsize\n"; print $buffer; # just to see if it's not all x's. }
Updated: The prototype should have been LPPP, and not VPPP
In reply to Re: Passing/Returning HANDLE's with Win32::API
by Corion
in thread Passing/Returning HANDLE's with Win32::API
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |