Moin Holger,
ich kenne jetzt nicht die Deklarationen, die Du verwendest, aber so
Delphi-Quellcode:
const
NERR_Success = 0;
MAX_PREFERRED_LENGTH = DWORD(-1);
type
NET_API_STATUS = type DWORD;
PSHARE_INFO_0 = ^SHARE_INFO_0;
SHARE_INFO_0 = packed record
shi0_netname : PWCHAR;
end;
function NetApiBufferFree(const Buffer : Pointer) : NET_API_STATUS; stdcall; external 'netapi32.dll';
function NetShareEnum(const servername : PWCHAR;const level : DWORD;const bufptr : Pointer;const prefmaxlen : DWORD;
const entriesread : PDWORD;const totalentries : PDWORD;const resume_handle : PDWORD) : NET_API_STATUS; stdcall; external 'netapi32.dll';
var
si0Work : PSHARE_INFO_0;
si0Save : PSHARE_INFO_0;
dwEntriesRead : DWORD;
dwTotalEntries : DWORD;
i : DWORD;
begin
if NetShareEnum('\\192.168.1.2\',0,@si0Work,MAX_PREFERRED_LENGTH,@dwEntriesRead,@dwTotalEntries,nil) <> Nerr_Success then exit;
try
si0Save := si0Work;
for i := 1 to dwEntriesRead do begin
ComboBox1.Items.Add(si0Save.shi0_netname);
inc(si0Save);
end;
finally
NetApiBufferFree(si0Work);
end;
end;
hat es bei mir schon vor XP funktioniert (in einem Netzwerk mit NT 4.0 und 2000).