Results 1 to 3 of 3

Thread: "Process failed to start" Error when using QProcess to run ie4uinit.exe

  1. #1
    Join Date
    Sep 2014
    Posts
    27
    Thanks
    2
    Thanked 2 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default "Process failed to start" Error when using QProcess to run ie4uinit.exe

    So I'm trying to put code in my application to refresh the user's icon cache so that I can ensure that their project files get the appropriate icons associated with them.

    In order to do this, I need to run ie4unit.exe which is in System32. This should be simple, but for some reason I can't run this from Qt no matter what I try. I'm hoping I can get some insight from here.

    Here's the code, I did test this in an isolated new project and it still doesn't work.

    Qt Code:
    1. QProcess* process = new QProcess();
    2. connect(process, &QProcess::errorOccurred, this, [=]{
    3. qDebug()<<process->errorString();
    4. qDebug()<<process->arguments();
    5. qDebug()<<process->workingDirectory();
    6. qDebug()<<process->processId();
    7. });
    8.  
    9. connect(process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, [=](int exitCode, QProcess::ExitStatus exitStatus){
    10. qDebug()<<" process finished";
    11. });
    12. connect(process, &QProcess::started, this, [=]{
    13. qDebug()<<" process started";
    14. });
    15.  
    16. QString winPath = QString::fromUtf8(qgetenv("windir")) + "\\System32\\";
    17. process->setWorkingDirectory(winPath);
    18. process->start("ie4uinit.exe", QStringList()<<"-ClearIconCache");
    19. process->waitForStarted();
    To copy to clipboard, switch view to plain text mode 

    You can see I have some debug statements in there. The output I'm getting is:

    "Process failed to start: No such file or directory"
    ("-ClearIconCache")
    "C:\\Windows\\System32\\"
    0
    So it is not starting because it can't find the file, the arguments are being provided correctly, and the working directory is set up correctly. I have confirmed that I can run this via command line with the command "ie4uinit.exe -ClearIconCache". The file does exist in the correct location.

    Not only that, but if I pick a different exe from System32, such as "dvdplay.exe" It runs fine. I get the "process started" and "process finished" debug messages. The code is the same, and the directory is the same, the only thing I did was change the exe in process->start().

    I thought maybe the error message was misleading and this was a permissions problem, but I checked the permissions of dvdplay.exe and compared them to the permissions of "ie4uinit.exe". The permissions are all exactly the same.

    I'm at a bit of a loss here.

    Any suggestions?

  2. #2
    Join Date
    Sep 2014
    Posts
    27
    Thanks
    2
    Thanked 2 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: "Process failed to start" Error when using QProcess to run ie4uinit.exe

    SOLVED!

    For anyone stumbling onto this thread in the future...

    It seems that there is some sort of incompatibility with MinGW compiler and running this particular exe using QProcess. By using MSVC compiler it worked fine. This will be a bit of a problem for my project/organization as we have been using MinGW, but we will have to figure something out.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,072
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: "Process failed to start" Error when using QProcess to run ie4uinit.exe

    That seems really unlikely. All parts of Qt that are Windows platform-dependent go through an abstraction layer that eventually ends up making a Windows system call.

    My hunch is it has nothing to do with the compiler at all and has more to do with the permissions set in the environment in which you are trying to run the program. That specific program might require elevated permissions in order to run; the standard uninformative Windows error in that case is the one you see, basically, if you don't have permission to run the program, pretend it doesn't exist. If your testing has included running it from a command line where you have admin permissions, then it will work. If you start Visual Studio with elevated permissions, it will work. If you run plain old Qt Creator with no special permission, it will fail.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. getting error Failure "SSL handshake failed"
    By Radhika in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2015, 21:26
  2. Replies: 0
    Last Post: 14th April 2014, 14:58
  3. cmake error with Failed to find "glu32" in ""
    By kennethadammiller in forum Qt Programming
    Replies: 1
    Last Post: 12th September 2013, 23:12
  4. "Process failed to start: " and qprocess generic errors
    By scott_hollen in forum Qt Programming
    Replies: 8
    Last Post: 22nd November 2011, 15:03
  5. Replies: 2
    Last Post: 20th November 2007, 20:00

Tags for this Thread

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.