Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A Files Open Class/DLL Where is it?
Message
From
07/04/2000 11:07:51
 
 
To
07/04/2000 10:13:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00356836
Message ID:
00356900
Views:
8
>HI!
>I while ago I saw a DLL or API call example or something that would show me who had files open on a server.
>
>I can't seem to remember where it is anyone know?

You can also use ADSI to do this. The following code gets a reference to the server computer and enumerates all occurrences of open files, and fills a cursor with open files:
CREATE CURSOR Resources (Name C(5), User C(20), Path C(100), LockCount I)
lcComputer = "SERVERNAME"
oFileService = GETOBJECT("WinNT://" + lcComputer + "/lanmanserver")

FOR EACH oFileShare IN oFileService.Resources
	m.Name = oFileShare.Name
	m.User = oFileShare.User
	m.Path = oFileShare.Path
	m.LockCount = oFileShare.LockCount
	INSERT INTO Resources FROM MEMVAR
ENDFOR
From this cursor, you can run an SQL select to get all the files that a user has open, or all of the users that have a certain file open. Enumerating server resources from a client machine with ADSI, remember, imposes the same security limitations that any other method would. IOW, a normal user account will get access denied errors when trying to use this. If you want just any client machine to be able to get at this information, you'll have to put it in an Out-of-proc exe, and let that COM exe impersonate an account with rights to view this information. You can then call this exe from any client machine via DCOM.

FWIW, I think you will run into the same security issues with Paul's code.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform