Win32 API 日本語リファレンス
ホームSystem.Diagnostics.ProcessSnapshotting › PssQuerySnapshot

PssQuerySnapshot

関数
プロセススナップショットから指定種別の情報を照会する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

DWORD PssQuerySnapshot(
    HPSS SnapshotHandle,
    PSS_QUERY_INFORMATION_CLASS InformationClass,
    void* Buffer,
    DWORD BufferLength
);

パラメーター

名前方向
SnapshotHandleHPSSin
InformationClassPSS_QUERY_INFORMATION_CLASSin
Buffervoid*out
BufferLengthDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

DWORD PssQuerySnapshot(
    HPSS SnapshotHandle,
    PSS_QUERY_INFORMATION_CLASS InformationClass,
    void* Buffer,
    DWORD BufferLength
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint PssQuerySnapshot(
    IntPtr SnapshotHandle,   // HPSS
    int InformationClass,   // PSS_QUERY_INFORMATION_CLASS
    IntPtr Buffer,   // void* out
    uint BufferLength   // DWORD
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function PssQuerySnapshot(
    SnapshotHandle As IntPtr,   ' HPSS
    InformationClass As Integer,   ' PSS_QUERY_INFORMATION_CLASS
    Buffer As IntPtr,   ' void* out
    BufferLength As UInteger   ' DWORD
) As UInteger
End Function
' SnapshotHandle : HPSS
' InformationClass : PSS_QUERY_INFORMATION_CLASS
' Buffer : void* out
' BufferLength : DWORD
Declare PtrSafe Function PssQuerySnapshot Lib "kernel32" ( _
    ByVal SnapshotHandle As LongPtr, _
    ByVal InformationClass As Long, _
    ByVal Buffer As LongPtr, _
    ByVal BufferLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PssQuerySnapshot = ctypes.windll.kernel32.PssQuerySnapshot
PssQuerySnapshot.restype = wintypes.DWORD
PssQuerySnapshot.argtypes = [
    wintypes.HANDLE,  # SnapshotHandle : HPSS
    ctypes.c_int,  # InformationClass : PSS_QUERY_INFORMATION_CLASS
    ctypes.POINTER(None),  # Buffer : void* out
    wintypes.DWORD,  # BufferLength : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
PssQuerySnapshot = Fiddle::Function.new(
  lib['PssQuerySnapshot'],
  [
    Fiddle::TYPE_VOIDP,  # SnapshotHandle : HPSS
    Fiddle::TYPE_INT,  # InformationClass : PSS_QUERY_INFORMATION_CLASS
    Fiddle::TYPE_VOIDP,  # Buffer : void* out
    -Fiddle::TYPE_INT,  # BufferLength : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn PssQuerySnapshot(
        SnapshotHandle: *mut core::ffi::c_void,  // HPSS
        InformationClass: i32,  // PSS_QUERY_INFORMATION_CLASS
        Buffer: *mut (),  // void* out
        BufferLength: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint PssQuerySnapshot(IntPtr SnapshotHandle, int InformationClass, IntPtr Buffer, uint BufferLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_PssQuerySnapshot' -Namespace Win32 -PassThru
# $api::PssQuerySnapshot(SnapshotHandle, InformationClass, Buffer, BufferLength)
#uselib "KERNEL32.dll"
#func global PssQuerySnapshot "PssQuerySnapshot" sptr, sptr, sptr, sptr
; PssQuerySnapshot SnapshotHandle, InformationClass, Buffer, BufferLength   ; 戻り値は stat
; SnapshotHandle : HPSS -> "sptr"
; InformationClass : PSS_QUERY_INFORMATION_CLASS -> "sptr"
; Buffer : void* out -> "sptr"
; BufferLength : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global PssQuerySnapshot "PssQuerySnapshot" sptr, int, sptr, int
; res = PssQuerySnapshot(SnapshotHandle, InformationClass, Buffer, BufferLength)
; SnapshotHandle : HPSS -> "sptr"
; InformationClass : PSS_QUERY_INFORMATION_CLASS -> "int"
; Buffer : void* out -> "sptr"
; BufferLength : DWORD -> "int"
; DWORD PssQuerySnapshot(HPSS SnapshotHandle, PSS_QUERY_INFORMATION_CLASS InformationClass, void* Buffer, DWORD BufferLength)
#uselib "KERNEL32.dll"
#cfunc global PssQuerySnapshot "PssQuerySnapshot" intptr, int, intptr, int
; res = PssQuerySnapshot(SnapshotHandle, InformationClass, Buffer, BufferLength)
; SnapshotHandle : HPSS -> "intptr"
; InformationClass : PSS_QUERY_INFORMATION_CLASS -> "int"
; Buffer : void* out -> "intptr"
; BufferLength : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procPssQuerySnapshot = kernel32.NewProc("PssQuerySnapshot")
)

// SnapshotHandle (HPSS), InformationClass (PSS_QUERY_INFORMATION_CLASS), Buffer (void* out), BufferLength (DWORD)
r1, _, err := procPssQuerySnapshot.Call(
	uintptr(SnapshotHandle),
	uintptr(InformationClass),
	uintptr(Buffer),
	uintptr(BufferLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PssQuerySnapshot(
  SnapshotHandle: THandle;   // HPSS
  InformationClass: Integer;   // PSS_QUERY_INFORMATION_CLASS
  Buffer: Pointer;   // void* out
  BufferLength: DWORD   // DWORD
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'PssQuerySnapshot';
result := DllCall("KERNEL32\PssQuerySnapshot"
    , "Ptr", SnapshotHandle   ; HPSS
    , "Int", InformationClass   ; PSS_QUERY_INFORMATION_CLASS
    , "Ptr", Buffer   ; void* out
    , "UInt", BufferLength   ; DWORD
    , "UInt")   ; return: DWORD
●PssQuerySnapshot(SnapshotHandle, InformationClass, Buffer, BufferLength) = DLL("KERNEL32.dll", "dword PssQuerySnapshot(void*, int, void*, dword)")
# 呼び出し: PssQuerySnapshot(SnapshotHandle, InformationClass, Buffer, BufferLength)
# SnapshotHandle : HPSS -> "void*"
# InformationClass : PSS_QUERY_INFORMATION_CLASS -> "int"
# Buffer : void* out -> "void*"
# BufferLength : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。