VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Using NetFileEnum to determine which files are open on server

Khursheed_Siddiqui  (3 Submissions)   Windows System Services   Visual Basic 5.0   Intermediate   Wed 3rd February 2021

Find out who is currently using which file on the server. I am using Windows NETFILEENUM CALL. The structure that i have used in this example is only for WIN NT/2000. If your are going to use WIN95/WIN98/ME grab the structure from msdn file_info_50. Please vote!!!!!

Inputs
Computername

API Declarations
Option Explicit
Private Const NERR_SUCCESS As Long = 0&
Private Const MAX_PREFERRED_LENGTH As Long = -1
Private Const ERROR_MORE_DATA As Long = 234&
Private Type FILE_INFO_3
fi3_id As Long
fi3_permissions As Long
fi3_num_locks As Long
fi3_Pathname As Long
fi3_username As Long
End Type
Private Declare Function NetFileEnum Lib "netapi32" _
(ByVal Servername As Long, _
ByVal Basepath As Long, _
ByVal Username As Long, _
ByVal level As Long, _
bufptr As Long, _
ByVal prefmaxlen As Long, _
entriesread As Long, _
totalentries As Long, _
resume_handle As Long) As Long
Private Declare Function NetApiBufferFree Lib "netapi32" _
(ByVal Buffer As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(pTo As Any, uFrom As Any, _
ByVal lSize As Long)
Private Declare Function lstrlenW Lib "kernel32" _
(ByVal lpString As Long) As Long

Rate Using NetFileEnum to determine which files are open on server (5(5 Vote))
Using NetFileEnum to determine which files are open on server.bas

Using NetFileEnum to determine which files are open on server Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters