This commit is contained in:
Mino 2020-04-18 18:00:16 +09:00
parent 207c0bfb62
commit 52daf6ada0
4 changed files with 120 additions and 19 deletions

View file

@ -39,7 +39,18 @@ namespace Dalamud.Bootstrap.OS.Windows.Raw
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CreateProcessW(void* lpApplicationName, void* lpCommandLine, SECURITY_ATTRIBUTES* lpProcessAttributes, SECURITY_ATTRIBUTES* lpThreadAttributes, uint bInheritHandles, uint dwCreationFlags, void* lpEnvironment, void* lpCurrentDirectory, void* lpStartupInfo, void* lpProcessInformation);
public static extern bool CreateProcessW(
[MarshalAs(UnmanagedType.LPWStr)] string lpApplicationName,
[MarshalAs(UnmanagedType.LPWStr)] StringBuilder? lpCommandLine,
SECURITY_ATTRIBUTES* lpProcessAttributes,
SECURITY_ATTRIBUTES* lpThreadAttributes,
[MarshalAs(UnmanagedType.Bool)] bool bInheritHandles,
uint dwCreationFlags,
void* lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)] string lpCurrentDirectory,
STARTUPINFOW* lpStartupInfo,
PROCESS_INFORMATION* lpProcessInformation
);
[DllImport(Name, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]

View file

@ -115,8 +115,7 @@ namespace Dalamud.Bootstrap.OS.Windows.Raw
public SECURITY_DESCRIPTOR* SecurityDescriptor;
[MarshalAs(UnmanagedType.Bool)]
public bool InheritHandle;
public uint InheritHandle;
}
[StructLayout(LayoutKind.Sequential)]
@ -176,4 +175,36 @@ namespace Dalamud.Bootstrap.OS.Windows.Raw
public ushort AceCount;
public ushort Sbz2;
}
[StructLayout(LayoutKind.Sequential)]
internal struct STARTUPINFOW
{
public uint cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr 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;
}
[StructLayout(LayoutKind.Sequential)]
internal struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public uint dwProcessId;
public uint dwThreadId;
}
}