• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Rights information for Domain user


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

Share
FileShare
Groups
etc..

Palli
0
palli011000
Asked:
palli011000
  • 10
  • 3
  • 3
  • +1
1 Solution
 
palli011000Author Commented:
I have Delphi 5, is it possible to fix this component ?
http://www.jgsoftware.com/files/accessrights.zip
0
 
intheCommented:
what error are you getting with component?
(and what code or line number gives error)

0
 
palli011000Author Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
palli011000Author Commented:
Barry do you know what this component do ?

Palli.
0
 
intheCommented:
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
 
palli011000Author Commented:
it works, but i don't know anything about this component. Do you have any solutions?
( demo etc.. ).

Many thanks
Palli.
0
 
intheCommented:
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
 
palli011000Author Commented:
I have NT4,

this component is to hard for me,

Palli
0
 
yk030299Commented:
listen
0
 
MadshiCommented:
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
 
palli011000Author Commented:
Madshi
do you have any examples of this functions?

Palli
0
 
MadshiCommented:
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
 
palli011000Author Commented:
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
 
palli011000Author Commented:

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

HOW CAN I USE API FUNCTION THAT ARE IN DLL.
0
 
MadshiCommented:
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
 
palli011000Author Commented:
thanks
Palli
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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