AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to use NetFileEnum to get open files on a server

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
TheGood



Joined: 30 Jul 2007
Posts: 580

PostPosted: Sun Feb 15, 2009 8:07 pm    Post subject: How to use NetFileEnum to get open files on a server Reply with quote

It took me a while to figure this whole thing out, so I decided to share my findings!
This little example gives you a list of all the shared files currently open on the machine specified (see script for details) by using NetFileEnum.
You'll have to wrap it yourself if you want to use it in your own script.

Download

This script uses Titan's Anchor function (integrated in the script). Thanks!
Can someone with an OS < Windows 2000 please check if it works on your machine.


Last edited by TheGood on Mon Feb 16, 2009 1:07 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
TheGood



Joined: 30 Jul 2007
Posts: 580

PostPosted: Mon Feb 16, 2009 1:06 am    Post subject: Reply with quote

OK, it is now possible to see the list of open shared files on another computer. Just make sure you have the credentials to execute it or you'll get ERROR_ACCESS_DENIED.
Back to top
View user's profile Send private message Visit poster's website
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Mon Feb 16, 2009 4:18 pm    Post subject: Reply with quote

There is no NetFileEnum in netapi32.dll on Win98SE. Sad
But it's present in SVRAPI.DLL and RADMIN32.DLL (also a NetFileEnumA).
NetApiBufferFree is only present in RADMIN32.DLL.

However, calling any of the two doesn't get any result displayed.

The call to NetFileEnum in RADMIN32.DLL returns r=2351 and everything else is zero (pFileInfo, iCount, iTotal). Sad
Calling NetFileEnumA returns r=2106, everything else still zero.

ErrorLevel is zero in both cases.
_________________
AHK tools by Drugwash
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
TheGood



Joined: 30 Jul 2007
Posts: 580

PostPosted: Mon Feb 16, 2009 5:36 pm    Post subject: Reply with quote

Thanks for testing.
I found this sample code for Win95/98/Me showing how to use NetFileEnum. It seems like it takes one less argument and that the struct used (file_info_50) contains one less member.
When I have time, I'll install Win98 on a VM to test it out.
I'm in exam periods right now but I'll look into it in 2 or 3 weeks Very Happy
Back to top
View user's profile Send private message Visit poster's website
rajeshawate2001



Joined: 13 Oct 2011
Posts: 1

PostPosted: Thu Oct 13, 2011 4:13 pm    Post subject: not getting result from NetFileEnum Reply with quote

hi,

I'm using NetFileEnum in my project.
but i'm not getting correct result.
My project is in c#.
if i want to get result for files that are open on my machine(i.e. machine on which visual studio running), what parameters i have to pass?

i tried so many things like passing null value in servername, basepath, username etc, but didn't worked for me.

please tell me detailed information what shall i do to get proper result for my local machine.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group