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

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值