Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / April 2008



Tip: Looking for answers? Try searching our database.

NetFileEnum

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
drvice@nppd.com - 12 Apr 2008 04:41 GMT
I found this code on the internet today, and it's just what I need to
be able to enumerate the open files on our network servers.  However,
I keep getting error messages (specifically 123 and 1113) returned in
the dwStatus variable.  Can anyone tell me what these numeric messages
mean, or point me in the direction of some documentation on the
NetFileEnum call?

I think 123 means the network resource cannot be found..I feel this is
the case because if I try to contact "FOO", I get the 123 error.  I
thought 1113 might be a permissions error, but I logged into my PC
with a domain admin account and still received the error.

Any help would be appreciated.  Please?  :)

Dan

================================

       Const MAX_PREFERRED_LENGTH As Integer = -1
       Dim dwIndex, dwStatus, dwReadEntries, dwTotalEntries As
Integer
       Dim pCurrent As FILE_INFO_3
       Dim iPtr, pBuffer As IntPtr

       dwStatus = NetFileEnum(TextBox2.Text, Nothing, Nothing, 3,
pBuffer, MAX_PREFERRED_LENGTH, dwReadEntries, dwTotalEntries, Nothing)
       If dwStatus = 0 Then
           For dwIndex = 0 To dwReadEntries - 1

               iPtr = New IntPtr(pBuffer.ToInt32 + (dwIndex *
Len(pCurrent)))
               pCurrent = CType(Marshal.PtrToStructure(iPtr,
GetType(FILE_INFO_3)), FILE_INFO_3)

               TextBox1.Text += "dwIndex=" & dwIndex & vbNewLine
               TextBox1.Text += "   id: " & pCurrent.fi3_id &
vbNewLine
               TextBox1.Text += "   num_locks: " &
pCurrent.fi3_num_locks & vbNewLine
               TextBox1.Text += "   pathname: " &
pCurrent.fi3_pathname & vbNewLine
               TextBox1.Text += "   permission: " &
pCurrent.fi3_permission & vbNewLine
               TextBox1.Text += "   username: " &
pCurrent.fi3_username & vbNewLine & vbNewLine
           Next
       Else
           TextBox1.Text += "dwStatus returned " & dwStatus &
vbNewLine & vbNewLine
       End If

       NetApiBufferFree(pBuffer)
expvb - 12 Apr 2008 05:32 GMT
From the "+=" in your code, this appears to be a VB.Net code. This newsgroup
is for VB6 and lower. For VB.Net, please look in newsgroups with "dotnet" or
"vsnet" in the name.

Windows error codes can be looked up using a utility that comes with Visual
Studio in the Tools sub section in the Start menu. Look for "Error Lookup",
or "Visual C++ Error Lookup".
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.