createprocessasuser

why is CreateProcessWithTokenW failing with ERROR_ACCESS_DENIED

馋奶兔 提交于 2019-12-04 22:50:26
问题 I have a call to CreateProcessWithTokenW that is failing with access denied. Any ideas how to debug this? The call to CreateProcessWithTokenW is here: https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/ProcessUtil.cs For now I'm using a access token for the current process, eventually I'll use a token from another user. For now then I'm using https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/AccessToken.cs to get the access token. If you want

Get Window Station for a non-interactive user per process, user or session?

ⅰ亾dé卋堺 提交于 2019-12-04 18:24:55
When using CreateProcessAsUser we pass STARTUPINFO and with lpDesktop NULL, the target is winsta0/default, the interactive desktop of the interactive user. I wish to target a window station in another session of a second, non-interactive user, say a remote desktop user. I assume that it can't be winsta0 because that's reserved for the single interactive user. I am looking at the function list here: http://msdn.microsoft.com/en-us/library/ms687107(v=VS.85).aspx I can enumerate window stations on the machine, but how do I identify which window station is connected to which user/process/session?

CreateProecssAsUser elevated privilege?

假装没事ソ 提交于 2019-12-04 16:31:17
I'm getting an error with my CreateProcessAsUser function. It says "The requested operation requires elevation. " I thought i had given it the highest privilege i could. Anyone help? thanks My code is as follows: activeSessionId = WTSGetActiveConsoleSessionId();//get the currently logged on user's active session id hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );//take snapshot of all processes in The system pe32.dwSize = sizeof(PROCESSENTRY32); Process32First(hProcessSnap, &pe32) do//iterate through all processes { if(_wcsicmp(pe32.szExeFile, L"winlogon.exe") == 0)//narrow

Run application on Win7 logon screen [duplicate]

天大地大妈咪最大 提交于 2019-12-03 17:26:20
This question already has answers here : Closed 3 years ago . Updated: Interacting with the user on the windows logon screen (3 answers) I'd like to run an application on the logon screen of Windows 7 from a service. I've been doing long researches on this and trying out different ways already, but unfortunately wasn't fully successful so far. I managed to run the application on the lock screen of a currently logged on user - which at first looked to me as it was what I basically tried to achieve. However, I then realized that there are different logon screens for every user and a general one

why is CreateProcessWithTokenW failing with ERROR_ACCESS_DENIED

寵の児 提交于 2019-12-03 16:07:52
I have a call to CreateProcessWithTokenW that is failing with access denied. Any ideas how to debug this? The call to CreateProcessWithTokenW is here: https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/ProcessUtil.cs For now I'm using a access token for the current process, eventually I'll use a token from another user. For now then I'm using https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/AccessToken.cs to get the access token. If you want to debug, pull down the sourcecode and run build_and_test.ps1. The error stack is: 1) Test Error :

Win32 - Launching a highestAvailable child process as a normal user process

不羁岁月 提交于 2019-12-01 14:29:00
Suppose your Windows user account is in the Admin group, UAC is enabled, and you're running some program A with normal user privileges. A never asks for elevation and never receives it. Now suppose A wants to launch program B, which has highestAvailable in its manifest. If A calls CreateProcess(B), this will fail with error 740 ("elevation required") If A calls ShellExecuteEx(B), Windows will display a UAC box asking to run B elevated. The user can say Yes, in which case B will run elevated, or No, in which case the launch will fail. My question is: is there any way to achieve a third option,

Win32 - Launching a highestAvailable child process as a normal user process

霸气de小男生 提交于 2019-12-01 13:20:01
问题 Suppose your Windows user account is in the Admin group, UAC is enabled, and you're running some program A with normal user privileges. A never asks for elevation and never receives it. Now suppose A wants to launch program B, which has highestAvailable in its manifest. If A calls CreateProcess(B), this will fail with error 740 ("elevation required") If A calls ShellExecuteEx(B), Windows will display a UAC box asking to run B elevated. The user can say Yes, in which case B will run elevated,

Capture standard output from CreateProcessAsUser in C#

半城伤御伤魂 提交于 2019-12-01 01:45:30
问题 I'm currently starting processes within an asp.net website using the pinvoke CreateProcessAsUser api. This works perfectly to impersonate the logged on AD user. Somehow however the result string from the console output is always empty. I can't find what's going wrong. No crashes or anything just no output. public static class Process { static readonly IntPtr INVALID_HANDLE_VALUE = (IntPtr)(-1); static readonly HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); const int STD_INPUT

Creating a process in a non-zero session from a service in windows-2008-server?

感情迁移 提交于 2019-11-29 08:34:15
I was wondering if there is a simple way for a service to create a process in user session? My service is running as a user(administrator) account and not as a LocalSystem acount, therefore i can't use the WTSQueryUserToken function. i have tried calling OpenProcessToken(GetCurrentProcess,TOKEN_ALL_ACCESS,TokenHandle); but when i use this token to run CreateProcessAsUser(TokenHandle,.....) my process is still running in session 0. how can i resolve this issue? I'm using an Ole automation so i don't really care on which session the process will be running on, as long it is not the session 0 -

CreateProcessAsUser error 1314

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 23:47:10
I want create a process under another user. So I use LogonUser and CreateProcessAsUser. But my problem is, that CreatePtocessAsUser always returns the errorcode 1314, which means "A required privilige is not held by the client". So my question is, what I am doing wrong? Or how can i give the priviliges to the handle? (I think the handle should have the privileges, or I am wrong?) Sorry for my english mistakes, but my english knowledge isn't the best :) Plesase help if anyone knows how to correct my application. This a part of my code. STARTUPINFO StartInfo; PROCESS_INFORMATION ProcInfo; TOKEN