-
-
[求助]CreateProcessAsUser创建进程出错
-
发表于:
2012-1-13 11:53
9774
-
[求助]CreateProcessAsUser创建进程出错
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <winnt.h>
using namespace std;
void Start(char *user,char *pass,char *path)
{
HANDLE Token=NULL;
if(LogonUser(user,NULL,pass,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&Token))
{
printf("Token Ok!\n");
STARTUPINFO StartupInfo;
memset(&StartupInfo,0,sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
//StartupInfo.lpDesktop = "winsta0\\default";
PROCESS_INFORMATION ProcInfo;
memset(&ProcInfo,0,sizeof(ProcInfo));
if(CreateProcessAsUser(Token,path,NULL, NULL, NULL, FALSE,NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE , NULL, NULL, &StartupInfo, &ProcInfo))
{
printf("Start Ok!\n");
}
else
{
printf("%d\n",GetLastError());
}
}
}
int main(int argc, char* argv[])
{
Start("ceshi","123456","C:\\Temps.exe");
system("pause");
return 0;
}
提示temps.exe的错误:应用程序正常初始化失败
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)