Abstractions.WindowsApi.pInvokes.RegistryLoad C# (CSharp) Method

RegistryLoad() public static method

load a regfile at hklm or hku
public static RegistryLoad ( structenums where, string name, string file ) : Boolean
where structenums hklm or hku
name string The name of the key to be created under hKey. This subkey is where the registration information from the file will be loaded
file string
return Boolean
        public static Boolean RegistryLoad(structenums.RegistryLocation where, string name, string file)
        {
            if (where != structenums.RegistryLocation.HKEY_LOCAL_MACHINE && where != structenums.RegistryLocation.HKEY_USERS)
            {
                LibraryLogging.Error("unable to load regfile at {0}", where);
                return false;
            }

            if (!SafeNativeMethods.RegistryLoadPrivilegeSet)
            {
                if (!RegistryLoadSetPrivilege())
                    return false;
            }

            int ret = SafeNativeMethods.RegLoadKey((uint)Enum.Parse(typeof(structenums.baseKey), where.ToString()), name, file);
            if (ret != 0)
            {
                LibraryLogging.Error("Unable to load regfile {0} error:{1} {2}", file, ret, LastError(ret));
                return false;
            }
            return true;
        }