Example #1
0
        public unsafe static SecurityStatus SafeQueryContextAttributes(ref SafeCtxtHandle context, out string name)
        {
            SecPkgContext_Names[] array = new SecPkgContext_Names[1];
            fixed(IntPtr *ptr = array)
            {
                SecurityStatus result = Sspi.SafeQueryContextAttributes(ref context, UlAttribute.SECPKG_ATTR_NAMES, (void *)ptr);

                name = Marshal.PtrToStringAnsi(array[0].sUserName);
                Secur32Dll.FreeContextBuffer(array[0].sUserName);
                return(result);
            }
        }
Example #2
0
        public unsafe static SecurityStatus SafeQueryContextAttributes(
            ref SafeCtxtHandle context,
            out string name)
        {
            var names = new SecPkgContext_Names[1];

            fixed(void *buffer = names)
            {
                var result = SafeQueryContextAttributes(ref context, UlAttribute.SECPKG_ATTR_NAMES, buffer);

                name = Marshal.PtrToStringAnsi(names[0].sUserName);
                Secur32Dll.FreeContextBuffer(names[0].sUserName);

                return(result);
            }
        }