in reply to Win32-API-Prototype WNet
This is the progress I have made so far. Still not there and havent been able to get anything to output as yet.
#!/usr/bin/perl use strict; use Win32::API::Prototype; # NETRESOURCE #ApiLink('kernel.dll', # 'typedef struct _NETRESOURCE(DWORD dwScope, DWORD dwType,DWOR +D dwDisplayType, DWORD dwUsage, LPTSTR lpLocalName, LPTSTR lpRemoteNa +me, LPTSTR lpComment, LPTSTR lpProvider) NETRESOURCE'); # ---unable to parse function definition # WNetOpenEnum ApiLink('kernel32.dll', 'DWORD WNetOpenEnum(DWORD dwScope, DWORD dwType, DWORD dwUsage +, LPNETRESOURCE lpNetResource, LPHANDLE lphEnum)'); # WNetEnumResource ApiLink('kernel32.dll', 'DWORD WNetEnumResource(HANDLE hEnum, LPDWORD lpcCount, LPVOID + lpBuffer, LPDWORD lpBufferSize)'); # WNetCloseEnum ApiLink('kernel32.dll', 'DWORD WNetCloseEnum(HANDLE hEnum)'); # 4th WNetOpenEnum parameter - pointer to NETRESOURCE my $netresource = "NULL"; # assumes the root of the network # 5th WNetOpenEnum parameter - pointer to WNetEnumResource # define WNetEnumResource parameters my $hEnum; # must be returned by WNetOpenEnum my $lpcCount = "-1"; # returns as many entries as possible my $lpBuffer; # points to the buffer that receives +the emuneration results - don't know how to do this my $lpBufferSize = "16384"; # specifies the size of the lpBuffe +r parameter # actual pointer to WNetEnumResource my $WNetEnumResource = WNetEnumResource($hEnum, $lpcCount, $lpBuffer, +$lpBufferSize); # Process WNetEnumOpen to start enumeration of the network WNetOpenEnum("RESOURCE_CONNECTED", "RESOURCETYPE_ANY", 0, $netresource +, $WNetEnumResource); # To continue the enumeration, call WNetEnumResource
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32-API-Prototype WNet
by mdillon (Priest) on Mar 02, 2005 at 04:48 UTC |