| View previous topic :: View next topic |
| Author |
Message |
TheGood
Joined: 30 Jul 2007 Posts: 580
|
Posted: Sun Feb 15, 2009 8:07 pm Post subject: How to use NetFileEnum to get open files on a server |
|
|
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 |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 580
|
Posted: Mon Feb 16, 2009 1:06 am Post subject: |
|
|
| 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 |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Mon Feb 16, 2009 4:18 pm Post subject: |
|
|
There is no NetFileEnum in netapi32.dll on Win98SE.
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).
Calling NetFileEnumA returns r=2106, everything else still zero.
ErrorLevel is zero in both cases. _________________ AHK tools by Drugwash |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 580
|
Posted: Mon Feb 16, 2009 5:36 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
rajeshawate2001
Joined: 13 Oct 2011 Posts: 1
|
Posted: Thu Oct 13, 2011 4:13 pm Post subject: not getting result from NetFileEnum |
|
|
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 |
|
 |
|