Write an inaccessible registry

  • Hi everyone, I am from Taiwan.
    I am trying to write a registry which my application doesn't have write permission.
    My application runs under User's account and that registry is read-only for the user.

    Here are snippets of my codes:

    // write a registry on windows
    QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\kkbox", QSettings::NativeFormat);
    settings.setValue("kkSerial", serialNum);   //always fails

    I don't find any Qsetting constructor could meet my requirement.

  • Moderators

    just think about it: wouldn't the whole access protection mechanism be pointless when you could write it anyway?!?!
    You can try to run the application with admin privileges, but thats not an option anyway in your case i guess.

  • @raven-worx what I think he is asking here, is how to request permissions from UAC to do this operation.
    Like you know, some other programs that show you "this program requires administrator privileges" window at the start.

    I guess the permissions needed are encoded in the .exe metadata, but I'm quite interested to learn the details myself

  • This is how you can run your whole application as admin:
    run as admin

Log in to reply