[DllImport("kernel32.dll",EntryPoint="GetStartupInfoW")]
static extern void GetStartupInfo(out STARTUPINFO lpStartupInfo);
Declare Sub GetStartupInfo Lib "kernel32.dll" (<Out> ByRef _
lpStartupInfo As STARTUPINFO)
Because .NET is in Unicode, one needs to call the wide character version of this call GetStartupInfoW.
On my W10x64 my vshost.exe died by caling the GetStartupInfoW()-Method.
So i changed it to "GetStartupInfoA" and also changed the 'STARTUPINFO's StructureLayout-Attribute to CharSet.Ansi instead of Unicode.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct STARTUPINFO
{
public uint cb;
public string lpReserved;
public string lpDesktop;
public string lpTitle;
public uint dwX;
public uint dwY;
public uint dwXSize;
public uint dwYSize;
public uint dwXCountChars;
public uint dwYCountChars;
public uint dwFillAttribute;
public uint dwFlags;
public ushort wShowWindow;
public ushort cbReserved2;
public IntPtr lpReserved2;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
}
[DllImport("kernel32.dll", SetLastError = true, EntryPoint = "GetStartupInfoA")]
public static extern void GetStartupInfo(out STARTUPINFO lpStartupInfo);
Do you know one? Please contribute it!