CreateProcess - No Privileges?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,<br/><br/>I have a situation where my application (C#.NET) is called by an old VC++ program using CreateProcess and my application crashes with a SecurityException. It does this as soon as I try to perform any FileIO or API calls. I am not a C++ developer but I have tried to look into this myself to see if I can figure out whats wrong but I cant. Can anyone please explain what is going wrong? I need to be able to execute my C# application with the same privileges as the VC++ program.<br/><br/>
<pre lang=x-cpp> startInfo.cb = sizeof(STARTUPINFO);
startInfo.dwFlags = STARTF_USESHOWWINDOW;
startInfo.wShowWindow = SW_SHOWMINIMIZED;
// startInfo.wShowWindow = SW_SHOWNORMAL;
SAT1.nLength = SAT2.nLength = sizeof(SECURITY_ATTRIBUTES);
SAT1.lpSecurityDescriptor = SAT2.lpSecurityDescriptor = NULL;
SAT1.bInheritHandle = SAT2.bInheritHandle = TRUE;



bCreated = CreateProcess(NULL,
(LPTSTR)((LPCTSTR)sParameters),
&SAT1, // Process Security Attributes
&SAT2, // Thread Security Attributes
TRUE, // Inheritance Flag
NORMAL_PRIORITY_CLASS, // Creation Flags
NULL, // Environment
NULL, // Current Directory was (LPCTSTR)strCurDir
&startInfo,
&prInfo);<br/>[/code]
From this code I can see that the new process is supposed to be recieving the default security descriptor from the calling application which, as far as I am aware, should mean that it has permission to do anything it likes (or more specifically anything that the calling application can do).<br/><br/>Confused!

View the full article
 
Back
Top