Kind of embarrassed to ask, but I've been trying to make my code 64 bit compatible and have been struggling with incorrect api declaration.
(coding in C#.net , framework 4.0)
edit* technically my code works(for my pc at least). I just think* I have a some errors in my api declarations and I'm wondering if those declarations will cause issues when run on other versions of windows.
Here is an example..
OpenProcess --> I google it.
pInvoke.com says
Code:
IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId)
while microsoft says
Code:
HANDLE WINAPI OpenProcess(
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwProcessId
);
I know it seems like basic 32vs64etc type thing, but it's still giving me grief 
Anyway, m$ says dwDesiredAccess is DWORD --> DWORD is unsigned 32 bit
(so really the API declaration should use uint ??)
edit*( ive seen both - hence my confusion)
( I've had "C# 3.0 in a nutshell" for months now..finally starting at page one and reading. )
Anyway, here is the question:
Which one is correct?
(as a matter of practicality, will a process.id ever be over int32.maxvalue ?? so api declaration doesn't matter can be either?)
Code:
[DllImport("kernel32.dll")]
private static extern IntPtr OpenProcess(uint dwDesiredAccess,[MarshalAs(UnmanagedType.Bool)] bool bInheritHandle,uint dwProcessId );
or
Code:
[DllImport("kernel32.dll")]
private static extern IntPtr OpenProcess(int dwDesiredAccess,[MarshalAs(UnmanagedType.Bool)] bool bInheritHandle,int dwProcessId );
edit: title misleading. I'm not trying to use sizeof (or marshal.sizeof) at all. Just not sure if declaring the parameters unsigned vs signed matters.
-Thanks.