The SECURITY_ATTRIBUTES struct and CreateNamedPipe()

后端 未结 3 2063
故里飘歌
故里飘歌 2021-02-10 17:47

My scenario is the following: the process that creates the named pipe object with CreateNamedPipe() has administrator privileges, but the client process \"connectin

3条回答
  •  名媛妹妹
    2021-02-10 17:55

    You can set the descriptor's DACL to NULL instead to allow anyone to access the pipe:

    pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
    if (!pSD)
    {
        ...
    }
    
    if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
    {
        ...
    }
    
    if (!SetSecurityDescriptorDacl(pSD, TRUE, NULL, FALSE))
    {
        ...
    }
    
    SECURITY_ATTRIBUTES sa;
    sa.nLength = sizeof(sa);
    sa.lpSecurityDescriptor = pSD;
    sa.bInheritHandle = FALSE;
    
    ... = CreateNamedPipe(..., &sa);
    

提交回复
热议问题