🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4592

Re: Is manipulating NT permissions supposed to be hard?

#4592
From: Remy Lebeau (TeamB)
Date: Thu, 22 Dec 2005 10:28
44 lines
2533 bytes
"Franco" <nope@nope.com> wrote in message
news:43aa2693$1@newsgroups.borland.com...

> Can someone explain to me why it seems that I must write
> hundreds of lines of code to perform the following three
> simple functions...

Because NT security really is that complex to begin with.  If it were not,
then there would be no point in implementing any security in the OS at all.

> I am beginning to think that for #1 and #2 it might be easier to
> just simply try these operations and assume if any of them fail -
> that sufficient permissions do not exist for the current user.

GetLastError() will usually return ERROR_ACCESS_DENIED or similar error when
an operation fails due to permissions.  But the operations could fail for
other reasons as well, so assuming that if an error is present then it
indicates insufficient permissions is not very accurate.

> And for #3 it looks like all I may need to do is set a NULL DACL
> for the object

Yes.  That is the way to grant permission to everyone - by simply removing
the permissions altogether.

> Can you point me at some sample C++ source that would help
> me simplify this?

Please go to http://www.deja.com and search through the newsgroup archives.
Sample code has been posted many many times before.

> Maybe MS never wanted this to be simple?

Nope.

> I need to statically link in to a single module, so external modules
> (like the "SetACL" ocx) are not appropriate.

Then you have the added burden of dynamically loading the security functions
at runtime if you want your application to run on Win9x/Me systems.


Gambit
Technical Details
Message-ID: <43aa80dd$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43aa2693$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c32c5ed1d6dead95
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43aa2693$1@newsgroups.borland.com>
Subject: Re: Is manipulating NT permissions supposed to be hard?
Date: Thu, 22 Dec 2005 02:28:02 -0800
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43aa80dd$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1135247581 68.69.17.41 (22 Dec 2005 02:33:01 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail