简介
吐血分享!第一次遇到这种报错,往常的vs调试抓断点方法,attach方法均失效!明明进程都起来了,却被意外的关闭,像是有防调试的保护在运行,尝试了N多方法后,注意到调用这个进程的代码。。。
原因
打死也不会想到原因是出在多了一个‘’"。我是通过命令行起的进程,类似F:\\程序\123.exe
,就仅仅是多了个"\"
啊啊啊。罪魁代码如下:
bResult = CreateProcessAsUser(
hUserTokenDup, // client's access token
NULL, // file to execute
(LPTSTR) wstrCmdLine.c_str(), // command line
NULL, // pointer to process SECURITY_ATTRIBUTES
NULL, // pointer to thread SECURITY_ATTRIBUTES
FALSE, // handles are not inheritable
dwCreationFlags, // creation flags
pEnv, // pointer to new environment block
NULL, // name of current directory
&si, // pointer to STARTUPINFO structure
&pi // receives information about new process
);
wstrCmdLine命令行字符串多了个\导致进程未执行完就关闭,包运行时库异常