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. Dll with Qt UI Form to inject in third-party process - Is it possible?
QtWS25 Last Chance

Dll with Qt UI Form to inject in third-party process - Is it possible?

Scheduled Pinned Locked Moved Unsolved General and Desktop
dllui form
7 Posts 3 Posters 2.0k 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.
  • P Offline
    P Offline
    PoisonXD
    wrote on last edited by
    #1

    Hello, friends :)

    Im new with Qt Creator. Yesterday, i was trying to make a thing for 8 hours, but i failed. I didn't found anything that solves my problem (searched on YouTube, forums, Google and much places).

    What i want?

    • I want to make a Dll with a Qt form. Then, i want to inject this Dll (with a Dll injector) in a third-party process that i dont have the source.
    • Basically, i want to make a Dll with a main window and, when i inject this Dll in a specific process, this window needs to appear (i want to implement controls in this window after).

    I successfully managed about how to do it (create a simple window) but only as exe, but i really need it as a Dll.

    Can someone help me? Please :(

    Pl45m4P 1 Reply Last reply
    0
    • P PoisonXD

      Hello, friends :)

      Im new with Qt Creator. Yesterday, i was trying to make a thing for 8 hours, but i failed. I didn't found anything that solves my problem (searched on YouTube, forums, Google and much places).

      What i want?

      • I want to make a Dll with a Qt form. Then, i want to inject this Dll (with a Dll injector) in a third-party process that i dont have the source.
      • Basically, i want to make a Dll with a main window and, when i inject this Dll in a specific process, this window needs to appear (i want to implement controls in this window after).

      I successfully managed about how to do it (create a simple window) but only as exe, but i really need it as a Dll.

      Can someone help me? Please :(

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @PoisonXD said in Dll with Qt UI Form to inject in third-party process - Is it possible?:

      I successfully managed about how to do it (create a simple window) but only as exe, but i really need it as a Dll.

      Can't believe that you've googled without finding this

      • https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

      • https://myprogrammingnotes.com/create-dll-qt.html


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PoisonXD
        wrote on last edited by PoisonXD
        #3

        Hi, Pl45m4, thanks for your reply :)

        Yap, i found these tutorials, but i tried and it doesn't work :(

        The maximum i got after 8 hours of trying was that i made a Dll but, when i tried to inject the Dll in a third-party process at runtime, it fails (the injector gives me 0x000... error, but i know it's not a problem with the injector and i tried with anothers too).

        After this error, i saw in Qt IDE that the Dll project we can create is to use at link-time (so this is why im thinking that it was not "designed" for what i want)

        Sorry, i don't know if you understood me.

        1 Reply Last reply
        0
        • KH-219DesignK Offline
          KH-219DesignK Offline
          KH-219Design
          wrote on last edited by
          #4

          (Without making any promise whatsoever), @PoisonXD it might help if you posted a link to the injector tool you are using.

          Also, is "0x000" the full error from the tool? Or is there more, such as "0x0000ef03" or something like that? If so, please share the whole error.

          I don't think many people here in this forum are using DLL injectors to inject Qt code into a process that not much is known about (i.e. you do not have the source code of it).

          You say "I know it's not a problem with the injector". On what basis do you know this? I'm willing to buy into that theory (that the problem is not with the injector), but nonetheless knowing more details about the injector would be helpful in any case.

          I don't think your scenario is going to match the expertise of most participants here, but in any case more details are required.

          www.219design.com
          Software | Electrical | Mechanical | Product Design

          1 Reply Last reply
          1
          • P Offline
            P Offline
            PoisonXD
            wrote on last edited by
            #5

            Hi, KH :D

            The injector i used was one of the most famous, it's called Xenos Injector.
            I use this injector since much years, and considering my experience with Xenos, i know that when this problem appears, it's because it's an error with the Dll.

            Let's explain a little more:
            Using Qt 5.15.2 with MingW 32-bit compiler (the process i'm trying to inject is 32-bit, this is why it needs to be compiled in x32), in File > New File or Project > Library, i created a C++ Library. The thing is: after tried much things, i saw in the C++ Library description that this project type is to use as "a shared or static C++ Library for use with another project at linktime". Basically, it said all: it's to use at linktime, and not with an injector in a runtime program.
            After it, i tried to search for another Dll project type in Qt Creator, but we only have "Qt Quick 2 Extension Plugin" and "Qt Creator Plugin", so i think this is not what i want.

            The error the injector gives me when i inject the Dll is: 0xC0000135. I searched about this error on Google and it says it's netframework related, but i already have it installed here.

            Important note: the process isn't protected against Dll-injection or something like this. I already tested it with another Dll's for a long time.

            Someone knows something about it? :\

            1 Reply Last reply
            0
            • KH-219DesignK Offline
              KH-219DesignK Offline
              KH-219Design
              wrote on last edited by
              #6

              @PoisonXD said in Dll with Qt UI Form to inject in third-party process - Is it possible?:

              it's to use at linktime, and not with an injector in a runtime program

              This does seem important.

              "At linktime" seems unambiguous to me. But the hypothetical (text that does not appear in your IDE but that would hypothetically say) "for use with an injector"....

              "for use with an injector" would be a bit ambiguous to me. (But this could be entirely due to my ignorance of injectors.)

              Are DLL(s) that are meant to be "optional plugins" that the EXE is designed to open with dlopen or (on windows) GetModuleHandle or LoadLibrary.... are those sorts of plugins suitable for use in injectors?

              Qt definitely has a broader concept of plugins than just Qt Quick Extensions.

              However, the more significant Qt plugins are meant to me built by framework developers (as opposed to a Qt user that would typically be an end-user application developer). So for this reason (in my understanding) it is the case that Qt Creator (for application developers) does not have a template for the framework plugins.

              But if you look at wherever the Qt framework is installed on your system, you may find many plugins such as:

              qt5_dbg_install/plugins
              ├── audio
              │   ├── libqtaudio_alsa.so
              │   └── libqtmedia_pulse.so
              ├── imageformats
              │   ├── libqgif.so
              │   ├── libqicns.so
              │   ├── libqico.so
              │   ├── libqjpeg.so
              │   ├── libqpdf.so
              │   ├── libqsvg.so
              │   ├── libqtga.so
              │   ├── libqtiff.so
              │   ├── libqwbmp.so
              │   └── libqwebp.so
              ├── platforms
              │   ├── libqeglfs.so
              │   ├── libqlinuxfb.so
              │   ├── libqminimalegl.so
              │   ├── libqminimal.so
              │   ├── libqoffscreen.so
              │   ├── libqvnc.so
              │   ├── libqwayland-egl.so
              │   ├── libqwayland-generic.so
              │   ├── libqwayland-xcomposite-egl.so
              │   ├── libqwayland-xcomposite-glx.so
              │   └── libqxcb.so
              ├── printsupport
              │   └── libcupsprintersupport.so
              

              These are loaded after the executable is launched. In other words, loaded at runtime.

              But that supposes the that executable in question is a Qt-dependent executable in the first place.

              I guess you didn't explicitly mention that yet....

              • The process into which you attempt the injection... is that process any kind of Qt executable?

              If not, then your injected code would (I believe) need to run a Qt event loop. Normally that would be done in the application's main.

              Anyway, if you have built other C++ DLL(s) that are getting injected successfully, then I would start from one of those as your starting point, and attempt to add some "sprinkle" of Qt gradually. For example, take a DLL that is working, and link it against only libQt5Core, and initially only try to call something like qVersion as a way of saying "hello world, there is some tiny bit of Qt happening in my code now".

              (reference: https://doc.qt.io/qt-5/qtglobal.html#qVersion )

              Once you get that working (an injectable DLL linked to libQt5Core and calling qVersion), then you can grow the effort outward from there.

              Note that when I say to start from some other C++ DLL you built that does behave "injectably", I would also recommend that you continue using whatever kind of makefile and build chain you used for that DLL. You don't have to switch to Qt Creator (or even to qmake) to link your project against Qt.

              www.219design.com
              Software | Electrical | Mechanical | Product Design

              P 1 Reply Last reply
              2
              • KH-219DesignK KH-219Design

                @PoisonXD said in Dll with Qt UI Form to inject in third-party process - Is it possible?:

                it's to use at linktime, and not with an injector in a runtime program

                This does seem important.

                "At linktime" seems unambiguous to me. But the hypothetical (text that does not appear in your IDE but that would hypothetically say) "for use with an injector"....

                "for use with an injector" would be a bit ambiguous to me. (But this could be entirely due to my ignorance of injectors.)

                Are DLL(s) that are meant to be "optional plugins" that the EXE is designed to open with dlopen or (on windows) GetModuleHandle or LoadLibrary.... are those sorts of plugins suitable for use in injectors?

                Qt definitely has a broader concept of plugins than just Qt Quick Extensions.

                However, the more significant Qt plugins are meant to me built by framework developers (as opposed to a Qt user that would typically be an end-user application developer). So for this reason (in my understanding) it is the case that Qt Creator (for application developers) does not have a template for the framework plugins.

                But if you look at wherever the Qt framework is installed on your system, you may find many plugins such as:

                qt5_dbg_install/plugins
                ├── audio
                │   ├── libqtaudio_alsa.so
                │   └── libqtmedia_pulse.so
                ├── imageformats
                │   ├── libqgif.so
                │   ├── libqicns.so
                │   ├── libqico.so
                │   ├── libqjpeg.so
                │   ├── libqpdf.so
                │   ├── libqsvg.so
                │   ├── libqtga.so
                │   ├── libqtiff.so
                │   ├── libqwbmp.so
                │   └── libqwebp.so
                ├── platforms
                │   ├── libqeglfs.so
                │   ├── libqlinuxfb.so
                │   ├── libqminimalegl.so
                │   ├── libqminimal.so
                │   ├── libqoffscreen.so
                │   ├── libqvnc.so
                │   ├── libqwayland-egl.so
                │   ├── libqwayland-generic.so
                │   ├── libqwayland-xcomposite-egl.so
                │   ├── libqwayland-xcomposite-glx.so
                │   └── libqxcb.so
                ├── printsupport
                │   └── libcupsprintersupport.so
                

                These are loaded after the executable is launched. In other words, loaded at runtime.

                But that supposes the that executable in question is a Qt-dependent executable in the first place.

                I guess you didn't explicitly mention that yet....

                • The process into which you attempt the injection... is that process any kind of Qt executable?

                If not, then your injected code would (I believe) need to run a Qt event loop. Normally that would be done in the application's main.

                Anyway, if you have built other C++ DLL(s) that are getting injected successfully, then I would start from one of those as your starting point, and attempt to add some "sprinkle" of Qt gradually. For example, take a DLL that is working, and link it against only libQt5Core, and initially only try to call something like qVersion as a way of saying "hello world, there is some tiny bit of Qt happening in my code now".

                (reference: https://doc.qt.io/qt-5/qtglobal.html#qVersion )

                Once you get that working (an injectable DLL linked to libQt5Core and calling qVersion), then you can grow the effort outward from there.

                Note that when I say to start from some other C++ DLL you built that does behave "injectably", I would also recommend that you continue using whatever kind of makefile and build chain you used for that DLL. You don't have to switch to Qt Creator (or even to qmake) to link your project against Qt.

                P Offline
                P Offline
                PoisonXD
                wrote on last edited by PoisonXD
                #7

                Are DLL(s) that are meant to be "optional plugins" that the EXE is designed to open with dlopen or (on windows) GetModuleHandle or LoadLibrary.... are those sorts of plugins suitable for use in injectors?

                Nop

                But that supposes the that executable in question is a Qt-dependent executable in the first place.
                I guess you didn't explicitly mention that yet....
                The process into which you attempt the injection... is that process any kind of Qt executable?

                Nop, it was not made with Qt.

                If not, then your injected code would (I believe) need to run a Qt event loop. Normally that would be done in the application's main.

                Im really really dumb with Qt, but i will try to do something with this information. It's just sad because i can't find any example of what i want :(

                Thanks

                1 Reply Last reply
                0

                • Login

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