createprocess

AssignProcessToJobObject fails with "Access Denied" error when running under the debugger

You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this? ...

How to get CreateProcess/CreateProcessW to execute a process in a path > MAX_PATH characters

I'm trying to get either CreateProcess or CreateProcessW to execute a process with a name < MAX_PATH characters but in a path that's greater than MAX_PATH characters. According to the docs at: http://msdn.microsoft.com/en-us/library/ms682425.aspx, I need to make sure lpApplicationName isn't NULL and then lpCommandLine can be up to 32,76...

Delphi - Gracefully Closing Created Process in Service. (using tprocess / createProcess)

I have a Windows Service written in Delphi which runs a number of programs. On Stopping the service, I want to also close these programs. When the service was originally written, this worked fine, but I think I've updated the tProcess component and now - The subordinate programs are not being closed. in tProcess - Here's the code whi...

Launching a Process from a Service

I'm trying to launch another process from a service (it's a console app that collects some data and writes it to the registry) but for some reason I can't get it to launch properly. I basics of what I'm am trying to do is as follows: Launch the process Wait for the process to finish Retrieve the return code from the process I am cur...

Why is CreateProcess failing in Windows Server 2003 64-bit ?

Hi, We have a 32-bit application that launches other 32-bit applications during its process. The application is working fine on other 64-bit platforms but on Windows Server 2003 64-bit, we get an error trying to launch the apps: error 193 (not a valid 32 bit application) We can manually launch these applications on that system withou...

Making CreateProcess inherit the console of the calling process

When I call CreateProcess in Windows, the new process doesn't seem to inherit the console of the calling process. I made a test program that runs "ruby xtest", xtest being a script that writes "hello" to standard output. I ran this test program from Emacs, and get no output. I also tried the following code calling GetStdHandle, but ag...

Can I access the string returned from a Delphi CreateProcess command?

I'm using the Win32 CreateProcess function to perform a call to an external executable. The executable returns a string. Is there a way I can capture and interrogate the returned string after calling the executable? Failing that, I might have to write out the string to a file in the executable and read that in the calling program afte...

CreateProcessWithLogonW() problems - Need to launch sub-processes with the same user

I have a Windows executable that is launched from within a service by calling CreateProcessWithLogonW() with a set of specfied user details. This works fine and the process starts as expected. However, when this process tries to launch other processes itself, currently just using CreateProcess() these start then die straight away - they...

CreateProcess and WaitForSingleObject fails on the second of two PDF files

All I use CreateProcess and WaitForSingleObject in Delphi 2007 to open files and wait for them to be closed. I have found that when I open two PDF files in a row, the second WaitForSingleObject returns immediately. I have also found that this happens for jpg and tif files but not txt files. Also the second PDF takes 10 seconds longer t...

How can I start explorer.exe via C++?

I'm trying to programmatically start explorer.exe but I'm not having any luck. This is my code: cout << pName << "died, lets restart it." << endl; STARTUPINFO startupInfo = {0}; startupInfo.cb = sizeof(startupInfo); PROCESS_INFORMATION processInformation; if(CreateProcess(pName, NULL, NULL, NULL, false, NORMAL_PRIORITY_CLASS, NULL, N...

Compiling GWT code with a large number of parameters -- char limit on CreateProcess?

Hello all, I am trying to run an ant build script that compiles GWT. This script includes a large number of libraries, each with a relatively long path. My GWT code only touches some of these libraries; however, it is convenient to include all of the libaries from the lib directory that I use for this and all of the other applications...

How to launch a GUI program in a Windows service?

When I run a service as LocalSystem account, I can use following codes to launch a GUI program under current login account: WTSGetActiveConsoleSessionId->WTSQueryUserToken->CreateProcessAsUser However, when I run the service as my personal account, the GUI program will NOT show up. I can see it in task manager though. What should I do...

Vista: Can an EXE bypass user confirmation while invoking another EXE?

I have 2 applications written in Delphi. The first exe (with a user interface) calls another using ShellExecuteEx(), which runs as a background process. When the first exe invokes the second, one of these two things happen: When I log in as an admin, a UAC dialog comes up with the Allow/Cancel prompts. Selecting Allow continues the e...

CreateProcess doesn't pass command line arguments

Hello I have the following code but it isn't working as expected, can't figure out what the problem is. Basically, I'm executing a process (a .NET process) and passing it command line arguments, it is executed successfully by CreateProcess() but CreateProcess() isn't passing the command line arguments What am I doing wrong here?? int ...

Creating hidden processes (window not visible)

I'm using CreateProcess() with startup flags set to STARTF_USESHOWWINDOW and SW_HIDE to start an application in the background with its window hidden. I'm doing this to run a scheduled maintenance tasks and i don't want to be bothered with windows. In most cases the windows are hidden but there are cases where the program's window pops ...

"Wrong" app gets pinned to taskbar (Windows 7)

I have an application that gets started via a shortcut. This application than starts a Java GUI application with CreateProcess(). When the Java application gets pinned to the taskbar the javaw.exe gets pinned to the taskbar instead of the "expected" shortcut. Only the native executable which launches Java can be modified - the shortcut ...

Problem starting a process with CreateProcess()

The question is given like this: Using the CreateProcess () in the Win32 API. In this instance, you will need to specify a separate program to be invoked from CreateProcess(). It is this separate program that will run as a child process outputting the Fibonacci sequence. Perform necessary error checking to ensure that a non-negative ...

Unbuffered CreateNamedPipe for use as stdout for CreateProcess

I would like to execute arbitrary command-line application and read its standard output as it gets produced. I use CreateNamedPipe to create a pipe and then supply other end (open used CreateFile) to CreateProcess. Provided the target process doesn't explicitly manipulates with standard output bufferring is there a way to make sure that ...

How can I create a process in a portable manner?

Hi, I'm trying to write a program which needs to create some other processes. I'm used to the Windows API but now I need my program to be able to run in a Linux platform too. Is it possible to do it in a portable manner? Do I have to use the preprocessor for that purpose? EDIT: I need to wait for it to finish before continuing to do th...

create an independent hidden process

I'm creating an application with its main window hidden by using the following code: STARTUPINFO siStartupInfo; PROCESS_INFORMATION piProcessInfo; memset(&siStartupInfo, 0, sizeof(siStartupInfo)); memset(&piProcessInfo, 0, sizeof(piProcessInfo)); siStartupInfo.cb = sizeof(siStartupInfo); siStartupInfo.dwFlags = STARTF_USESHOWWINDOW | ...