Solved

Network Stuff

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now