Для просмотра списка открытых общих файлов на машине вы можете использовать ADSI (интерфейсы службы Active Directory).
Чтобы использовать эти интерфейсы из delphi, необходимо импортировать библиотеку типов Active DS

Затем получите доступ к интерфейсу IADsFileServiceOperations
, который содержит метод с именем Resources
, этот метод возвращает коллекцию со всеми открытыми общими ресурсами.
Проверьте этот пример кода
{$APPTYPE CONSOLE}
uses
ActiveDs_TLB,
Variants,
ActiveX,
SysUtils;
function ADsGetObject(lpszPathName:WideString; const riid:TGUID; out ppObject):HRESULT; safecall; external 'activeds.dll';
procedure ListSharedResourcesInUse;
var
FSO : IADsFileServiceOperations;
Resources : IADsCollection;
Resource : OleVariant;
pceltFetched : Cardinal;
oEnum : IEnumvariant;
begin
//establish the connection to ADSI
ADsGetObject('WinNT://./lanmanserver', IADsFileServiceOperations, FSO);
//get the resources interface
Resources := FSO.Resources;
//get the enumerator
oEnum:= IUnknown(Resources._NewEnum) as IEnumVariant;
while oEnum.Next(1, Resource, pceltFetched) = 0 do
begin
Writeln(Format('Resource %s User %s',[Resource.Path,Resource.User]));
Resource:=Unassigned;
end;
end;
begin
try
CoInitialize(nil);
try
ListSharedResourcesInUse;
finally
CoUninitialize;
end;
except
on E:Exception do
Writeln(E.Classname, ':', E.Message);
end;
Writeln('Press Enter to exit');
Readln;
end.