Abstractions.Windows.User.DelProfileList C# (CSharp) 메소드

DelProfileList() 공개 정적인 메소드

Delete ProfileList regkeys
public static DelProfileList ( string userSID ) : System.Boolean
userSID string
리턴 System.Boolean
        public static Boolean DelProfileList(string userSID)
        {
            List<string> regkeys = new List<string>(){
                ROOT_PROFILE_KEY + "\\" + userSID,
                ROOT_PROFILE_KEY + "\\" + userSID + ".bak"
            };
            UIntPtr key = UIntPtr.Zero;
            Boolean ret = true;

            foreach (string regkey in regkeys)
            {
                key = Abstractions.WindowsApi.pInvokes.RegistryOpenKey(Abstractions.WindowsApi.pInvokes.structenums.baseKey.HKEY_LOCAL_MACHINE, regkey);
                if (key != UIntPtr.Zero)
                {
                    bool r = Abstractions.WindowsApi.pInvokes.RegistryDeleteTree(Abstractions.WindowsApi.pInvokes.structenums.baseKey.HKEY_LOCAL_MACHINE, regkey);
                    if (ret != false)
                    {
                        ret = r;
                    }
                    Abstractions.WindowsApi.pInvokes.RegistryCloseKey(key);
                }
            }

            return ret;
        }