Win32 API 日本語リファレンス
ホームSystem.Threading › STARTUPINFOEXW

STARTUPINFOEXW

構造体
サイズx64: 112 バイト / x86: 72 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
StartupInfoSTARTUPINFOW104/68+0+0基本的な起動情報を保持するSTARTUPINFOW構造体。
lpAttributeListLPPROC_THREAD_ATTRIBUTE_LIST8/4+104+68プロセス/スレッド属性リストへのポインタ。拡張属性指定に使用する。

各言語での定義

#include <windows.h>

// STARTUPINFOW  (x64 104 / x86 68 バイト)
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;
    STARTUPINFOW_FLAGS dwFlags;
    WORD wShowWindow;
    WORD cbReserved2;
    BYTE* lpReserved2;
    HANDLE hStdInput;
    HANDLE hStdOutput;
    HANDLE hStdError;
} STARTUPINFOW;

// STARTUPINFOEXW  (x64 112 / x86 72 バイト)
typedef struct STARTUPINFOEXW {
    STARTUPINFOW StartupInfo;
    LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList;
} STARTUPINFOEXW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public 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, CharSet = CharSet.Unicode)]
public struct STARTUPINFOEXW
{
    public STARTUPINFOW StartupInfo;
    public IntPtr lpAttributeList;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STARTUPINFOW
    Public cb As UInteger
    Public lpReserved As IntPtr
    Public lpDesktop As IntPtr
    Public lpTitle As IntPtr
    Public dwX As UInteger
    Public dwY As UInteger
    Public dwXSize As UInteger
    Public dwYSize As UInteger
    Public dwXCountChars As UInteger
    Public dwYCountChars As UInteger
    Public dwFillAttribute As UInteger
    Public dwFlags As UInteger
    Public wShowWindow As UShort
    Public cbReserved2 As UShort
    Public lpReserved2 As IntPtr
    Public hStdInput As IntPtr
    Public hStdOutput As IntPtr
    Public hStdError As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STARTUPINFOEXW
    Public StartupInfo As STARTUPINFOW
    Public lpAttributeList As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class STARTUPINFOW(ctypes.Structure):
    _fields_ = [
        ("cb", wintypes.DWORD),
        ("lpReserved", ctypes.c_void_p),
        ("lpDesktop", ctypes.c_void_p),
        ("lpTitle", ctypes.c_void_p),
        ("dwX", wintypes.DWORD),
        ("dwY", wintypes.DWORD),
        ("dwXSize", wintypes.DWORD),
        ("dwYSize", wintypes.DWORD),
        ("dwXCountChars", wintypes.DWORD),
        ("dwYCountChars", wintypes.DWORD),
        ("dwFillAttribute", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("wShowWindow", ctypes.c_ushort),
        ("cbReserved2", ctypes.c_ushort),
        ("lpReserved2", ctypes.c_void_p),
        ("hStdInput", ctypes.c_void_p),
        ("hStdOutput", ctypes.c_void_p),
        ("hStdError", ctypes.c_void_p),
    ]

class STARTUPINFOEXW(ctypes.Structure):
    _fields_ = [
        ("StartupInfo", STARTUPINFOW),
        ("lpAttributeList", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct STARTUPINFOW {
    pub cb: u32,
    pub lpReserved: *mut core::ffi::c_void,
    pub lpDesktop: *mut core::ffi::c_void,
    pub lpTitle: *mut core::ffi::c_void,
    pub dwX: u32,
    pub dwY: u32,
    pub dwXSize: u32,
    pub dwYSize: u32,
    pub dwXCountChars: u32,
    pub dwYCountChars: u32,
    pub dwFillAttribute: u32,
    pub dwFlags: u32,
    pub wShowWindow: u16,
    pub cbReserved2: u16,
    pub lpReserved2: *mut core::ffi::c_void,
    pub hStdInput: *mut core::ffi::c_void,
    pub hStdOutput: *mut core::ffi::c_void,
    pub hStdError: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct STARTUPINFOEXW {
    pub StartupInfo: STARTUPINFOW,
    pub lpAttributeList: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type STARTUPINFOW struct {
	cb uint32
	lpReserved uintptr
	lpDesktop uintptr
	lpTitle uintptr
	dwX uint32
	dwY uint32
	dwXSize uint32
	dwYSize uint32
	dwXCountChars uint32
	dwYCountChars uint32
	dwFillAttribute uint32
	dwFlags uint32
	wShowWindow uint16
	cbReserved2 uint16
	lpReserved2 uintptr
	hStdInput uintptr
	hStdOutput uintptr
	hStdError uintptr
}

type STARTUPINFOEXW struct {
	StartupInfo STARTUPINFOW
	lpAttributeList uintptr
}
type
  STARTUPINFOW = record
    cb: DWORD;
    lpReserved: Pointer;
    lpDesktop: Pointer;
    lpTitle: Pointer;
    dwX: DWORD;
    dwY: DWORD;
    dwXSize: DWORD;
    dwYSize: DWORD;
    dwXCountChars: DWORD;
    dwYCountChars: DWORD;
    dwFillAttribute: DWORD;
    dwFlags: DWORD;
    wShowWindow: Word;
    cbReserved2: Word;
    lpReserved2: Pointer;
    hStdInput: Pointer;
    hStdOutput: Pointer;
    hStdError: Pointer;
  end;

  STARTUPINFOEXW = record
    StartupInfo: STARTUPINFOW;
    lpAttributeList: Pointer;
  end;
const STARTUPINFOW = extern struct {
    cb: u32,
    lpReserved: ?*anyopaque,
    lpDesktop: ?*anyopaque,
    lpTitle: ?*anyopaque,
    dwX: u32,
    dwY: u32,
    dwXSize: u32,
    dwYSize: u32,
    dwXCountChars: u32,
    dwYCountChars: u32,
    dwFillAttribute: u32,
    dwFlags: u32,
    wShowWindow: u16,
    cbReserved2: u16,
    lpReserved2: ?*anyopaque,
    hStdInput: ?*anyopaque,
    hStdOutput: ?*anyopaque,
    hStdError: ?*anyopaque,
};

const STARTUPINFOEXW = extern struct {
    StartupInfo: STARTUPINFOW,
    lpAttributeList: ?*anyopaque,
};
type
  STARTUPINFOW {.bycopy.} = object
    cb: uint32
    lpReserved: pointer
    lpDesktop: pointer
    lpTitle: pointer
    dwX: uint32
    dwY: uint32
    dwXSize: uint32
    dwYSize: uint32
    dwXCountChars: uint32
    dwYCountChars: uint32
    dwFillAttribute: uint32
    dwFlags: uint32
    wShowWindow: uint16
    cbReserved2: uint16
    lpReserved2: pointer
    hStdInput: pointer
    hStdOutput: pointer
    hStdError: pointer

  STARTUPINFOEXW {.bycopy.} = object
    StartupInfo: STARTUPINFOW
    lpAttributeList: pointer
struct STARTUPINFOW
{
    uint cb;
    void* lpReserved;
    void* lpDesktop;
    void* lpTitle;
    uint dwX;
    uint dwY;
    uint dwXSize;
    uint dwYSize;
    uint dwXCountChars;
    uint dwYCountChars;
    uint dwFillAttribute;
    uint dwFlags;
    ushort wShowWindow;
    ushort cbReserved2;
    void* lpReserved2;
    void* hStdInput;
    void* hStdOutput;
    void* hStdError;
}

struct STARTUPINFOEXW
{
    STARTUPINFOW StartupInfo;
    void* lpAttributeList;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STARTUPINFOEXW サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; StartupInfo : STARTUPINFOW (+0, 68byte)  varptr(st)+0 を基点に操作(68byte:入れ子/配列)
; lpAttributeList : LPPROC_THREAD_ATTRIBUTE_LIST (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STARTUPINFOEXW サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; StartupInfo : STARTUPINFOW (+0, 104byte)  varptr(st)+0 を基点に操作(104byte:入れ子/配列)
; lpAttributeList : LPPROC_THREAD_ATTRIBUTE_LIST (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STARTUPINFOW
    #field int cb
    #field intptr lpReserved
    #field intptr lpDesktop
    #field intptr lpTitle
    #field int dwX
    #field int dwY
    #field int dwXSize
    #field int dwYSize
    #field int dwXCountChars
    #field int dwYCountChars
    #field int dwFillAttribute
    #field int dwFlags
    #field short wShowWindow
    #field short cbReserved2
    #field intptr lpReserved2
    #field intptr hStdInput
    #field intptr hStdOutput
    #field intptr hStdError
#endstruct

#defstruct global STARTUPINFOEXW
    #field STARTUPINFOW StartupInfo
    #field intptr lpAttributeList
#endstruct

stdim st, STARTUPINFOEXW        ; NSTRUCT 変数を確保