private NtResult <NtKey> Open(string path, KeyAccessRights desired_access, bool throw_on_error) { using (var obja = new ObjectAttributes(path, AttributeFlags.OpenLink | AttributeFlags.CaseInsensitive, _key)) { return(NtKey.Open(obja, desired_access, _open_for_backup ? KeyCreateOptions.BackupRestore : KeyCreateOptions.NonVolatile, throw_on_error)); } }
public static extern NtStatus NtCreateKey( out SafeKernelObjectHandle KeyHandle, KeyAccessRights DesiredAccess, [In] ObjectAttributes ObjectAttributes, int TitleIndex, UnicodeString Class, KeyCreateOptions CreateOptions, out KeyDisposition Disposition );
static string AccessMaskToString(uint granted_access) { if (_type.HasFullPermission(granted_access)) { return("Full Permission"); } KeyAccessRights rights = (KeyAccessRights)(granted_access & 0xFFFF); StandardAccessRights standard = (StandardAccessRights)(granted_access & 0x1F0000); return(String.Join(", ", new string[] { standard.ToString(), rights.ToString() })); }
/// <summary> /// Open the AppContainer key. /// </summary> /// <param name="desired_access">The desired access for the key.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The opened key.</returns> public NtResult <NtKey> OpenKey(KeyAccessRights desired_access, bool throw_on_error) { using (var result = TokenUtils.CreateAppContainerToken(null, Sid, new Sid[0], throw_on_error)) { if (!result.IsSuccess) { return(result.Cast <NtKey>()); } using (var imp = result.Result.Impersonate(SecurityImpersonationLevel.Impersonation)) { return(Win32NativeMethods.GetAppContainerRegistryLocation(desired_access, out SafeKernelObjectHandle key) .CreateResult(throw_on_error, () => new NtKey(key, KeyDisposition.OpenedExistingKey, false))); } } }
public static extern NtStatus NtLoadKey3([In] ObjectAttributes DestinationName, [In] ObjectAttributes FileName, LoadKeyFlags Flags, [In, MarshalAs(UnmanagedType.LPArray)] KeyLoadArgument[] LoadArguments, int LoadArgumentCount, KeyAccessRights DesiredAccess, IntPtr KeyHandle, int Unused);
public static extern NtStatus NtLoadKeyEx([In] ObjectAttributes DestinationName, [In] ObjectAttributes FileName, LoadKeyFlags Flags, IntPtr TrustKeyHandle, IntPtr EventHandle, KeyAccessRights DesiredAccess, IntPtr KeyHandle, int Unused);
public static extern NtStatus NtOpenKeyTransactedEx(out SafeKernelObjectHandle KeyHandle, KeyAccessRights DesiredAccess, [In] ObjectAttributes ObjectAttributes, KeyCreateOptions OpenOptions, [In] SafeKernelObjectHandle TransactionHandle);
public static extern NtStatus NtOpenKey( out SafeKernelObjectHandle KeyHandle, KeyAccessRights DesiredAccess, [In] ObjectAttributes ObjectAttributes );
internal static NtResult <NtKey> OpenClassKey(Guid class_guid, bool installer, KeyAccessRights desired_access, CmRegDisposition disposition, bool throw_on_error) { return(DeviceNativeMethods.CM_Open_Class_KeyW(class_guid, null, desired_access, disposition, out SafeKernelObjectHandle handle, installer ? CmClassType.Installer : CmClassType.Interface).ToNtStatus().CreateResult(throw_on_error, () => NtKey.FromHandle(handle))); }
internal static extern NtStatus GetAppContainerRegistryLocation( KeyAccessRights desiredAccess, out SafeKernelObjectHandle phAppContainerKey );