I have a service that run the following code.
Every time that CreateProcessAsUser is hit, the memory increase in 4K (I can see it in the Task Manager).
Where am I wrong?
PWTS_SESSION_INFO pSessionInfo = 0;
DWORD dwCount = 0;
int dwSessionId = 0;
WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pSessionInfo, &dwCount);
for(DWORD i = 0; i < dwCount; ++i)
WTS_SESSION_INFO si = pSessionInfo[i];
if (WTSActive == si.State)
dwSessionId = si.SessionId;
BOOL bRet = WTSQueryUserToken(dwSessionId, ¤tToken);
if (bRet == false)
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
if (CreateProcessAsUser(currentToken, "MY_EXE.exe", "MY_ARGS_STR", NULL, NULL, false, 0, NULL, NULL, &si, &pi))
if (pi.hProcess != NULL)
if (pi.hThread != NULL)
Based on your description, your issue is about CreateProcessAsUser API, so I’d like to move this thread to Microsoft SDK for better support.
Thanks for your understanding.
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?