Giter Club home page Giter Club logo

hidesettingspages's People

Contributors

drewnaylor avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hidesettingspages's Issues

Allow user to reset HideSettingsPages options.

This'll be a button in the Options menu called "Reset options to default". First it'll ask the user if they want to reset the HideSettingsPages options to default. If the user says yes, it'll then check/uncheck the menubar buttons in the Options menu according to the defaults and save the settings to My.Settings.

Allow the user to copy their current selections into the "Directly apply key value" window if they want to.

This can be a button that says "Copy from main window" somewhere on the "Directly apply key value" window, or maybe they can have it copy over if they hold the "Shift" key while opening the window.

Another way to do it would be to have an option that says, "Always copy selections into Directly apply key value window". There can be a label that describes this setting that says, "If this is disabled, selections can still be copied over by holding "Shift" while opening the Directly apply key value window."

How to elevate permissions when the user clicks on the "Apply" or "Undo" buttons at the bottom.

I'm thinking I could make another executable that runs with admin permissions and gets the necessary variables as startup arguments. Maybe something like having the first argument be the full Registry key and the second be "apply" or "undo," where "apply" is triggered from the Apply button at the bottom of the window and "undo" is triggered by the Undo button. Then, in the other EXE, I can have it be like, first command line argument is "fullRegistryKeyValue" and the other one is "applyOrUndo." If applyOrUndo is = "apply," then we'll take "fullRegistryKeyValue" and try to write it into the proper string in the Registry. If it's = "undo," then we'll try to delete the Registry key instead if it currently exists.

Maybe the other EXE file can be named "hsp_apply-key.exe"

https://social.msdn.microsoft.com/Forums/en-US/72dff446-89cb-438b-9a25-68ba0976b8aa/pass-variable-to-exe-file-vbnet-2010?forum=Vsexpressvb

Allow the user to choose a custom directory they want to run hsp_registry-helper.exe from.

This would be implemented via a window that kinda looks like the layout below:

custom dir mockup

The textbox and the "browse..." button will be disabled if the user has the "use current folder" radio button selected. The "prefer current folder" checkbox will also be disabled if "use current folder" is selected.

The text on the side in the light yellow boxes is going to be used with some changes as tooltips for each of their respective controls.

The "test settings" button is going to try to see if hsp_registry-helper.exe exists in the folder the user chose via FileExists() just like I mentioned in #43:

determine if file exists

Tell the user which key value we will write before it's written.

Basically, this would be a messagebox saying, "Are you sure you want to write [page list user chose] to [registry key value]?" After writing the key value, use the GetValue method and try to see if the value exists. If it does, have a messagebox say, "Successfully applied page list to Registry key value. Start or restart the Settings app to see your changes."

Allow importing and exporting the current Registry key value partially using the CLI.

The way this can be handled is, the helper program will accept a file path as an argument after /export, and the UI will offer a file browse dialog to select a folder to export to.

There can also be a /import command which also accepts a file path (with a file browse dialog provided by the UI for ease of use), and this one directly applies a Registry key value from a properly-formatted file as long as it has permission to do so.

These UI menu items can be Import directly to Registry from file and Export current Registry key value to file. Maybe adding a submenu for Import and Export would help it be a little less cluttered.

Allow users to apply a specific string and bypass the rest of the HideSettingsPages UI.

By allowing this, people can just apply a string they copied and pasted from elsewhere online or a text document they made as a backup for whatever their preferred Settings app page configuration is. This could be in the File menu, possibly as "File>Directly apply key value...". Clicking on it will open a dialog similar to the Windows "Run" dialog but instead of running a program, whatever they type into the box will be written to the proper Registry key value when they click "Apply". There will then be a messagebox asking the user if they're sure they want to apply the key value (which can be turned off in the Options window once it exists, or maybe just a dropdown on the menubar.) If they choose to apply the key value, UAC will show up asking for the admin password and apply the key value with hsp_registry-helper.exe.

Allow user to update page list.

This would mean that the page list would be read from a text file that could be updated by the user at any time. The way to check for updates would use a simple XML file in this repository with the following fields:

