Показываем расшаренные ресурсы для IP
Показываем расшаренные ресурсы для IP
Показываем расшаренные ресурсы для IP procedure Get_shares(IP: String; List: TStrings); var hNetEnum: THandle; NetContainerToOpen: NETRESOURCE; ResourceBuffer: array[1..2000] of TNetResource; i, a, ResourceBuf, EntiriesToGet: DWORD; begin NetContainerToOpen.dwScope:=RESOURCE_GLOBALNET; NetContainerToOpen.dwType:=RESOURCETYPE_ANY; NetContainerToOpen.lpLocalName:=nil; NetContainerToOpen.lpRemoteName:=PChar(''+IP); NetContainerToOpen.lpProvider:=nil; WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, RESOURCEUSAGE_CONNECTABLE or RESOURCEUSAGE_CONTAINER, @NetContainerToOpen, hNetEnum); while TRUE do begin RESOURCEBUF:= sizeof(ResourceBuffer); EntiriesToGet:=2000; if (NO_ERROR<> WNetEnumResource(hNetEnum, EntiriesToGet, @ResourceBuffer, ResourceBuf)) then begin WNetCloseEnum(hNetEnum); exit; end; for i:=1 to EntiriesToGet do List.Add(string(ResourceBuffer[i].lpRemoteName)); end; end; procedure TForm1.Button1Click(Sender: TObject); begin Get_shares(edit1.text, Memo1.lines); end;