UNC路径上的CreateProcess失败。 [英] CreateProcess on a UNC path failing.

查看:99
本文介绍了UNC路径上的CreateProcess失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图使用CreateProcess运行UNC路径中的exe,指定完整的UNC路径和参数作为API的参数。



Hi,

I am trying to run a exe present in the UNC path using CreateProcess, specifying the full UNC path and the parameters as the arguments to the API.

CreateProcess(strConfigUtilPath.c_str(),(LPWSTR)strParams.c_str(),NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi)





在Windows 7上,这会返回错误1326 - 登录失败。为了解决这个问题,我尝试在调用CreateProcess()之前使用NetUseAdd()来建立连接。





On Windows 7 this returns me the error 1326 - log on failure. To counter this I tried to use NetUseAdd() to establish the connection before calling CreateProcess().

USE_INFO_2 UserInfo = {0};
	UserInfo.ui2_local = L"\0";
        UserInfo.ui2_remote = L"\\\\10.195.5.195\\ConfigUtil";
	UserInfo.ui2_password =  (LPWSTR)L"password";
	UserInfo.ui2_asg_type = USE_DISKDEV/*USE_IPC*/;
	UserInfo.ui2_username =  (LPWSTR)L"Someuser";
	UserInfo.ui2_domainname        =  L"Somedomain";
	UserInfo.ui2_refcount=0;
	UserInfo.ui2_status =0;
	UserInfo.ui2_usecount=0;
	DWORD ParmError=0;
	NET_API_STATUS status = NetUseAdd(szServerName,2,(LPBYTE)&UserInfo,&ParmError);





但NetUseAdd()也会返回相同的错误代码1326.



我做错了什么?我怎样才能做到这一点?任何其他方式来实现这项工作?



But NetUseAdd() also returns the same error code 1326.

What am I doing wrong? How can I make this work ? Any other way to achieve this job?

推荐答案

所以我通过名为Net.exe的参数use以及其他参数来解决这个问题。无法使api工作。
So I work around this problem by called Net.exe with parameter "use " along with other parameters. Could not make the api work.


这篇关于UNC路径上的CreateProcess失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