Anadrol
Joined: 18 Jun 2010 Posts: 1
|
Posted: Fri Jun 18, 2010 1:09 am Post subject: Error in your CreateProcess page |
|
|
Hello,
There are errors in this page:
http://www.pinvoke.net/default.aspx/kernel32/CreateProcess.html
It should be:
[DllImport("kernel32.dll")]
static extern bool CreateProcess(
string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
[In] ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
And not:
[DllImport("kernel32.dll")]
static extern bool CreateProcess(
string lpApplicationName,
string lpCommandLine,
ref SECURITY_ATTRIBUTES lpProcessAttributes,
ref SECURITY_ATTRIBUTES lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
[In] ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
Errors in lines 5 and 6.
It should be:
//Open Notepad
retValue = CreateProcess(
Application,
CommandLine,
IntPtr.Zero,
IntPtr.Zero,
false,
NORMAL_PRIORITY_CLASS,
IntPtr.Zero,
null,
ref sInfo,
out pInfo);
And not :
//Open Notepad
retValue = CreateProcess(
Application,
CommandLine,
ref pSec,
ref tSec,
false,
NORMAL_PRIORITY_CLASS,
IntPtr.Zero,
null,
ref sInfo,
out pInfo);
Error in lines 5 and 6 as well.
Without these changes the target application doesn't launch.
Hope that you will correct the page.
Also in the SECURITY_ATTRIBUTES
It may be better to use:
public IntPtr lpSecurityDescriptor;
instead of:
public unsafe byte* lpSecurityDescriptor;
This way you don't have to compile with the Unsafe option.
More info here:
http://blogs.msdn.com/b/thottams/archive/2006/08/11/696013.aspx |
|