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. Windows API
  4. Vista security and named pipes

Vista security and named pipes

Scheduled Pinned Locked Moved Windows API
comsecurityhelpquestionlounge
2 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.
  • _ Offline
    _ Offline
    __DanC__
    wrote on last edited by
    #1

    I have an application which uses named pipes to communicate and works as expected in XP but in Vista the CreateNamedPipe() function fails with ERROR_ACCESS_DENIED. I am attempting to use ConvertStringSecurityDescriptortoSecurityDescriptor() to create a SECURITY_DESCRIPTOR but this returns ERROR_INVALID_PARAMETER, the code I'm using is: //// Imports and structures [DllImport("advapi32", SetLastError=true)] internal static extern bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, uint StringSDRevision, ref IntPtr securityDescriptor, ref int SecurityDescriptorSize); [StructLayout(LayoutKind.Sequential)] class SECURITY_ATTRIBUTES { public int nLength; public IntPtr lpSecurityDescriptor; public bool bInheritHandle; } //// End of imports //// Code SECURITY_ATTRIBUTES structure = new SECURITY_ATTRIBUTES(); string strsecdesc = "D: (A;;GRGW;;;S-1-1-0)"; <- This should give generic read/write to Everyone group int securityDescriptorSize = 0; ConvertStringSecurityDescriptorToSecurityDescriptor(strsecdesc, 1, ref structure.lpSecurityDescriptor, ref securityDescriptorSize); <- GetLastError() here returns ERROR_INVALID_PARAMETER Can anyone see anything obviously wrong with this code for Vista? Thanks.

    Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!

    M 1 Reply Last reply
    0
    • _ __DanC__

      I have an application which uses named pipes to communicate and works as expected in XP but in Vista the CreateNamedPipe() function fails with ERROR_ACCESS_DENIED. I am attempting to use ConvertStringSecurityDescriptortoSecurityDescriptor() to create a SECURITY_DESCRIPTOR but this returns ERROR_INVALID_PARAMETER, the code I'm using is: //// Imports and structures [DllImport("advapi32", SetLastError=true)] internal static extern bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, uint StringSDRevision, ref IntPtr securityDescriptor, ref int SecurityDescriptorSize); [StructLayout(LayoutKind.Sequential)] class SECURITY_ATTRIBUTES { public int nLength; public IntPtr lpSecurityDescriptor; public bool bInheritHandle; } //// End of imports //// Code SECURITY_ATTRIBUTES structure = new SECURITY_ATTRIBUTES(); string strsecdesc = "D: (A;;GRGW;;;S-1-1-0)"; <- This should give generic read/write to Everyone group int securityDescriptorSize = 0; ConvertStringSecurityDescriptorToSecurityDescriptor(strsecdesc, 1, ref structure.lpSecurityDescriptor, ref securityDescriptorSize); <- GetLastError() here returns ERROR_INVALID_PARAMETER Can anyone see anything obviously wrong with this code for Vista? Thanks.

      Chat | Text Messaging | Games | www.uzeddit.com - Coming soon!

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You have a space in your security descriptor text string. That's not allowed according to the MSDN documentation. Vista is most likely stricter at interpreting the string. As a style point I would prefer using the alias "WD" for 'Everyone', rather than the SID S-1-1-0.

      DoEvents: Generating unexpected recursion since 1991

      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