|
-
May 2nd, 2001, 12:25 PM
#1
Thread Starter
Hyperactive Member
file/user permissions
Is there a way to restrict who has the ability to run your .exe through code? I'd like to add code to an app so only system administrators can run the .exe. I know that I could do it easily on NT/Win2k by changing the security settings on the program directory or the individual files, but if the app is going to be installed on 400 machines that would take a lot of extra work. And I'm not sure what to do about win95/98 since I don't recall those OS's handling permissions quite the same.
Is there any solution?
Thanks
-
May 2nd, 2001, 12:36 PM
#2
Try posting in the API section, they will give you code to find the name of the user currently on the Workstation. Alternatively, check out www.allapi.com or www.vbapi.com
All you have to do is check the name of the logged in user when you program runs. If it is not Administrator, or any other name that has Administrator privilages, then you close it.
Simple
HTH
-
May 2nd, 2001, 12:56 PM
#3
Black Cat
Or better yet check if the user is a member of Domain Admins, because it will save the headaches hard coding user names could cause later. Also, wouldn't it be pretty easy to decompile and get the Administrator accounts? Although its supposedly not that hard to find out which accounts are admins.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 2nd, 2001, 01:42 PM
#4
Addicted Member
I actually have the code to check if the user running the program is an administrator, not checking username or groups, but the SID of the user.
If you want it, PM me with your email and i'll send it... or I can post it.. its up to you.
-
May 2nd, 2001, 02:46 PM
#5
If you could post the code for finding a user name etc. I would be interested in it. Thx in advance.
-
May 2nd, 2001, 03:00 PM
#6
Addicted Member
I'm gonna post a module that I've compiled that has lots of "neat" functions that I include in all my apps, just in case.
-
May 2nd, 2001, 03:55 PM
#7
I could extract some code from a project I created earlier, but it will only run on NT, not on windows 95 or 98.
It basically creates an administrator SID (Security Identifier), and compares it with the SID's in the Discretionary Access Control List(DACL) of the running process.
It it finds a match, your an administator.
The API functions needed for this (mostly from advapi32.dll) run on NT only.
If your interested let me know, then I will spend some time to extract this code from the rest of the project.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|