Win32 API 日本語リファレンス
ホームStorage.Compression › QueryDecompressorInformation

QueryDecompressorInformation

関数
展開器の指定種別のパラメータを照会する。
DLLCabinet.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

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

BOOL QueryDecompressorInformation(
    DECOMPRESSOR_HANDLE DecompressorHandle,
    COMPRESS_INFORMATION_CLASS CompressInformationClass,
    void* CompressInformation,
    UINT_PTR CompressInformationSize
);

パラメーター

名前方向
DecompressorHandleDECOMPRESSOR_HANDLEin
CompressInformationClassCOMPRESS_INFORMATION_CLASSin
CompressInformationvoid*out
CompressInformationSizeUINT_PTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL QueryDecompressorInformation(
    DECOMPRESSOR_HANDLE DecompressorHandle,
    COMPRESS_INFORMATION_CLASS CompressInformationClass,
    void* CompressInformation,
    UINT_PTR CompressInformationSize
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", SetLastError = true, ExactSpelling = true)]
static extern bool QueryDecompressorInformation(
    IntPtr DecompressorHandle,   // DECOMPRESSOR_HANDLE
    int CompressInformationClass,   // COMPRESS_INFORMATION_CLASS
    IntPtr CompressInformation,   // void* out
    UIntPtr CompressInformationSize   // UINT_PTR
);
<DllImport("Cabinet.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function QueryDecompressorInformation(
    DecompressorHandle As IntPtr,   ' DECOMPRESSOR_HANDLE
    CompressInformationClass As Integer,   ' COMPRESS_INFORMATION_CLASS
    CompressInformation As IntPtr,   ' void* out
    CompressInformationSize As UIntPtr   ' UINT_PTR
) As Boolean
End Function
' DecompressorHandle : DECOMPRESSOR_HANDLE
' CompressInformationClass : COMPRESS_INFORMATION_CLASS
' CompressInformation : void* out
' CompressInformationSize : UINT_PTR
Declare PtrSafe Function QueryDecompressorInformation Lib "cabinet" ( _
    ByVal DecompressorHandle As LongPtr, _
    ByVal CompressInformationClass As Long, _
    ByVal CompressInformation As LongPtr, _
    ByVal CompressInformationSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

QueryDecompressorInformation = ctypes.windll.cabinet.QueryDecompressorInformation
QueryDecompressorInformation.restype = wintypes.BOOL
QueryDecompressorInformation.argtypes = [
    wintypes.HANDLE,  # DecompressorHandle : DECOMPRESSOR_HANDLE
    ctypes.c_int,  # CompressInformationClass : COMPRESS_INFORMATION_CLASS
    ctypes.POINTER(None),  # CompressInformation : void* out
    ctypes.c_size_t,  # CompressInformationSize : UINT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Cabinet.dll')
QueryDecompressorInformation = Fiddle::Function.new(
  lib['QueryDecompressorInformation'],
  [
    Fiddle::TYPE_VOIDP,  # DecompressorHandle : DECOMPRESSOR_HANDLE
    Fiddle::TYPE_INT,  # CompressInformationClass : COMPRESS_INFORMATION_CLASS
    Fiddle::TYPE_VOIDP,  # CompressInformation : void* out
    Fiddle::TYPE_UINTPTR_T,  # CompressInformationSize : UINT_PTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "cabinet")]
extern "system" {
    fn QueryDecompressorInformation(
        DecompressorHandle: *mut core::ffi::c_void,  // DECOMPRESSOR_HANDLE
        CompressInformationClass: i32,  // COMPRESS_INFORMATION_CLASS
        CompressInformation: *mut (),  // void* out
        CompressInformationSize: usize  // UINT_PTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Cabinet.dll", SetLastError = true)]
public static extern bool QueryDecompressorInformation(IntPtr DecompressorHandle, int CompressInformationClass, IntPtr CompressInformation, UIntPtr CompressInformationSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Cabinet_QueryDecompressorInformation' -Namespace Win32 -PassThru
# $api::QueryDecompressorInformation(DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize)
#uselib "Cabinet.dll"
#func global QueryDecompressorInformation "QueryDecompressorInformation" sptr, sptr, sptr, sptr
; QueryDecompressorInformation DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize   ; 戻り値は stat
; DecompressorHandle : DECOMPRESSOR_HANDLE -> "sptr"
; CompressInformationClass : COMPRESS_INFORMATION_CLASS -> "sptr"
; CompressInformation : void* out -> "sptr"
; CompressInformationSize : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Cabinet.dll"
#cfunc global QueryDecompressorInformation "QueryDecompressorInformation" sptr, int, sptr, sptr
; res = QueryDecompressorInformation(DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize)
; DecompressorHandle : DECOMPRESSOR_HANDLE -> "sptr"
; CompressInformationClass : COMPRESS_INFORMATION_CLASS -> "int"
; CompressInformation : void* out -> "sptr"
; CompressInformationSize : UINT_PTR -> "sptr"
; BOOL QueryDecompressorInformation(DECOMPRESSOR_HANDLE DecompressorHandle, COMPRESS_INFORMATION_CLASS CompressInformationClass, void* CompressInformation, UINT_PTR CompressInformationSize)
#uselib "Cabinet.dll"
#cfunc global QueryDecompressorInformation "QueryDecompressorInformation" intptr, int, intptr, intptr
; res = QueryDecompressorInformation(DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize)
; DecompressorHandle : DECOMPRESSOR_HANDLE -> "intptr"
; CompressInformationClass : COMPRESS_INFORMATION_CLASS -> "int"
; CompressInformation : void* out -> "intptr"
; CompressInformationSize : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cabinet = windows.NewLazySystemDLL("Cabinet.dll")
	procQueryDecompressorInformation = cabinet.NewProc("QueryDecompressorInformation")
)

// DecompressorHandle (DECOMPRESSOR_HANDLE), CompressInformationClass (COMPRESS_INFORMATION_CLASS), CompressInformation (void* out), CompressInformationSize (UINT_PTR)
r1, _, err := procQueryDecompressorInformation.Call(
	uintptr(DecompressorHandle),
	uintptr(CompressInformationClass),
	uintptr(CompressInformation),
	uintptr(CompressInformationSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function QueryDecompressorInformation(
  DecompressorHandle: THandle;   // DECOMPRESSOR_HANDLE
  CompressInformationClass: Integer;   // COMPRESS_INFORMATION_CLASS
  CompressInformation: Pointer;   // void* out
  CompressInformationSize: NativeUInt   // UINT_PTR
): BOOL; stdcall;
  external 'Cabinet.dll' name 'QueryDecompressorInformation';
result := DllCall("Cabinet\QueryDecompressorInformation"
    , "Ptr", DecompressorHandle   ; DECOMPRESSOR_HANDLE
    , "Int", CompressInformationClass   ; COMPRESS_INFORMATION_CLASS
    , "Ptr", CompressInformation   ; void* out
    , "UPtr", CompressInformationSize   ; UINT_PTR
    , "Int")   ; return: BOOL
●QueryDecompressorInformation(DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize) = DLL("Cabinet.dll", "bool QueryDecompressorInformation(void*, int, void*, int)")
# 呼び出し: QueryDecompressorInformation(DecompressorHandle, CompressInformationClass, CompressInformation, CompressInformationSize)
# DecompressorHandle : DECOMPRESSOR_HANDLE -> "void*"
# CompressInformationClass : COMPRESS_INFORMATION_CLASS -> "int"
# CompressInformation : void* out -> "void*"
# CompressInformationSize : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。