default security descriptor

This is a discussion on default security descriptor within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I've never used security descriptors before (mainly because I didn't have a NT-based system) and I wonder what it ...

  1. #1
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228

    default security descriptor

    Hello,
    I've never used security descriptors before (mainly because I didn't have a NT-based system) and I wonder what it is (briefly said - it's something I can find out by myself in the docs I think) and if it is just fine if I use a default security descriptor. I mean, will it grant me *all* access rights and if not, which ones will be given to me?
    For instance, I'm using CreateProcess to create a child process in which I would like to write the code with WriteProcessMemory and change the protection flags with VirtualProtectEx...
    Thanks for replying.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,673
    There are several other forms of inter-process communication that may be better suited for what you're trying to accomplish.

    What exactly is are you trying to accomplish?

    gg

  3. #3
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Well, actually, I'm trying to do some debugger thing because... there aren't really a reason to that, I was just thinking about how it could be done, I always wanted to know and finally ended with that so, if you know some other solutions...

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,673
    from MSDN: WriteProcessMemory()

    WriteProcessMemory copies the data from the specified buffer in the current process to the address range of the specified process. Any process that has a handle with PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process to be written to can call the function.
    Process Security and Access Rights

    That should be enough to start writting some test code.

    gg

  5. #5
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Well, my question is not how to use the WriteProcessMemory function but if I create a process using the default security desc., will I be able to use the function properly (in other words, does it give me the required writes?)?
    Thanks for the links though I already visited them; however, I'm asking that because I want my program t be win9x-compatible and there aren't security desc. there...
    Last edited by lyx; 01-14-2004 at 11:54 AM.

  6. #6
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Follow the Process Security and Access Rights link that CodePlug posted.

    Find this sentence.

    The handle returned by the CreateProcess function has ... access to the process object.

    The security descriptor does not generally control what rights the handle receives. These are generally requested by a seperate parameter such as dwDesiredAccess or samDesired that accepts an access mask.

    eg. GENERIC_READ for CreateFile.
    eg. REG_QUERY_VALUE of RegOpenKeyEx.

    The security descriptor controls what rights users have on the object. For example a security descriptor on a file may consist of the following acls:

    SID(Group or User): Administrators // have all rights.
    Type: Access Allowed
    Rights: All

    SID: Everyone // can list files.
    Type: Access Allowed
    Rights: List Files

    SID: JoeUser // can read.
    Type: Access Allowed
    Rights: Read

    SID: DogUser // can not do anything.
    Type: Access Denied
    Rights: All

  7. #7
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    Oh, thanks for the reply, seems like I didn't understand what it was saying; never mind.
    I've read that link that codeplug posted even before he did, it says that I would have all accesses, though I wanted to ask you for confirmation because those things seemed very confusing to me. What made me wonder was that sentence from the documentation:
    It can be used to identify the process, or specified in the OpenProcess function to open a handle to the process.
    It looked rather strange [to me] because CreateProcess does return a handle with the process ID, so I thought that I needed to call OpenProcess to get access rights and following the links I ended on some pages about security descriptors -which I don't know anything of...
    Sorry for the stupid quetsion and thanks.

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You're right, that first paragraph of the remarks section would be better in the 'Processes Overview' rather than the CreateProcess documentation.

    As a final note, the default security descriptor does give PROCESS_ALL_ACCESS rights to the current user.

    So to open the running calculator process:
    Code:
    hwndCalc = FindWindow(TEXT("SciCalc"), TEXT("Calculator"));
    
    GetWindowThreadProcessId(hwndCalc, &dwProcessId);
    
    hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Utilizing another compiled program for a task.
    By kotoroshinoto in forum C Programming
    Replies: 6
    Last Post: 06-03-2008, 01:43 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  3. Copying Reg Key With Descriptor Error
    By mercury529 in forum Windows Programming
    Replies: 8
    Last Post: 11-12-2005, 05:31 PM
  4. Security on automated home
    By stimpyzu in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-11-2004, 01:14 AM
  5. Switching Default Buttons :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2002, 04:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21