ホーム › System.Threading › QueryThreadpoolStackInformation
QueryThreadpoolStackInformation
関数スレッドプールのスタックサイズ情報を取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL QueryThreadpoolStackInformation(
PTP_POOL ptpp,
TP_POOL_STACK_INFORMATION* ptpsi
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ptpp | PTP_POOL | in |
| ptpsi | TP_POOL_STACK_INFORMATION* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL QueryThreadpoolStackInformation(
PTP_POOL ptpp,
TP_POOL_STACK_INFORMATION* ptpsi
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool QueryThreadpoolStackInformation(
IntPtr ptpp, // PTP_POOL
IntPtr ptpsi // TP_POOL_STACK_INFORMATION* out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function QueryThreadpoolStackInformation(
ptpp As IntPtr, ' PTP_POOL
ptpsi As IntPtr ' TP_POOL_STACK_INFORMATION* out
) As Boolean
End Function' ptpp : PTP_POOL
' ptpsi : TP_POOL_STACK_INFORMATION* out
Declare PtrSafe Function QueryThreadpoolStackInformation Lib "kernel32" ( _
ByVal ptpp As LongPtr, _
ByVal ptpsi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
QueryThreadpoolStackInformation = ctypes.windll.kernel32.QueryThreadpoolStackInformation
QueryThreadpoolStackInformation.restype = wintypes.BOOL
QueryThreadpoolStackInformation.argtypes = [
ctypes.c_ssize_t, # ptpp : PTP_POOL
ctypes.c_void_p, # ptpsi : TP_POOL_STACK_INFORMATION* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
QueryThreadpoolStackInformation = Fiddle::Function.new(
lib['QueryThreadpoolStackInformation'],
[
Fiddle::TYPE_INTPTR_T, # ptpp : PTP_POOL
Fiddle::TYPE_VOIDP, # ptpsi : TP_POOL_STACK_INFORMATION* out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn QueryThreadpoolStackInformation(
ptpp: isize, // PTP_POOL
ptpsi: *mut TP_POOL_STACK_INFORMATION // TP_POOL_STACK_INFORMATION* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool QueryThreadpoolStackInformation(IntPtr ptpp, IntPtr ptpsi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_QueryThreadpoolStackInformation' -Namespace Win32 -PassThru
# $api::QueryThreadpoolStackInformation(ptpp, ptpsi)#uselib "KERNEL32.dll"
#func global QueryThreadpoolStackInformation "QueryThreadpoolStackInformation" sptr, sptr
; QueryThreadpoolStackInformation ptpp, varptr(ptpsi) ; 戻り値は stat
; ptpp : PTP_POOL -> "sptr"
; ptpsi : TP_POOL_STACK_INFORMATION* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global QueryThreadpoolStackInformation "QueryThreadpoolStackInformation" sptr, var ; res = QueryThreadpoolStackInformation(ptpp, ptpsi) ; ptpp : PTP_POOL -> "sptr" ; ptpsi : TP_POOL_STACK_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global QueryThreadpoolStackInformation "QueryThreadpoolStackInformation" sptr, sptr ; res = QueryThreadpoolStackInformation(ptpp, varptr(ptpsi)) ; ptpp : PTP_POOL -> "sptr" ; ptpsi : TP_POOL_STACK_INFORMATION* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL QueryThreadpoolStackInformation(PTP_POOL ptpp, TP_POOL_STACK_INFORMATION* ptpsi) #uselib "KERNEL32.dll" #cfunc global QueryThreadpoolStackInformation "QueryThreadpoolStackInformation" intptr, var ; res = QueryThreadpoolStackInformation(ptpp, ptpsi) ; ptpp : PTP_POOL -> "intptr" ; ptpsi : TP_POOL_STACK_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL QueryThreadpoolStackInformation(PTP_POOL ptpp, TP_POOL_STACK_INFORMATION* ptpsi) #uselib "KERNEL32.dll" #cfunc global QueryThreadpoolStackInformation "QueryThreadpoolStackInformation" intptr, intptr ; res = QueryThreadpoolStackInformation(ptpp, varptr(ptpsi)) ; ptpp : PTP_POOL -> "intptr" ; ptpsi : TP_POOL_STACK_INFORMATION* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procQueryThreadpoolStackInformation = kernel32.NewProc("QueryThreadpoolStackInformation")
)
// ptpp (PTP_POOL), ptpsi (TP_POOL_STACK_INFORMATION* out)
r1, _, err := procQueryThreadpoolStackInformation.Call(
uintptr(ptpp),
uintptr(ptpsi),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction QueryThreadpoolStackInformation(
ptpp: NativeInt; // PTP_POOL
ptpsi: Pointer // TP_POOL_STACK_INFORMATION* out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'QueryThreadpoolStackInformation';result := DllCall("KERNEL32\QueryThreadpoolStackInformation"
, "Ptr", ptpp ; PTP_POOL
, "Ptr", ptpsi ; TP_POOL_STACK_INFORMATION* out
, "Int") ; return: BOOL●QueryThreadpoolStackInformation(ptpp, ptpsi) = DLL("KERNEL32.dll", "bool QueryThreadpoolStackInformation(int, void*)")
# 呼び出し: QueryThreadpoolStackInformation(ptpp, ptpsi)
# ptpp : PTP_POOL -> "int"
# ptpsi : TP_POOL_STACK_INFORMATION* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。