Exemplo n.º 1
0
        public static WnfStateData QueryWnf(ulong state)
        {
            var data  = new WnfStateData();
            int tries = 10;
            int size  = 4096;

            while (tries-- > 0)
            {
                using (SafeHGlobalBuffer buffer = new SafeHGlobalBuffer(size))
                {
                    int status;
                    status = ZwQueryWnfStateData(ref state, null, IntPtr.Zero, out uint changestamp, buffer, ref size);

                    if (status == 0xC0000023)
                    {
                        continue;
                    }
                    buffer.SetLength(size);
                    data = new WnfStateData(changestamp, buffer.ReadBytes(size));
                }
            }
            return(data);
        }