Article View: microsoft.public.win32.programmer.kernel
Article #4Re: Change registry Privileges by API functions
From: Felix Kasza [MVP]
Date: Fri, 23 Jul 1999 00:00
Date: Fri, 23 Jul 1999 00:00
28 lines
1819 bytes
1819 bytes
Roland,
> How can I change the privileges on the Registry for a particular user on a
> WinNT4 Server/Workstation. I know how it can be done by RegEdt32 but how can
> I do this by API.
To change the permissions on a reg key ("privileges" are something
different), use RegGetKeySecurity() to read the current DACL. Build an
ACE with the desired permissions for the user you have in mind. Search
the ACL for an already-existing entry for this user -- if there is one,
OR its permissions with the ones you want to add; if there is none, add
your ACE to the end of the list. (You may have to reallocate the ACL to
do that.) Finally, call RegSetKeySecurity() to write the DACL back.
The Platform SDK contains an overview section on security and such;
Marshall Brain's "Win32 System Services" discusses the topic, and so do
Brent/Rector in their "Win32 Programming" book. There are also a few
MSDN articles -- search titles for "security".
--
Cheers,
Felix.
If you post a reply, kindly refrain from emailing it, too.
Note to spammers: felixk@mvps.org is my real email address.
No anti-spam address here. Just one comment: IN YOUR FACE!
Technical Details
Message-ID:
<379b5a6c.123504500@207.46.180.23>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7n919h$mh3$1@reader1.wxs.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5ca7,efe132acec5299b2 X-Google-Attributes: gidf5ca7,public X-Google-Thread: fd2c4,efe132acec5299b2 X-Google-Attributes: gidfd2c4,public From: felixk@mvps.org (Felix Kasza [MVP]) Subject: Re: Change registry Privileges by API functions Date: 1999/07/23 Message-ID: <379b5a6c.123504500@207.46.180.23> X-Deja-AN: 504393441 Content-Transfer-Encoding: 7bit References: <7n919h$mh3$1@reader1.wxs.nl> Organization: None. Just me here. Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: microsoft.public.win32.programmer.kernel,borland.public.cppbuilder.winapi