Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

CoQueryClientBlanket (ole32)
 
.
Summary

C# Signature:

    [DllImport("ole32.dll")]
    static extern int CoQueryClientBlanket(out IntPtr pAuthnSvc, out IntPtr pAuthzSvc,
        [MarshalAs(UnmanagedType.LPWStr)] out StringBuilder pServerPrincName, out IntPtr
        pAuthnLevel, out IntPtr pImpLevel, out IntPtr pPrivs, out IntPtr pCapabilities);

User-Defined Types:

None.

Notes:

The original version of this errored with a message about memory corruption.

My modification works without error, if you use the code sample you'll need to plug in your own logging.

Tips & Tricks:

Please add some!

Sample Code:

{

    System.IntPtr pAthnSvc = new IntPtr();
    System.IntPtr pAthzSvc = new IntPtr();
    StringBuilder pServerPrincName = new StringBuilder();
    System.IntPtr pAuthnLevel = new IntPtr();
    System.IntPtr pImpLevel = new IntPtr();
    System.IntPtr pPrivs = new IntPtr();
    System.IntPtr pCaps = new IntPtr(4);

    try
    {
        trc.Log(LOG_DEBUG, "Retrieving Principle Name");            
        CoQueryClientBlanket(out pAthnSvc, out pAthzSvc, out pServerPrincName, out pAuthnLevel, out pImpLevel, out pPrivs, out pCaps);

        trc.Log(LOG_DEBUG, "Called CoQueryClientBlanket without error");
    }
    catch(Exception ex)
    {
        // Something went wrong, report it and then check if
        //we have a valid token attached instead
        trc.LogError( ex.Message ) ;
    }
    finally
    {
        // Logging the values to aid any debugging that may be required
        trc.Log( LOG_DEBUG, "Values");
        trc.Log( LOG_DEBUG, "pAthnSvc = " + pAthnSvc);
        trc.Log( LOG_DEBUG, "pAthzSvc = " + pAthzSvc);
        trc.Log( LOG_DEBUG, "pAuthnLevel = " + pAuthnLevel);
        trc.Log( LOG_DEBUG, "pImpLevel = " + pImpLevel);
        trc.Log( LOG_DEBUG, "pPrivs = " + pPrivs);
        trc.Log( LOG_DEBUG, "pCaps = " + pCaps);
        trc.Log( LOG_DEBUG, "pServerPrincName = " + pServerPrincName);
    }

}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions