Improve company productivity with a Business Account.Sign Up

x
?
Solved

Rights information for Domain user

Posted on 2000-03-26
17
Medium Priority
?
248 Views
Last Modified: 2010-05-18

Is it possible to get all the rights that user have on a domain ?

Share
FileShare
Groups
etc..

Palli
0
Comment
Question by:palli011000
  • 10
  • 3
  • 3
  • +1
17 Comments
 

Author Comment

by:palli011000
ID: 2658506
I have Delphi 5, is it possible to fix this component ?
http://www.jgsoftware.com/files/accessrights.zip
0
 
LVL 17

Expert Comment

by:inthe
ID: 2658627
what error are you getting with component?
(and what code or line number gives error)

0
 

Author Comment

by:palli011000
ID: 2658851
I install first - cmpComputerAccessRights.pas -

Line: 68.

  if LookupPrivilegeDisplayName (PChar   (Computer), PChar (privilege), buffer, bufSize,    languageID) then

Error :

Types Of Actual And Formal Var Parameters
Must Be Identical

Palli.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

Author Comment

by:palli011000
ID: 2658855
Barry do you know what this component do ?

Palli.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2659025
to compile  try change the integer vars to cardinal so it look like:

var
  languageID : Cardinal;
  buffer : array [0..256] of char;
  bufSize : Cardinal;
begin
  bufSize := sizeof (buffer);
  if LookupPrivilegeDisplayName (PChar (Computer), PChar (privilege), buffer, bufSize, languageID) then
    result := buffer
  else


if you get that error again on other procedures/functions do the same for their vars if they are type integer and they give error change to cardinal..

btw.
i think this component will do what your after
0
 

Author Comment

by:palli011000
ID: 2659087
it works, but i don't know anything about this component. Do you have any solutions?
( demo etc.. ).

Many thanks
Palli.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2659151
sorry dont have nt here with delphi installed on to install component to test any examples on.

(you cant install this component on win9* only compile it.)
0
 

Author Comment

by:palli011000
ID: 2659180
I have NT4,

this component is to hard for me,

Palli
0
 
LVL 1

Expert Comment

by:yk030299
ID: 2659396
listen
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2660194
I don't know this component. You can use GetFileSecurity/GetNamedObjectSecurity to get a security descriptor for files/shares. Then use GetSecurityDescriptorDacl to get the dacl of this security descriptor. Then you can use GetEffectiveRightsFromAcl to ask what rights your user has in this dacl. This is quite complicated stuff...   :-(

For user info you can use NetUserGetInfo or NetUserGetGroups.

Regards, Madshi.
0
 

Author Comment

by:palli011000
ID: 2662211
Madshi
do you have any examples of this functions?

Palli
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2662988
Only for some, and those examples are deeply integrated in my private components collection (not published yet). So nothing I could offer you right now...   :-(

Sorry.

But you can look on this homepage for C++ knowledge:

http://www.wsb.poznan.pl/~pawel/vb/www.mvps.org/win32/network/nt95.html
0
 

Author Comment

by:palli011000
ID: 2663928
Madshi

If i want to use this function in my Delphi, what uses clause do i use to get it in the list

Uses Windows..........etc....

Palli
0
 

Author Comment

by:palli011000
ID: 2663936

HOW CAN I USE API FUNCTION THAT ARE IN DLL.
0
 

Author Comment

by:palli011000
ID: 2663955

HOW CAN I USE API FUNCTION THAT ARE IN DLL.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 300 total points
ID: 2664043
Most of these functions are not declared anywhere. You have to declare them yourself, either statically or dynamically. This is an example for dynamic linking (extract from my components):

type
  // type for ISecurityObject.Type_, must be 4 byte long (needed by NT security APIs)
  {$minenumsize 4}
    TSecurityObjectType = (seUnknown, seFile, seService, sePrinter, seRegistry,
                                      seShare, seKernelObject, seWindowObject);
  {$minenumsize 1}

type
  // internal types for winNT security functions
  TSecurityInfo    = (siOwner, siGroup, siDAcl, siSAcl);
  TSecurityInfoSet = set of TSecurityInfo;
  PPAcl            = ^PAcl;
  PPSid            = ^PSid;

var
  // winNT security function variables
  GetNamedSecurityInfoW : function (objectName   : PWideChar;
                                    objectType   : TSecurityObjectType;
                                    securityInfo : cardinal;
                                    sidOwner     : PPSid;
                                    sidGroup     : PPSid;
                                    dacl         : PPAcl;
                                    sacl         : PPAcl;
                                    var sd       : PSecurityDescriptor) : cardinal; stdcall = nil;
  SetNamedSecurityInfoW : function (objectName   : PWideChar;
                                    objectType   : TSecurityObjectType;
                                    securityInfo : cardinal;
                                    sidOwner     : PSid;
                                    sidGroup     : PSid;
                                    dacl         : PAcl;
                                    sacl         : PAcl               ) : cardinal; stdcall = nil;
  GetSecurityInfoW      : function (handle       : cardinal;
                                    objectType   : TSecurityObjectType;
                                    securityInfo : cardinal;
                                    sidOwner     : PPSid;
                                    sidGroup     : PPSid;
                                    dacl         : PPAcl;
                                    sacl         : PPAcl;
                                    var sd       : PSecurityDescriptor) : cardinal; stdcall = nil;
  SetSecurityInfoW      : function (handle       : cardinal;
                                    objectType   : TSecurityObjectType;
                                    securityInfo : cardinal;
                                    sidOwner     : PSid;
                                    sidGroup     : PSid;
                                    dacl         : PAcl;
                                    sacl         : PAcl               ) : cardinal; stdcall = nil;

var dll : cardinal;
initialization
  dll := LoadLibrary(advapi32);
  // Windows unloads the library automatically when our program terminates...
  GetNamedSecurityInfoW := GetProcAddress(dll, 'GetNamedSecurityInfoW');
  SetNamedSecurityInfoW := GetProcAddress(dll, 'SetNamedSecurityInfoW');
  GetSecurityInfoW := GetProcAddress(dll,      'GetSecurityInfoW');
  SetSecurityInfoW := GetProcAddress(dll,      'SetSecurityInfoW');

Regards, Madshi.
0
 

Author Comment

by:palli011000
ID: 2664436
thanks
Palli
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Watch the software video of Kernel Import PST to Office 365 tools which can easily import PST and OST files to Office 365 for bulk mailboxes. The process of migration is simple and user can map source and destination mailboxes and easily import data…
Wrapper-1-Query. Use an Excel function to calculate a column for an Access query. Part 1. Shows a query in Access that has a calculated column with the results of an Excel worksheet function. See how to call a wrapper function from a query, and …

588 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