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

STARTUPINFOEXA

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

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

フィールド

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

各言語での定義

#include <windows.h>

// STARTUPINFOA  (x64 104 / x86 68 バイト)
typedef struct STARTUPINFOA {
    DWORD cb;
    LPSTR lpReserved;
    LPSTR lpDesktop;
    LPSTR 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;
} STARTUPINFOA;

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

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STARTUPINFOA
    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 STARTUPINFOEXA
    Public StartupInfo As STARTUPINFOA
    Public lpAttributeList As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class STARTUPINFOA(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 STARTUPINFOEXA(ctypes.Structure):
    _fields_ = [
        ("StartupInfo", STARTUPINFOA),
        ("lpAttributeList", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct STARTUPINFOA {
    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 STARTUPINFOEXA {
    pub StartupInfo: STARTUPINFOA,
    pub lpAttributeList: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type STARTUPINFOA 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 STARTUPINFOEXA struct {
	StartupInfo STARTUPINFOA
	lpAttributeList uintptr
}
type
  STARTUPINFOA = 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;

  STARTUPINFOEXA = record
    StartupInfo: STARTUPINFOA;
    lpAttributeList: Pointer;
  end;
const STARTUPINFOA = 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 STARTUPINFOEXA = extern struct {
    StartupInfo: STARTUPINFOA,
    lpAttributeList: ?*anyopaque,
};
type
  STARTUPINFOA {.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

  STARTUPINFOEXA {.bycopy.} = object
    StartupInfo: STARTUPINFOA
    lpAttributeList: pointer
struct STARTUPINFOA
{
    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 STARTUPINFOEXA
{
    STARTUPINFOA 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 レイアウト)
; STARTUPINFOEXA サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; StartupInfo : STARTUPINFOA (+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 レイアウト)
; STARTUPINFOEXA サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; StartupInfo : STARTUPINFOA (+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 STARTUPINFOA
    #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 STARTUPINFOEXA
    #field STARTUPINFOA StartupInfo
    #field intptr lpAttributeList
#endstruct

stdim st, STARTUPINFOEXA        ; NSTRUCT 変数を確保