createprocess

How to create suspended process from c# without P/Invoke?

[亡魂溺海] 提交于 2020-01-11 10:08:14
问题 WinAPI CreateProcess has the flag CREATE_SUSPENDED so it's possible to attach process to JobObject before it has done something and then to call ResumeThread for its main thread. The only that I found searching for a solution is this post written 11 years ago! 回答1: The only way to do this is with CreateProcess . The .net Process class does not offer the functionality. Either p/invoke CreateProcess or use a mixed mode C++/CLI assembly to call the same. 来源: https://stackoverflow.com/questions

Windows 7 or Windows 2008 how to launch a process in Local System Account or System Context (from desktop aplication)

时光总嘲笑我的痴心妄想 提交于 2020-01-07 04:27:59
问题 In C++ I want to launch a process from my Desktop Application in "Local System account" or "System Context". My application executes with admin privileges. Is it possible? How? Thanks in advance. 回答1: You can do what SysRun does: install a system service and launch the app from the service. 来源: https://stackoverflow.com/questions/6939693/windows-7-or-windows-2008-how-to-launch-a-process-in-local-system-account-or-sys

Invoking nvcc.exe using CreateProcess

微笑、不失礼 提交于 2020-01-06 07:58:47
问题 We currently use a mock JIT compiler for CUDA, where nvcc.exe is invoked on some files and the resulting .ptx files are generated. bool executeWindowsProcess(ofstream &logFF) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); char cmd[] = "\"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v5.0\\bin\\nvcc.exe\""; char args[] = "\"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v5.0\\bin\\nvcc.exe\" --ptx -

What should the second parameter of CreateProcess be?

ぐ巨炮叔叔 提交于 2020-01-05 08:52:43
问题 I am trying to start a server using CreateProcess(). Here is the Code: int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. int result; STARTUPINFO si; PROCESS_INFORMATION pi; CreateProcess("C:\\AP\\DatabaseBase\\dbntsrv.exe", "*** WHAT SHOULD I PUT HERE***", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); return 0; } I did not understand from the documentation what the 2nd parameter should be. Can you please help me with

What should the second parameter of CreateProcess be?

拟墨画扇 提交于 2020-01-05 08:51:24
问题 I am trying to start a server using CreateProcess(). Here is the Code: int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. int result; STARTUPINFO si; PROCESS_INFORMATION pi; CreateProcess("C:\\AP\\DatabaseBase\\dbntsrv.exe", "*** WHAT SHOULD I PUT HERE***", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); return 0; } I did not understand from the documentation what the 2nd parameter should be. Can you please help me with

第四章 进程(7)CreateProcess函数详解

亡梦爱人 提交于 2019-12-31 17:10:52
进程的终止 若要终止进程的运行,可以使用下面四种方法: • 主线程的进入点函数返回(最好使用这个方法) 。 • 进程中的一个线程调用 ExitProcess 函数(应该避免使用这种方法) 。 • 另一个进程中的线程调用 TerminateProcess 函数(应该避免使用这种方法) 。 • 进程中的所有线程自行终止运行(这种情况几乎从未发生) 。 1 、主线程的进入点函数返回 始终都应该这样来设计应用程序,即只有当主线程的进入点函数返回时,它的进程才终止运行。这是保证所有线程资源能够得到正确清除的唯一办法。 让主线程的进入点函数返回,可以确保下列操作的实现: • 该线程创建的任何 C + + 对象将能使用它们的析构函数正确地撤消。 • 操作系统将能正确地释放该线程的堆栈使用的内存。 • 系统将进程的退出代码(在进程的内核对象中维护)设置为进入点函数的返回值。 • 系统将进程内核对象的返回值递减 1 。 2 、 ExitProcess 函数 (1) 当进程中的一个线程调用 ExitProcess 函数时,进程便终止运行: VOID ExitProcess(UINT fuExitCode) 该函数用于终止进程的运行,函数并不返回任何值,因为进程已经终止运行。如果在调用 ExitProcess 之后又增加了什么代码,那么该代码将永远不会运行。 (2) 当主线程的进入点函数(

CreateProcess and ShellExecute differences

*爱你&永不变心* 提交于 2019-12-30 06:10:07
问题 What are the main differences between the two? I'm willing to run only another EXE from my (C++) application. Are there any differences when inheriting environments, security features etc? 回答1: The main difference between CreateProcess and ShellExecute is the following: CreateProcess is more oriented on low level and ShellExec on the high user lever which see the user in explorer. For example using of CreateProcess one can use command line which length is more as MAX_PATH . It has 32,768

CreateProcess() fails with an access violation [duplicate]

限于喜欢 提交于 2019-12-28 01:27:29
问题 This question already has answers here : Unhandled Error with CreateProcess [duplicate] (2 answers) Closed last year . My aim is to execute an external executable in my program. First, I used system() function, but I don't want the console to be seen to the user. So, I searched a bit, and found CreateProcess() function. However, when I try to pass a parameter to it, I don't know why, it fails. I took this code from MSDN, and changed a bit: #include <windows.h> #include <stdio.h> #include

How to use createprocess to execute adb program in PATH?

牧云@^-^@ 提交于 2019-12-25 14:04:45
问题 I have add the adb location into PATH . In my C project, I want to execute the flowing cmd: char *broadcastStop = "adb shell am broadcast -a NotifyServiceStop"; char *forward = "adb forward tcp:12582 tcp:10086"; char *broadcastStart = "adb shell am broadcast -a NotifyServiceStart"; I can run the above using system() well. Now I want to run those hiding the console. I have found many similar question, and told CreateProcess can do. Here is my code: void system_hide(char *cmd) { STARTUPINFOW si

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

与世无争的帅哥 提交于 2019-12-23 22:07:03
问题 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 without any problem. I thought we had found the problem with this article, but our customer already has this patch on his system and the error is still occurring. If anyone