<HideSettingsPages_Page_List_Updater>
<lastUpdated>(last updated date in UTC)</lastUpdated>
<currentVersion>(current page list version, used to tell the user if there's an update; something like:) 1.0.0.1</currentVersion>
<updateUrl>(url of the text document; something like:) https://github.com/DrewNaylor/HideSettingsPages/blob/master/HideSettingsPages/page-list-updates/current-page-list.txt</updateUrl>
<sha256Hash>(SHA256 checksum of text file to ensure there's no tampering by comparing this text to the SHA256 checksum of the page list text document)</sha256Hash>
</HideSettingsPages_Page_List_Updater>

This updater xml document would be saved onto the user's computer so that the updater code can compare the version number in the file on the user's computer and the one in the repository the next time there's an update. If the version number in the repository's copy of the update xml document is newer than the version in the update document on the user's computer, the user will be told there's an update, the new update version, their current version, the date (in UTC) the newest version says it was updated on, and be asked if they want to download the newest copy. However, if the SHA256 checksums don't match between the copy in the repository and the field in the update xml document in the repository, the user will be made aware of this and the update will not complete unless the user wants to ignore the checksum mismatch.

In a configuration dialog, the user should be allowed to choose whether or not they want to ignore the checksum mismatch and use a preinstalled copy of the page list (in My.Resources) instead of one in a text document.

Remove unneeded URIs from list of pages to hide.

These are the entries that aren't on the list in each of the Settings app categories. Mostly things that can be opened by clicking a link while inside the Settings app or those that hide the main page such as the following:

windowsupdate-action
windowsupdate-history
windowsupdate-options
windowsupdate-restartoptions

There may be others like these, but these are the ones I've noticed so far that hide the main Windows Update page when selected on build 15063.

Instead of using global variables in hsp_registry-helper, just use parameters to link all the subs together.

This way I don't have to keep making and changing strings. Instead of this:

        If sArgs.Length = 0 Then
            'If there are no arguments, print app info and 
            ' tell the user what arguments are accepted.
            argsOutput.noOrInvalidCommandLineArgs("No arguments passed.")

        ElseIf sArgs.Length = 1 Then
            ' If there's only one argument and /apply is being used, complain.
            If sArgs(0) = "/apply" Then
                argsOutput.noOrInvalidCommandLineArgs("<key value> must be available if trying to use /apply as <action>.")

            ElseIf Not sArgs(0) = "/apply" Then
                ' If the argument isn't /apply, don't complain and set the first arg correctly.
                actionToTake = sArgs(0)
                fullKeyValue = ""
                ' Output current args.
                argsOutput.passCommandLineArgs()
            End If

        Else
            ' Change value of commandline arguments if both of them exist. Doesn't matter if /apply is being used
            ' or not with this code.
            actionToTake = sArgs(0)
            fullKeyValue = sArgs(1)

            ' Output current args.
            argsOutput.passCommandLineArgs()
        End If

I can do this:

        If sArgs.Length = 0 Then
            'If there are no arguments, print app info and 
            ' tell the user what arguments are accepted.
            argsOutput.noOrInvalidCommandLineArgs("No arguments passed.")

        ElseIf sArgs.Length = 1 Then
            ' If there's only one argument and /apply is being used, complain.
            If sArgs(0) = "/apply" Then
                argsOutput.noOrInvalidCommandLineArgs("<key value> must be available if trying to use /apply as <action>.")

            ElseIf Not sArgs(0) = "/apply" Then
                ' If the argument isn't /apply, don't complain and set the first arg correctly.
                ' Output current args.
                argsOutput.passCommandLineArgs(sArgs(0), "")
            End If

        Else
            ' Change value of commandline arguments if both of them exist. Doesn't matter if /apply is being used
            ' or not with this code.

            ' Output current args.
            argsOutput.passCommandLineArgs(sArgs(0), sArgs(1))
        End If

.

.

.

.

In the argsOutput.passCommandlineArgs sub, instead of this:

    Friend Shared Sub passCommandLineArgs()
        Console.WriteLine(actionToTake)
        Console.WriteLine(fullKeyValue)

        MessageBox.Show("This is the full Registry key value.")
        MessageBox.Show("Stop.")

        If actionToTake = "/verify" Then
            regkeyvalue_Verify.runVerification()
        ElseIf actionToTake = "/undo" Then
            regkeyvalue_Undo.runDeletion()
        ElseIf actionToTake = "/apply" Then
            regkeyvalue_Apply.runApplying()
        End If
    End Sub

I can do this:

    Friend Shared Sub passCommandLineArgs(actionToTake As String, fullKeyValue As String)
        Console.WriteLine(actionToTake)
        Console.WriteLine(fullKeyValue)

        MessageBox.Show("This is the full Registry key value.")
        MessageBox.Show("Stop.")

        If actionToTake = "/verify" Then
            regkeyvalue_Verify.runVerification()
        ElseIf actionToTake = "/undo" Then
            regkeyvalue_Undo.runDeletion()
        ElseIf actionToTake = "/apply" Then
            regkeyvalue_Apply.runApplying(fullKeyValue)
        End If
    End Sub

.

.

.

.

Then in the applying class, instead of this:

Public Class regkeyvalue_Apply
    ' If the user chooses to /apply the Registry key value,
    ' create or edit the proper key value if it exists.

    ' I'm using a solution based on this thread:
    ' https://social.msdn.microsoft.com/Forums/en-US/7272f987-bfb5-4bac-a72c-dfde5745832f/how-to-use-add-read-change-delete-registry-keys-with-vbnet?forum=Vsexpressvb

    Friend Shared Sub runApplying()
        MessageBox.Show("/apply was chosen.")
        Dim tempVal As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", Nothing)

        ' First see if there's a key value to edit.
        If tempVal IsNot Nothing Then
            ' Next, if the user is admin, edit the key value. Using a try/catch because I don't know
            ' how to do it properly. Can't find any examples in VB.

            ' Now we can edit the key value.
            ' Code from:
            ' https://social.msdn.microsoft.com/Forums/en-US/7272f987-bfb5-4bac-a72c-dfde5745832f/how-to-use-add-read-change-delete-registry-keys-with-vbnet?forum=Vsexpressvb

            Try
                Dim editFrom As RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)
                ' Now edit the Registry key value.
                editFrom.SetValue("SettingsPageVisibility", fullKeyValue)
                editFrom.Close()
            Catch ex As Security.SecurityException
                ' Tell the user if they're not elevated.

                MessageBox.Show("The Registry key value cannot be edited because the app isn't running as Administrator. Please elevate and try again.")
            End Try
        End If
    End Sub
End Class

I can do this:

Public Class regkeyvalue_Apply
    ' If the user chooses to /apply the Registry key value,
    ' create or edit the proper key value if it exists.

    ' I'm using a solution based on this thread:
    ' https://social.msdn.microsoft.com/Forums/en-US/7272f987-bfb5-4bac-a72c-dfde5745832f/how-to-use-add-read-change-delete-registry-keys-with-vbnet?forum=Vsexpressvb

    Friend Shared Sub runApplying(fullKeyValue As String)
        MessageBox.Show("/apply was chosen.")
        Dim tempVal As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", Nothing)

        ' First see if there's a key value to edit.
        If tempVal IsNot Nothing Then
            ' Next, if the user is admin, edit the key value. Using a try/catch because I don't know
            ' how to do it properly. Can't find any examples in VB.

            ' Now we can edit the key value.
            ' Code from:
            ' https://social.msdn.microsoft.com/Forums/en-US/7272f987-bfb5-4bac-a72c-dfde5745832f/how-to-use-add-read-change-delete-registry-keys-with-vbnet?forum=Vsexpressvb

            Try
                Dim editFrom As RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)
                ' Now edit the Registry key value.
                editFrom.SetValue("SettingsPageVisibility", fullKeyValue)
                editFrom.Close()
            Catch ex As Security.SecurityException
                ' Tell the user if they're not elevated.

                MessageBox.Show("The Registry key value cannot be edited because the app isn't running as Administrator. Please elevate and try again.")
            End Try
        End If
    End Sub
End Class

I may have to modify this a little, but this is generally what should be done. Also, global string variables can be removed from the code where they're defined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.