Re: Permissions again
- From: "mayayana" <mayaXXyana@xxxxxxxxx>
- Date: Sat, 12 Sep 2009 10:13:51 -0400
* I edit C:\documents and settings\desktop.ini
as Admin: Access denied, even though I have
full permission.
How are you reading the permissions?
Both ways. (API and property page.) But mainly
I was checking the API functionality. So I run
my test program, check CU rights (logged in as Admin)
for the file, and I get back full standard and full specific
rights. (First 9 bytes of specific field set. First 5 bytes
of standard field set. I've forgotten what the hex is
for that. I've been busy exploring how each byte gets
set or doesn't.)
So ...I get denied with full rights, then I give everyone
full rights, then I'm not denied, even though I still have
the same full rights. It's wacky! But it does follow a
certain twisted logic: Fake Admin is prevented from having
Admin rights, but if permission is set for everyone then
Admin rights are no longer required.
You can request to elevate without manifiest:
Thanks. I wasn't aware of that method. When you
mentioned it before I thought you meant that you
were shelling from command line. So far I've been
avoiding asking for Admin rights. I try to make it
so that people will have rights within my program
folder, and I can keep my operations there. In some
cases people will need Admin rights just to use the
program functionality. But that's up to them.
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function IsUserAnAdmin Lib "shell32" () As Long
Private Sub Form_Load()
If IsUserAnAdmin = 0 Then
ShellExecute Me.hwnd, "runas", App.Path & "\" & _
App.EXEName & ".exe", Command, vbNullString, 0
End
End If
End Sub
You also should check the OS version because the API function
IsUserAnAdmin is not available in older Windows.
Or use this other method:
http://vbnet.mvps.org/index.html?code/network/isadministrator.htm
Compile and run. The key is the word "runas" in the lpOperation
parameter. It request to run as admin.
.
- Follow-Ups:
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- References:
- Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Nobody
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Re: Permissions again
- From: mayayana
- Re: Permissions again
- From: Eduardo
- Permissions again
- Prev by Date: Re: Flush VB6 IDE?
- Next by Date: Re: Duplicate UC during Runtime
- Previous by thread: Re: Permissions again
- Next by thread: Re: Permissions again
- Index(es):
Relevant Pages
|