>Good morning from Peru,
>
>I would like to know if there is any function from the Win NT API which can tell me which users are using a specific file, such as database.dbc
>
Under NT, the API calls NetFileEnum() and NetFileGetInfo() can get the list of files in use, and the users attached to them. They require either Administrator or Account Operator group membership for the user trying to retrieve the information. You'll want to invoke it at level 3, which retrieves arrays of FILE_INFO_3 structures that contain the userids, permissions and locks on the files under consideration.
Using these will require you to use structures, so a class like Paul Tatavu's POINTERS or my CLSHEAP will be needed to construct and decipher the necessary memory structures. You'll also need to deallocate the buffers returned by these functions using NetApiBufferFree() under Windows NT. I believe that Paul has posted an example using netFileEnum() with his POINTERS class in the FIles Section here on UT.
>In this way I could know which users are accesing the database we share on the server. I need to implement a procedure to ensure that the database has no users connected to it before the daily night processes run.
>
>Thanks for your help
>
>Fausto Garcia