🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Is manipulating NT permissions supposed to be hard?

#4590
From: Franco
Date: Thu, 22 Dec 2005 04:09
32 lines
2352 bytes
Hi NG,

Can someone explain to me why it seems that I must write hundreds of lines
of code to perform the following three simple functions... Maybe I am doing
this all wrong....

1.  Check if the current user has sufficient permissions to write to, delete
and create a file in a particular location.

2. Check if the current user has sufficient permissions to write to, delete
and create registry keys in a particular location.

3. Grant all users permission to do above two things.

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.  And for #3 it looks like all
I may need to do is set a NULL DACL for the object (several lines of code
but more manageable and less prone to error).

Can you point me at some sample C++ source that would help me simplify this?
I have found several sources myself - but delving inside - they all
immediately explode in a cacophony of low level security API that seems to
be waaaaay overboard for the three simple things I want to do... One source
I found seemed to do what I wanted - but it was over 1000 bloody lines -
just to do the first two things!  Maybe MS never wanted this to be simple?

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

Thanks.
Frustrated.
Technical Details
Message-ID: <43aa2693$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c32c5ed1d6dead95,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Franco" <nope@nope.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Is manipulating NT permissions supposed to be hard?
Date: Wed, 21 Dec 2005 20:09:42 -0800
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
NNTP-Posting-Host: 70.69.15.146
Message-ID: <43aa2693$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1135224467 70.69.15.146 (21 Dec 2005 20:07:47 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail