Solved

Network Stuff

Posted on 1997-11-26
3
170 Views
Last Modified: 2010-04-04
Hi i was wondering,

Is it possilbe with delphi to see witch users are logged in to a station ? (like ms's netwatcher) and how could i disconnect them ? and the last question =) how do i set access rights on directory's ?

Thanx !

Regards, Arijan
0
Comment
Question by:aluiken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:Arjan092097
ID: 1351994
Yes, that's possible! There's only one problem: Delphi does provide a wrapper for the API functions you need (The svrapi.dll in Windows95 and netapi32.dll in WindowsNT).

The functions you need are:

NetShareEnum: enumerates all the shares you've got
NetSessionEnum: enumerates all the (network)-sessions
NetFileEnum: enumerates open files (via network!)

When you use these API functions you will be able to make a program like MS Netwatcher. An example of a Netwatcher source for WindowsNT is available at the Microsoft MSDN homepage.

Disconnecting users works as follows:
NetSessionDel: disconnect the user using that session

I don't know how to set access rights, but I assume there are some functions in the NetApi32.dll like:
NetAccessEnum
NetAccessAdd etc.

I hope this will help.

Arjan
0
 
LVL 1

Author Comment

by:aluiken
ID: 1351995
Do you have a sample source for that (win95?)

Regards, Arijan
0
 

Accepted Solution

by:
Arjan092097 earned 100 total points
ID: 1351996
No, I don't have some sample code. But I think the following will work:

Example for NetShareEnum:
declare NetShareEnum to be external from svrapi.dll

function NetShareEnum(
    LPTSTR servername,      (pointer to string (PChar))
    DWORD level,      
    LPBYTE * bufptr,      (pointer to byte)
    DWORD prefmaxlen,      
    LPDWORD entriesread,(pointer to word)      
    LPDWORD totalentries,      ""
    LPDWORD resume_handle  ):NetApiStatus; external svrapi.dll;

You've to provide a mapping between the types used in Windows API and the ones used by Delphi.

Then it's possible to use the function. To find a description of the function and his parameters you can look in the helpfiles.

Succes,

Arjan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question