Error 1314 From Createprocessasuser
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Createprocessasuser Error 2
policies of this site About Us Learn more about Stack Overflow the createprocessasuser error 5 company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Createprocessasuser Example
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only se_tcb_name privilege takes a minute: Sign up LogonUser + CreateProcessAsUser at Service = error 1314 up vote 1 down vote favorite 1 I have a windows service created with Delphi 7, with StartType = stSystem. Now I need to launch an application to make some things for me. This application has a MainForm and other GDI resources. The parameter passed to the application se_increase_quota_name assigns values for some controls (like edits and memos) and then click at a button.... I'm trying this: var token: cardinal; si: TStartupInfo; pi: TProcessInformation; begin if not LogonUser('admintest', '', 'secret123', LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) then RaiseLastOSError; try if not ImpersonateLoggedOnUser(token) then RaiseLastOSError; fillchar(si, sizeof(si), 0); si.cb := sizeof(si); si.lpDesktop := PChar('winsta0\default'); if not CreateProcessAsUser(token, nil, '"c:\...\myapp.exe" -doCrazyThings', nil, nil, false, NORMAL_PRIORITY_CLASS or CREATE_NEW_CONSOLE, nil, nil, si, pi) then RaiseLastOSError; CloseHandle(pi.hThread); waitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); finally CLoseHandle(token); end; end; When I run my service executable as a normal application (-noservice), it starts as a Forms.Application and creates a MainForm with a button "Start". *The button runs the same code that service run, but it doesn't works and it's rasing the eror code 1314 at createprocessasuser.* Why? What is the diference between SYSTEM service and a normal application launched by a administrator? My environment is a Windows 7 Pro x64 What am I doing wrong? How can I solve this? Can someone post an example? delphi share|improve this question edited Oct 30 '12 at 19:40 asked Oct 30 '12 at 18:42 Beto N
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss
Error_privilege_not_held
the workings and policies of this site About Us Learn more about se_assignprimarytoken_name Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow
Error 1314 The Specified Path Is Unavailable
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each http://stackoverflow.com/questions/13145632/logonuser-createprocessasuser-at-service-error-1314 other. Join them; it only takes a minute: Sign up Why does the CreateProcessAsUser have error 1314 in my code? up vote 0 down vote favorite 1 I need to create process as user. However during creating the process some error appears. The error is: 1314 CreateProcessAsUser A required privilege is not held by the client. import win32api http://stackoverflow.com/questions/33816942/why-does-the-createprocessasuser-have-error-1314-in-my-code import win32security import win32process import pywintypes def attempt_to_logon(): username = "abcdef" password = "123456" try: hUser = win32security.LogonUser(username, None, password, win32security.LOGON32_LOGON_INTERACTIVE, win32security.LOGON32_PROVIDER_DEFAULT) except win32security.error: print "unable to logon" return None return hUser def run_as_user(hUser): startup = win32process.STARTUPINFO() startup.dwFlags = win32process.STARTF_USESHOWWINDOW startup.wShowWindow = win32con.SW_SHOW startup.lpDesktop = 'winsta0\default' try: result = win32process.CreateProcessAsUser(hUser, None, # appName "c:\\windows\\notepad.exe", # commandLine None, # process attrs None, # thread attrs 0, # inherit handles 0, # create flags None, # new environment dict None, # current directory startup) # startup info except pywintypes.error, (errcode, method, msg): print errcode, method, msg def AdjustPriv(priv, enable=1): flags = win32security.TOKEN_ADJUST_PRIVILEGES | win32security.TOKEN_QUERY htoken = win32security.OpenProcessToken( win32api.GetCurrentProcess(), flags) id = win32security.LookupPrivilegeValue(None, priv) if enable: newPriv = [(id, win32security.SE_PRIVILEGE_ENABLED)] else: newPriv = [(id, 0)] win32security.AdjustTokenPrivileges(htoken, 0, newPriv) if __name__ == "__main__": AdjustPriv(win32security.SE_TCB_NAME) AdjustPriv(win32security.SE_ASSIGNPRIMARYTOKEN_NAME) AdjustPriv(win32security.SE_INCREASE_QUOTA_NAME) hUser = attempt_to_logon() run_as_user(hUser) The error is in function run_as_user, when I try to create the process. I was able to read, that I have to set SE_TCB_NAME, SE_ASSIGNPRIMARYTOKEN_NAME and E_INCREASE_QUOTA_NAME for using CreateProcessAsUser. So I have no idea where the
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen