in reply to Passing/Returning HANDLE's with Win32::API
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing/Returning HANDLE's with Win32::API
by John M. Dlugosz (Monsignor) on Feb 07, 2005 at 23:31 UTC | |
by Corion (Patriarch) on Feb 07, 2005 at 23:33 UTC | |
by John M. Dlugosz (Monsignor) on Feb 08, 2005 at 16:24 UTC | |
by Corion (Patriarch) on Feb 09, 2005 at 08:43 UTC |