CreateProcess doesn't start specific executable
-
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.
-
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.
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_»
-
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_»
-
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.
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
-
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.