Fix issue in NamedPipeServerStream.GetImpersonationUserName() (#37676)
authorCarlos Sanchez Lopez <1175054+carlossanlop@users.noreply.github.com>
Fri, 7 Jun 2019 19:35:43 +0000 (12:35 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 8 Jun 2019 14:14:49 +0000 (07:14 -0700)
commitf684a3d9e31391731f4f6f9c4d3ae014b8576505
tree6215d71f7253633ec98b3af2d8f1daeb831307a8
parent730603a09c3f66214cf46c1a429d326e1083fbf3
Fix issue in NamedPipeServerStream.GetImpersonationUserName() (#37676)

Fix for issue where NamedPipeServerStream.GetImpersonationUserName() throws unexpected InvalidationOperationException("The operation completed successfully") when impersonation is not allowed, when in fact it should simply return an empty string.

The fix will call GetNamedPipeHandleStateW once. If it fails, it will try to load sspicli.dll if it was not loaded, and will reattempt the call to GetNamedPipeHandleStateW.

This fix is only for Win32: UAP does not allow calling LoadLibraryEx, and Windows Nano says denies access to GetNamedPipeHandleStateW even after attempting to load sspicli.dll.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs