Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, February 26, 2010 4:47 AM
Hi,
I am running a c# application under my account which has Administrator priviliges. I am trying to have a c++ low integrity application connect to the named pipe. I keep getting Access Denied when I call CreateFile in the c++ code. When I change the C++ client to not be low integrity app anymore it works just fine. How do I Create my named pipe in C# to allow the low integrity apps to connect to it.
Here is my c# code:
SafeFileHandle
handle = Win32Wrapper.CreateNamedPipe("\\.\pipe\newpipename",
Win32Wrapper.DUPLEX,
if (handle.IsInvalid)
Thread.Sleep(100);
continue;
int result = Win32Wrapper.ConnectNamedPipe(handle, IntPtr.Zero);
The CreateNamePipe call is just a wrapper for the c++ one.
Then in C++ I try to do this:
"\\.\pipe\newpipename", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
char buffer[2];
'M';
'\0';
DWORD bytesWritten = 0;
WriteFile(handle, buffer, 1, &bytesWritten, NULL);
But I am always getting access denied on the create file cause of it being a low integrity app.
Any help would be appreciated.
Thanks
buffer[1] =
buffer[0] =
HANDLE handle = CreateFile(
All replies (3)
Friday, February 26, 2010 8:50 AM âś…Answered | 1 vote
Hello
Modifying a resource's integrity level is well-covered in the following post by Kenny Kerr: http://weblogs.asp.net/kennykerr/archive/2006/09/29/Windows-Vista-for-Developers-_1320_-Part-4-_1320_-User-Account-Control.aspx
See Resource integrity levels and the relevant sample code.
Regards,
Jialiang Ge
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact [email protected].
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Friday, February 26, 2010 5:45 AM
http://en.wikipedia.org/wiki/Mandatory_Integrity_Control The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP
Friday, February 26, 2010 6:31 AM
Interesting read, it says you can make the named pipe object be accessible at a low integrity level so low integrity apps can communicate with it. Thats great, and I figured you could do that. But it doesn't tell me how to in C# make it work. I have tried lots of different security stuff to try and get this working cause it should according to that wikipedia article.
Thanks