Red Gate forums :: View topic - Error in your CreateProcess page
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
PInvoke.Net
PInvoke.Net forum

Error in your CreateProcess page

Search in PInvoke.Net forum
Post new topic   Reply to topic
Jump to:  
Author Message
Anadrol



Joined: 18 Jun 2010
Posts: 1

PostPosted: Fri Jun 18, 2010 1:09 am    Post subject: Error in your CreateProcess page Reply with quote

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
Back to top
View user's profile Send private message
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Fri Jun 18, 2010 5:01 pm    Post subject: Reply with quote

Thank you very much for the corrections.

PInvoke.Net is a wiki site so you are free to correct and add any information on the site. On each of the pages there is a "Edit this page" link (on the right hand menu), you don't need to register or anything like that to do the update.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group