Solved

Network Stuff

Posted on 1997-11-26
3
168 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

832 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