C
cyf_00002
Unregistered / Unconfirmed
GUEST, unregistred user!
引用了linuxping的GinaFunctionDeclare单元,只是修改了下函数申明,除了WlxActivateUserShell把所有的MY去掉了(省心),<br>我的代码如下<br>function WlxActivateUserShell(pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall;<br>var<br>sinfo:TStartupInfo;<br>pinfo:TProcessInformation ;<br>bRet:Bool;<br>begin<br><br> ShowMessage(PGINA_CONTEXT(pWlxContext)^.LoginName);<br> ShowMessage(PGINA_CONTEXT(pWlxContext)^.Password);<br><br><br> sInfo.cb:=SizeOf(TStartupInfo);<br> sInfo.lpDesktop:=pszDesktopName;<br> ShowMessage(IntToStr(PGINA_CONTEXT(pWlxContext)^.UserToken));<br><br> bRet:=CreateProcessAsUser(PGINA_CONTEXT(pWlxContext)^.UserToken,'a.exe','',<br> nil,nil,false,CREATE_UNICODE_ENVIRONMENT,pEnvironment,NIL,sInfo,pInfo);<br> if bRet then<br> ShowMessage('yes')<br> else<br> ShowMessage(PChar('CreateProcessAsUser' + SysErrorMessage(GetLastError)));<br><br> Result:=MyWlxActivateUserShell(pWlxContext, pszDesktopName, pszMprLogonScript, pEnvironment);<br><br>end;<br>想创建个用户权限的进程。运行发现<br> PGINA_CONTEXT(pWlxContext)^.UserToken总是等于0,没有权限执行。<br>PGINA_CONTEXT(pWlxContext)^.LoginName是乱码,PGINA_CONTEXT(pWlxContext)^.Password是空