Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateProcess doesn't start specific executable

CreateProcess doesn't start specific executable

Scheduled Pinned Locked Moved C / C++ / MFC
csharpgraphicsoophelpdiscussion
5 Posts 4 Posters 0 Views 1 Watching
  • 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.
  • 3 Offline
    3 Offline
    3Dizard
    wrote on last edited by
    #1

    Hi, I want to start a certain process called nvcplui.exe within my application. That process is the Nvidia Control Panel process. To do so I use the CreateProcess function. Here is my short code:

     if( !CreateProcess( NULL,   // No module name (use command line)
    	 "C:\\\\Windows\\\\System32\\\\nvcplui.exe",        // Command line
    	  NULL,           // Process handle not inheritable
    	  NULL,           // Thread handle not inheritable
    	  FALSE,          // Set handle inheritance to FALSE
    	  0,              // No creation flags
    	  NULL,           // Use parent's environment block
    	  NULL,           // Use parent's starting directory 
    	  &si,            // Pointer to STARTUPINFO structure
    	  &processinfo )           // Pointer to PROCESS\_INFORMATION structure
     )
     {
    	  printf( "CreateProcess failed (%d)\\n", GetLastError() );
    	  return;
     }
    

    As you might guess that doesn't work for me. If I use another application instead, let's say notepad (just replacing nvcplui.exe with notepad.exe), the code just works fine. These are my investigations so far: - Using GetLastError delivers: "Create Process failed (2)". That, as far as I know, means file not found. But the file is there for sure. - Starting the process via command line manually (not via code) just works fine. No additional account privileges needed (was one of my first thoughts, but doesn't seem to be the case). - As already said starting another program using the above method seems to work just fine. - Using .net Process Class works fine with nvcplui.exe:

    System.Diagnostics.Process process = new System.Diagnostics.Process();
    process.StartInfo.FileName = "C:\\windows\\system32\\nvcplui.exe";
    process.Start();

    Important notes: I'm running windows vista 64bit and unfortunately can't test the whole thing on a 32bit system, because I have none with an nvidia graphics card (for the nvidia control panel) available. I'm using UAC, but as stated above, this shouldn't be the problem. I'm grateful for any hints. Thanks in advance.

    _ S S 3 Replies Last reply
    0
    • 3 3Dizard

      Hi, I want to start a certain process called nvcplui.exe within my application. That process is the Nvidia Control Panel process. To do so I use the CreateProcess function. Here is my short code:

       if( !CreateProcess( NULL,   // No module name (use command line)
      	 "C:\\\\Windows\\\\System32\\\\nvcplui.exe",        // Command line
      	  NULL,           // Process handle not inheritable
      	  NULL,           // Thread handle not inheritable
      	  FALSE,          // Set handle inheritance to FALSE
      	  0,              // No creation flags
      	  NULL,           // Use parent's environment block
      	  NULL,           // Use parent's starting directory 
      	  &si,            // Pointer to STARTUPINFO structure
      	  &processinfo )           // Pointer to PROCESS\_INFORMATION structure
       )
       {
      	  printf( "CreateProcess failed (%d)\\n", GetLastError() );
      	  return;
       }
      

      As you might guess that doesn't work for me. If I use another application instead, let's say notepad (just replacing nvcplui.exe with notepad.exe), the code just works fine. These are my investigations so far: - Using GetLastError delivers: "Create Process failed (2)". That, as far as I know, means file not found. But the file is there for sure. - Starting the process via command line manually (not via code) just works fine. No additional account privileges needed (was one of my first thoughts, but doesn't seem to be the case). - As already said starting another program using the above method seems to work just fine. - Using .net Process Class works fine with nvcplui.exe:

      System.Diagnostics.Process process = new System.Diagnostics.Process();
      process.StartInfo.FileName = "C:\\windows\\system32\\nvcplui.exe";
      process.Start();

      Important notes: I'm running windows vista 64bit and unfortunately can't test the whole thing on a 32bit system, because I have none with an nvidia graphics card (for the nvidia control panel) available. I'm using UAC, but as stated above, this shouldn't be the problem. I'm grateful for any hints. Thanks in advance.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You haven't mentioned if you're running your program with elevated privileges. I'm guessing no. So try running your executable as an administrator.

      «_Superman_»

      3 1 Reply Last reply
      0
      • _ _Superman_

        You haven't mentioned if you're running your program with elevated privileges. I'm guessing no. So try running your executable as an administrator.

        «_Superman_»

        3 Offline
        3 Offline
        3Dizard
        wrote on last edited by
        #3

        Thanks for the answer, but running the program as administrator doesn't change anything. This is what I expected, because nvcplui.exe doesn't need admin rights to be executed.

        1 Reply Last reply
        0
        • 3 3Dizard

          Hi, I want to start a certain process called nvcplui.exe within my application. That process is the Nvidia Control Panel process. To do so I use the CreateProcess function. Here is my short code:

           if( !CreateProcess( NULL,   // No module name (use command line)
          	 "C:\\\\Windows\\\\System32\\\\nvcplui.exe",        // Command line
          	  NULL,           // Process handle not inheritable
          	  NULL,           // Thread handle not inheritable
          	  FALSE,          // Set handle inheritance to FALSE
          	  0,              // No creation flags
          	  NULL,           // Use parent's environment block
          	  NULL,           // Use parent's starting directory 
          	  &si,            // Pointer to STARTUPINFO structure
          	  &processinfo )           // Pointer to PROCESS\_INFORMATION structure
           )
           {
          	  printf( "CreateProcess failed (%d)\\n", GetLastError() );
          	  return;
           }
          

          As you might guess that doesn't work for me. If I use another application instead, let's say notepad (just replacing nvcplui.exe with notepad.exe), the code just works fine. These are my investigations so far: - Using GetLastError delivers: "Create Process failed (2)". That, as far as I know, means file not found. But the file is there for sure. - Starting the process via command line manually (not via code) just works fine. No additional account privileges needed (was one of my first thoughts, but doesn't seem to be the case). - As already said starting another program using the above method seems to work just fine. - Using .net Process Class works fine with nvcplui.exe:

          System.Diagnostics.Process process = new System.Diagnostics.Process();
          process.StartInfo.FileName = "C:\\windows\\system32\\nvcplui.exe";
          process.Start();

          Important notes: I'm running windows vista 64bit and unfortunately can't test the whole thing on a 32bit system, because I have none with an nvidia graphics card (for the nvidia control panel) available. I'm using UAC, but as stated above, this shouldn't be the problem. I'm grateful for any hints. Thanks in advance.

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Try using the ShellExecute[^] function like the following:

          int res = (int)ShellExecute(
          NULL, // HWND hwnd
          NULL, // LPCTSTR lpOperation
          "C:\\windows\\system32\\nvcplui.exe", // LPCTSTR lpFile,
          NULL, // LPCTSTR lpParameters
          NULL, // LPCTSTR lpDirectory
          SW_NORMAL // INT nShowCmd
          );
          if (res <= 32)
          {
          // Error!
          }

          Steve

          1 Reply Last reply
          0
          • 3 3Dizard

            Hi, I want to start a certain process called nvcplui.exe within my application. That process is the Nvidia Control Panel process. To do so I use the CreateProcess function. Here is my short code:

             if( !CreateProcess( NULL,   // No module name (use command line)
            	 "C:\\\\Windows\\\\System32\\\\nvcplui.exe",        // Command line
            	  NULL,           // Process handle not inheritable
            	  NULL,           // Thread handle not inheritable
            	  FALSE,          // Set handle inheritance to FALSE
            	  0,              // No creation flags
            	  NULL,           // Use parent's environment block
            	  NULL,           // Use parent's starting directory 
            	  &si,            // Pointer to STARTUPINFO structure
            	  &processinfo )           // Pointer to PROCESS\_INFORMATION structure
             )
             {
            	  printf( "CreateProcess failed (%d)\\n", GetLastError() );
            	  return;
             }
            

            As you might guess that doesn't work for me. If I use another application instead, let's say notepad (just replacing nvcplui.exe with notepad.exe), the code just works fine. These are my investigations so far: - Using GetLastError delivers: "Create Process failed (2)". That, as far as I know, means file not found. But the file is there for sure. - Starting the process via command line manually (not via code) just works fine. No additional account privileges needed (was one of my first thoughts, but doesn't seem to be the case). - As already said starting another program using the above method seems to work just fine. - Using .net Process Class works fine with nvcplui.exe:

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = "C:\\windows\\system32\\nvcplui.exe";
            process.Start();

            Important notes: I'm running windows vista 64bit and unfortunately can't test the whole thing on a 32bit system, because I have none with an nvidia graphics card (for the nvidia control panel) available. I'm using UAC, but as stated above, this shouldn't be the problem. I'm grateful for any hints. Thanks in advance.

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            Try using FileMon[^] to see what files your program is accessing - this can confirm whether or not it's trying to open your particular nvcplui.exe for execution?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups