I
ivang
Hello, All!
Please help me to marshal following win32 structure:
typedef struct _STARTUPINFOW {
DWORD cb;
LPWSTR lpReserved;
LPWSTR lpDesktop;
LPWSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFOW, *LPSTARTUPINFOW;
----------------
Here is what I have in C#:
[StructLayout(LayoutKind.Sequential)]
public struct STARTUPINFOW
{
ulong cb;
string lpReserved;
string lpDesktop;
string lpTitle;
ulong dwX;
ulong dwY;
ulong dwXSize;
ulong dwYSize;
ulong dwXCountChars;
ulong dwYCountChars;
ulong dwFillAttribute;
ulong dwFlags;
ushort sShowWindow;
ushort cbReserved2;
IntPtr lpReserved2;
IntPtr hStdInput;
IntPtr hStdOutput;
IntPtr hStdError;
}
Is that correct? I'm not sure about marshalling LPWSTR, LPBYTE and HANDLE
type fields.
Thanks.
Please help me to marshal following win32 structure:
typedef struct _STARTUPINFOW {
DWORD cb;
LPWSTR lpReserved;
LPWSTR lpDesktop;
LPWSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFOW, *LPSTARTUPINFOW;
----------------
Here is what I have in C#:
[StructLayout(LayoutKind.Sequential)]
public struct STARTUPINFOW
{
ulong cb;
string lpReserved;
string lpDesktop;
string lpTitle;
ulong dwX;
ulong dwY;
ulong dwXSize;
ulong dwYSize;
ulong dwXCountChars;
ulong dwYCountChars;
ulong dwFillAttribute;
ulong dwFlags;
ushort sShowWindow;
ushort cbReserved2;
IntPtr lpReserved2;
IntPtr hStdInput;
IntPtr hStdOutput;
IntPtr hStdError;
}
Is that correct? I'm not sure about marshalling LPWSTR, LPBYTE and HANDLE
type fields.
Thanks.