Results 1 to 7 of 7

Thread: file/user permissions

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265

    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

  2. #2
    ricmitch_uk
    Guest
    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

  3. #3
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.

  4. #4
    Addicted Member
    Join Date
    Aug 2000
    Posts
    181
    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.

  5. #5
    ricmitch_uk
    Guest
    If you could post the code for finding a user name etc. I would be interested in it. Thx in advance.

  6. #6
    Addicted Member
    Join Date
    Aug 2000
    Posts
    181
    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.

  7. #7
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    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
  •  



Click Here to Expand Forum to Full Width