[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Users on a shared resource

I want to find out who is using a shared resource on my Windows95 machine.
Something similar to the net watcher application delivered with Windows 95.
This seams to be a lot easier with NT than on win95.
Anybody know how I can find out which user is using which files on a shared resource?
Tnx
0
PLC
Asked:
PLC
  • 4
  • 3
1 Solution
 
MadshiCommented:
Perhaps NetFileEnum helps? But watch out - like all net APIs this API has different parameters under win9x than it has under winNT. Normally you find only the parameters for winNT. Look in the "svrapi.h" for the win9x headers.

Regards, Madshi.
0
 
PLCAuthor Commented:
Netfileenum is definitely the api that I need. Only trouble is that by now I got plenty of comments, info, examples from all kinds of sources on how to use and on NT it works fine, on win95 all I get is error 87.
Is there anybody who has ever done this on win95?
0
 
MadshiCommented:
Not yet. At least not this API. But if your show me your sources (please not too long... :-), I'll find a bug perhaps.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
MadshiCommented:
BTW: 87 is ERROR_INVALID_PARAMETER...
0
 
PLCAuthor Commented:
Oops seem to have deleted that code, probably in frustration :-); but this gave the same problem, so probably the same error.
tnx

Function NetSessionEnum(ServerName:PWideChar;UNCCLientName:PWideChar;
                        Usernaam:PWideChar;Level:DWord;lpInfo:Pointer;
                        Maxlen:DWORD;EntriesRead:PDWORD;Totalentries:PDWord;
                        hEnum:PDWord):DWORD stdcall;
function NetSessionEnum; external 'svrapi.dll' name 'NetSessionEnum';

procedure TForm1.Button2Click(Sender: TObject);
var hEnum:PDWord;
    Result:Integer;
    NetRes:PInfo;
    NetResult:Array[0..200] of SESSION_INFO_10;
    maxlen:DWord;
    entriesread,totalentries:PDword;
begin
maxlen:=1000; Entriesread:=0;Totalentries:=0;    
NetRes:=Addr(NetResult);
Result:=0;
While Result=0 do
begin
 Result:=NetSessionEnum(nil,
                       nil,
                       nil,
                       10,
                       Netres,
                       Maxlen,
                       EntriesRead,
                       Totalentries,
                       hEnum);
 if Result=0
    then listbox1.Items.Add(NetResult[0].lpUser)
end;
end;
0
 
MadshiCommented:
Heyhey, read my first comment again. You're using COMPLETELY wrong parameters - namely the NT ones. The win9x parameters are differently.
0
 
PLCAuthor Commented:
Quite, somebody gave me the wrong declarations to work from. Checked the file now myself, stupid me.
I'll try this now. Anyway, for bearing with me I think you deserve to get the points.
tnx
Patrick
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now