Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Security Permissions on NT4

Posted on 1999-07-09
10
Medium Priority
?
498 Views
Last Modified: 2008-02-20
How can I change the security permissions of a registry key on Windows NT4?  I can do it within Regedt32.exe, but want to do it programatically from within Delphi.
0
Comment
Question by:Jaymol
[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
10 Comments
 
LVL 1

Expert Comment

by:logosapience
ID: 1387394
If you can do it within Regedt32, you can use the TRegistry class
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1387395
Hi Jaymol, maybe you should try this component. It is a replacement for TRegistry and may be excactly what you are looking for:

http://www.jgsoftware.com/files/djntreg.zip


Regards,

Epsylon.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 1387396
Unfortunately, regedit and regedt32 are NOT the same program.  Regedt32 allows changes on Security permissions whereas using regedit or TRegistry does not allow this.  I am adept in manipulating the registry as far as entries go, but this is a matter not covered by the TRegistry class.  If I am incorrect in this, then I would appreciate an example of how security permissions can be changed with TRegistry.
0
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!

 
LVL 6

Author Comment

by:Jaymol
ID: 1387397
Since submitting this question, I have found a route around the problem by opening "regedt32.exe" and sending keypresses to make the appropriate changes.  But, if anyone can answer the question anyway, I would be very grateful.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 1387398
Can ANYONE answer this question successfully??????
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1387399
Looked at SetNamedSecurityInfo. It is described in the win32.hlp file, but it is not in Delphi's help context. So you need to open win32.hlp file manually and look in the index for this function.

Regards, Madshi.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 1387400
Could you give me an example?  I can't figure out how to use it properly.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1387401
Well, I didn't try it, but it should work like this:

// enum types in Delphi are commonly 1 byte long, in win32 API these types are mostly 4 bytes long, so we must switch the compiler settings
{$minenumsize 4}
type TObjType = (SE_UNKNOWN, SE_FILE, SE_SERVICE, SE_PRINTER, SE_REGISTRY, SE_LMSHARE, SE_KERNEL, SE_WINDOW);
{$minenumsize 1}

function SetNamedSecurityInfo(objName: PWideChar; objType: TObjType; SecInfo: dword; pSIDOwner,pSIDGroup: PSID; ppDacl,ppSacl: PACL) : dword; stdcall;
         external 'advapi.dll' name 'SetNamedSecurityInfoW';

function AllowRegKeyForEveryone(key: hkey; path: string) : boolean;
  case key of
    HKEY_LOCAL_MACHINE : path:='MACHINE\'     +path;
    HKEY_CURRENT_USER  : path:='CURRENT_USER\'+path;
    HKEY_CLASSES_ROOT  : path:='CLASSES_ROOT\'+path;
    HKEY_USERS         : path:='USERS\'       +path;
  end;
  result:=SetNamedSecurityInfo(pwidechar(wideString(path)),SE_REGISTRY_KEY,DACL_SECURITY_INFORMATION,nil,nil,nil,nil)=0;
end;

  if AllowRegKeyForEveryone(HKEY_LOCAL_MACHINE,'Software') then ...

This example simply gives in a new nil dacl. A nil dacl means that everyone has access. If you want to give specific accesses to specific users, you'll have to create a custom dacl.

Regards, Madshi.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 1387402
Madshi, could you submit that as an answer?  I wanna give you the points you deserve.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 800 total points
ID: 1387403
Thank you...   :-)

Regards, Madshi.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

715 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