コード例 #1
0
        internal static byte[] GetEntryRaw(string name)
        {
            UIntPtr size;

            byte[]  namePtr    = CreateUTF8String(name, out size);
            UIntPtr stringSize = UIntPtr.Zero;
            ulong   lastChange = 0;
            IntPtr  ret        = Interop.NT_GetEntryRaw(namePtr, size, ref lastChange, ref stringSize);

            if (ret == IntPtr.Zero)
            {
                ThrowException(name, namePtr, size, NtType.Raw);
            }
            byte[] data = GetRawDataFromPtr(ret, stringSize);
            Interop.NT_FreeCharArray(ret);
            return(data);
        }
コード例 #2
0
        internal static string GetEntryString(string name)
        {
            UIntPtr size;

            byte[]  namePtr    = CreateUTF8String(name, out size);
            UIntPtr stringSize = UIntPtr.Zero;
            ulong   lastChange = 0;
            IntPtr  ret        = Interop.NT_GetEntryString(namePtr, size, ref lastChange, ref stringSize);

            if (ret == IntPtr.Zero)
            {
                ThrowException(name, namePtr, size, NtType.String);
            }
            string str = ReadUTF8String(ret, stringSize);

            Interop.NT_FreeCharArray(ret);
            return(str);
        }
コード例 #3
0
        internal static byte[] GetEntryRaw(string name, byte[] defaultValue)
        {
            UIntPtr size;

            byte[]  namePtr    = CreateUTF8String(name, out size);
            UIntPtr stringSize = UIntPtr.Zero;
            ulong   lastChange = 0;
            IntPtr  ret        = Interop.NT_GetEntryRaw(namePtr, size, ref lastChange, ref stringSize);

            if (ret == IntPtr.Zero)
            {
                return(defaultValue);
            }
            else
            {
                byte[] data = GetRawDataFromPtr(ret, stringSize);
                Interop.NT_FreeCharArray(ret);
                return(data);
            }
        }
コード例 #4
0
        internal static string GetEntryString(string name, string defaultValue)
        {
            UIntPtr size;

            byte[]  namePtr    = CreateUTF8String(name, out size);
            UIntPtr stringSize = UIntPtr.Zero;
            ulong   lastChange = 0;
            IntPtr  ret        = Interop.NT_GetEntryString(namePtr, size, ref lastChange, ref stringSize);

            if (ret == IntPtr.Zero)
            {
                return(defaultValue);
            }
            else
            {
                string str = ReadUTF8String(ret, stringSize);
                Interop.NT_FreeCharArray(ret);
                return(str);
            }
        }