Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to read from Windows 10 registry?
QtWS25 Last Chance

How to read from Windows 10 registry?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 310 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tomi
    wrote on 6 Jun 2022, 08:54 last edited by
    #1

    Hi,

    OS: Windows 10 64-bit
    application, which I wrote: 64 bit for Windows

    I have a key in registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationName

    How can I read from it?

    When I try:

        QSettings settings(QSettings::Scope::SystemScope, "companyName", "applicationName");
    
        qDebug()<<settings.fileName();
    

    I get:

    "\\HKEY_LOCAL_MACHINE\\Software\\companyName\\applicationName"
    

    I don't see WOW6432Node

    On docs I see only:

    Note: On Windows, for 32-bit programs running in WOW64 mode, settings are stored in the following registry path: HKEY_LOCAL_MACHINE\Software\WOW6432node. 
    
    J 1 Reply Last reply 6 Jun 2022, 10:12
    1
    • T Tomi
      6 Jun 2022, 10:34

      @JonB

      Because I have Inno Setup, which add key to this location

      C Offline
      C Offline
      Cobra91151
      wrote on 6 Jun 2022, 10:58 last edited by
      #4

      @Tomi

      Hello!

      You need to use QSettings a bit differently. Please check out my test code below and the docs for QVariant QSettings::value method (https://doc.qt.io/qt-5/qsettings.html#value)

      Code:

      QSettings *testSettings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\WOW6432Node\\companyName\\applicationName", QSettings::NativeFormat, this);
      QVariant testVariant = testSettings->value(const QString &key, const QVariant &defaultValue = QVariant());
      testSettings->deleteLater();
      

      If you still have issue, feel free to reply. Happy coding!

      1 Reply Last reply
      2
      • T Tomi
        6 Jun 2022, 08:54

        Hi,

        OS: Windows 10 64-bit
        application, which I wrote: 64 bit for Windows

        I have a key in registry:
        HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationName

        How can I read from it?

        When I try:

            QSettings settings(QSettings::Scope::SystemScope, "companyName", "applicationName");
        
            qDebug()<<settings.fileName();
        

        I get:

        "\\HKEY_LOCAL_MACHINE\\Software\\companyName\\applicationName"
        

        I don't see WOW6432Node

        On docs I see only:

        Note: On Windows, for 32-bit programs running in WOW64 mode, settings are stored in the following registry path: HKEY_LOCAL_MACHINE\Software\WOW6432node. 
        
        J Offline
        J Offline
        JonB
        wrote on 6 Jun 2022, 10:12 last edited by
        #2

        @Tomi
        The first question is why do you want to access WOW6432Node from a 64-bit program?

        1 Reply Last reply
        1
        • T Offline
          T Offline
          Tomi
          wrote on 6 Jun 2022, 10:34 last edited by
          #3

          @JonB

          Because I have Inno Setup, which add key to this location

          C 1 Reply Last reply 6 Jun 2022, 10:58
          0
          • T Tomi
            6 Jun 2022, 10:34

            @JonB

            Because I have Inno Setup, which add key to this location

            C Offline
            C Offline
            Cobra91151
            wrote on 6 Jun 2022, 10:58 last edited by
            #4

            @Tomi

            Hello!

            You need to use QSettings a bit differently. Please check out my test code below and the docs for QVariant QSettings::value method (https://doc.qt.io/qt-5/qsettings.html#value)

            Code:

            QSettings *testSettings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\WOW6432Node\\companyName\\applicationName", QSettings::NativeFormat, this);
            QVariant testVariant = testSettings->value(const QString &key, const QVariant &defaultValue = QVariant());
            testSettings->deleteLater();
            

            If you still have issue, feel free to reply. Happy coding!

            1 Reply Last reply
            2

            1/4

            6 Jun 2022, 08:54

            • Login

            • Login or register to search.
            1 out of 4
            • First post
              1/4
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved