Results 1 to 8 of 8

Thread: Calling QT dll from device driver

  1. #1
    Join Date
    Oct 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Calling QT dll from device driver

    Hi,

    I have written a QT dll and that dll needs to be called by printer device driver so that a UI can be shown. But loading of dll gets failed when I call LoadLibrary. I have tried with normal dll written in c++ and it gets loaded successfully from printer driver. Is it possible to load QT dll from printer driver. If yes, can you please suggest a way to load it.

    Thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Calling QT dll from device driver

    You really shouldn't be doing this. The OS uses seperate rings for device drivers and user applications, and you should abide by this. You device driver should do nothing apart from communicating from the printer to user space and vice versa. An application running in ring 3 (user space) should handle the UI and communicate with the device driver via the usual means. This also means that an error in the user space application doesn't take down the entire system like it would if you did it in the driver.

  3. #3
    Join Date
    Oct 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Calling QT dll from device driver

    Hi,
    Many thanks for quick reply.
    However my driver is in USER MODE. Also I tried creating MFC dll which contains dialog and it gets successfully called and the dialog is shown from driver.
    I don't know why the QT dll is not getting loaded. Any help is really appreciated.

    Thanks and Regards
    Amol.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Calling QT dll from device driver

    Quote Originally Posted by AmolShinde_8 View Post
    But loading of dll gets failed when I call LoadLibrary.
    Can you please tell wich error you get?

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Calling QT dll from device driver

    Is the calling process driver running in an environment in which the Qt DLLs are found in the path? Paths provided to system processes etc. are deliberately limited.

  6. #6
    Join Date
    Oct 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Calling QT dll from device driver

    I have copied the neccassary QT standard dlls into the driver path. QT dll gets loaded successfully but when the exported function is called it crashes in the middle neither in driver nor in dll.

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Calling QT dll from device driver

    Quote Originally Posted by AmolShinde_8 View Post
    However my driver is in USER MODE. Also I tried creating MFC dll which contains dialog and it gets successfully called and the dialog is shown from driver.
    I don't know why the QT dll is not getting loaded. Any help is really appreciated.
    Not sure what you mean, a driver is typically a .sys file which is loaded by the kernel, and thus is resident in kernel memory. Unless you don't mean a driver in the typical sense.

    What function are you calling from Qt that is crashing? If you use WinDbg, it will tell you exactly where it is crashing also, and also the call stack of what called it.

  8. #8
    Join Date
    Oct 2008
    Posts
    15
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Calling QT dll from device driver

    Hi,

    Manz thanks for helping me out.
    I am modifying the DDK provided printer driver named oemui. When you compile this it creates .dll file and I have put this dll into C:\WINDOWS\system32\spool\drivers\w32x86\3 using addprinter and provided INF file.
    For other Question, I have just created a simple QT dll and exported a function and calling this function from this oemui.dll. I have copied this sample dll and other std QT dll into C:\WINDOWS\system32\spool\drivers\w32x86\3 folder. This sample dll gets loaded successfully but when I call the exported function oemui dll crashed. What I see here is the sample qt dlläs exported function is not called. However when I create a simple MFC UI dll this dll gets loaded successfully.
    Also I tried to create a normal window application and called this sample QT dlläs exported function still I see the crash.
    I think the problem here is we need to initialize QCoreApplication object in DLL. Can you please me in sorting this.

Similar Threads

  1. Communicating with a USB device in Qt?
    By N3wb in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2011, 10:30
  2. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 15:00
  3. Making new gfxscreen driver for my device
    By albatros in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 10th August 2010, 12:24
  4. Custom gfx driver(subdriver) with Transformed gfx driver - is this possible?
    By slscripters in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th June 2010, 10:25
  5. Handheld Device
    By freelyfallers in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 12:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.