Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Named pipes over different processes

Named pipes over different processes

Scheduled Pinned Locked Moved C / C++ / MFC
securityhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A T I F
    wrote on last edited by
    #1

    I am using the following code to create a named pipe SECURITY_ATTRIBUTES saPipeSecurity = {0}; PSECURITY_DESCRIPTOR pPipeSD = NULL; if(lpSecurityAttributes == NULL) { // alloc & init SD if ( ! ( pPipeSD = ( PSECURITY_DESCRIPTOR) ( malloc ( SECURITY_DESCRIPTOR_MIN_LENGTH)) ) ) return FALSE; if ( ! InitializeSecurityDescriptor ( pPipeSD, SECURITY_DESCRIPTOR_REVISION) ) return FALSE; // set NULL DACL on the SD if ( ! SetSecurityDescriptorDacl ( pPipeSD, TRUE, ( PACL) NULL, FALSE) ) return FALSE; // now set up the security attributes saPipeSecurity.nLength = sizeof ( SECURITY_ATTRIBUTES); saPipeSecurity.bInheritHandle = TRUE; saPipeSecurity.lpSecurityDescriptor = pPipeSD; lpSecurityAttributes = &saPipeSecurity; } m_hPipe = ::CreateNamedPipe(pszPipeName, dwOpenMode, dwPipeMode, dwMaxInstances, dwOutBufferSize, dwInBufferSize, dwDefaultTimeOut, lpSecurityAttributes); then I use a CreateProcessWithLogonW to spawn a new process that connect to this pipe using CreateFile. The createfile fails and return last error gives 5(access denied). Can anybody guess what I am doing wrong.

    L 1 Reply Last reply
    0
    • A A T I F

      I am using the following code to create a named pipe SECURITY_ATTRIBUTES saPipeSecurity = {0}; PSECURITY_DESCRIPTOR pPipeSD = NULL; if(lpSecurityAttributes == NULL) { // alloc & init SD if ( ! ( pPipeSD = ( PSECURITY_DESCRIPTOR) ( malloc ( SECURITY_DESCRIPTOR_MIN_LENGTH)) ) ) return FALSE; if ( ! InitializeSecurityDescriptor ( pPipeSD, SECURITY_DESCRIPTOR_REVISION) ) return FALSE; // set NULL DACL on the SD if ( ! SetSecurityDescriptorDacl ( pPipeSD, TRUE, ( PACL) NULL, FALSE) ) return FALSE; // now set up the security attributes saPipeSecurity.nLength = sizeof ( SECURITY_ATTRIBUTES); saPipeSecurity.bInheritHandle = TRUE; saPipeSecurity.lpSecurityDescriptor = pPipeSD; lpSecurityAttributes = &saPipeSecurity; } m_hPipe = ::CreateNamedPipe(pszPipeName, dwOpenMode, dwPipeMode, dwMaxInstances, dwOutBufferSize, dwInBufferSize, dwDefaultTimeOut, lpSecurityAttributes); then I use a CreateProcessWithLogonW to spawn a new process that connect to this pipe using CreateFile. The createfile fails and return last error gives 5(access denied). Can anybody guess what I am doing wrong.

      L Offline
      L Offline
      lesnikowski
      wrote on last edited by
      #2

      but what kind of a value does dwOpenMode have? Access specified when a pipe is opened (CreateFile) must be compatible with the access specified in the dwOpenMode (CreateNamedPipe). if PIPE_ACCESS_OUTBOUND or PIPE_ACCESS_INBOUND you must call CreateFile with GENERIC_READ, GENERIC_WRITE accordingly as dwDesiredAccess param.

      A 1 Reply Last reply
      0
      • L lesnikowski

        but what kind of a value does dwOpenMode have? Access specified when a pipe is opened (CreateFile) must be compatible with the access specified in the dwOpenMode (CreateNamedPipe). if PIPE_ACCESS_OUTBOUND or PIPE_ACCESS_INBOUND you must call CreateFile with GENERIC_READ, GENERIC_WRITE accordingly as dwDesiredAccess param.

        A Offline
        A Offline
        A T I F
        wrote on last edited by
        #3

        thanks I was able to resolve that issue...now I am facing a new issue..CreateProcessWithLogonW call is taking too much time on a WinXP machine, but work fine of a Win2000...any ideas why?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups