关于msdn中CreateProcess函数说明的注释

来源:互联网 发布:淘宝订单待配货 编辑:程序博客网 时间:2024/05/17 04:32
msdn中CreateProcess函数关于lpApplicationName参数的说明里面有这么一段话

The string can specify the full path and file name of the module to execute or it can specify a partial name. In the case of a partial name, the function uses the current drive and current directory to complete the specification. The function will not use the search path. If the file name does not contain an extension, .exe is assumed. Therefore, if the file name extension is .com, this parameter must include the .com extension. [1]

但是实际测试表明并不会有默认的.exe的扩展名的


#include <windows.h>int main(){STARTUPINFO si = { 0 };si.cb = sizeof(STARTUPINFO);PROCESS_INFORMATION pi = { 0 };CreateProcess(L"D:\\a.exe",NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);// 成功//CreateProcess(L"D:\\a",NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);// 不成功CloseHandle(pi.hProcess);return 0;}


[1]ms-help://MS.MSDNQTR.v90.en/dllproc/base/createprocess.htm
[2]测试环境:windows xp sp2 + vs2008 sp1