Skip to content

net90_EventLogHelper.Interfaces_IRegistryReader_HasRegistryAccess

dparvin edited this page Sep 10, 2025 · 1 revision

IRegistryReader.HasRegistryAccess method

Verifies whether the current user has sufficient permissions to access a registry key.

public bool HasRegistryAccess(RegistryHive hive, string machineName, string registryPath, 
    bool writeAccess)
parameter description
hive The root RegistryHive (e.g., RegistryHive.LocalMachine).
machineName The target machine name. Use "." for the local machine.
registryPath The registry key path relative to the specified hive.
writeAccess If True, checks whether write access is allowed; if False, checks for read access.

Return Value

True if the user has the requested access; otherwise, False.

Remarks

This method is critical when creating event sources, since writing registry entries in SYSTEM\CurrentControlSet\Services\EventLog requires administrative privileges.

See Also

Clone this wiki locally