QISearch
関数テーブルに基づきQueryInterfaceの問い合わせを処理する。
シグネチャ
// SHLWAPI.dll
#include <windows.h>
HRESULT QISearch(
void* that,
QITAB* pqit,
const GUID* riid,
void** ppv
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| that | void* | inout |
| pqit | QITAB* | in |
| riid | GUID* | in |
| ppv | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHLWAPI.dll
#include <windows.h>
HRESULT QISearch(
void* that,
QITAB* pqit,
const GUID* riid,
void** ppv
);[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern int QISearch(
IntPtr that, // void* in/out
IntPtr pqit, // QITAB*
ref Guid riid, // GUID*
IntPtr ppv // void** out
);<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function QISearch(
that As IntPtr, ' void* in/out
pqit As IntPtr, ' QITAB*
ByRef riid As Guid, ' GUID*
ppv As IntPtr ' void** out
) As Integer
End Function' that : void* in/out
' pqit : QITAB*
' riid : GUID*
' ppv : void** out
Declare PtrSafe Function QISearch Lib "shlwapi" ( _
ByVal that As LongPtr, _
ByVal pqit As LongPtr, _
ByVal riid As LongPtr, _
ByVal ppv As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
QISearch = ctypes.windll.shlwapi.QISearch
QISearch.restype = ctypes.c_int
QISearch.argtypes = [
ctypes.POINTER(None), # that : void* in/out
ctypes.c_void_p, # pqit : QITAB*
ctypes.c_void_p, # riid : GUID*
ctypes.c_void_p, # ppv : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
QISearch = Fiddle::Function.new(
lib['QISearch'],
[
Fiddle::TYPE_VOIDP, # that : void* in/out
Fiddle::TYPE_VOIDP, # pqit : QITAB*
Fiddle::TYPE_VOIDP, # riid : GUID*
Fiddle::TYPE_VOIDP, # ppv : void** out
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn QISearch(
that: *mut (), // void* in/out
pqit: *mut QITAB, // QITAB*
riid: *const GUID, // GUID*
ppv: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll")]
public static extern int QISearch(IntPtr that, IntPtr pqit, ref Guid riid, IntPtr ppv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_QISearch' -Namespace Win32 -PassThru
# $api::QISearch(that, pqit, riid, ppv)#uselib "SHLWAPI.dll"
#func global QISearch "QISearch" sptr, sptr, sptr, sptr
; QISearch that, varptr(pqit), varptr(riid), ppv ; 戻り値は stat
; that : void* in/out -> "sptr"
; pqit : QITAB* -> "sptr"
; riid : GUID* -> "sptr"
; ppv : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHLWAPI.dll" #cfunc global QISearch "QISearch" sptr, var, var, sptr ; res = QISearch(that, pqit, riid, ppv) ; that : void* in/out -> "sptr" ; pqit : QITAB* -> "var" ; riid : GUID* -> "var" ; ppv : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHLWAPI.dll" #cfunc global QISearch "QISearch" sptr, sptr, sptr, sptr ; res = QISearch(that, varptr(pqit), varptr(riid), ppv) ; that : void* in/out -> "sptr" ; pqit : QITAB* -> "sptr" ; riid : GUID* -> "sptr" ; ppv : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT QISearch(void* that, QITAB* pqit, GUID* riid, void** ppv) #uselib "SHLWAPI.dll" #cfunc global QISearch "QISearch" intptr, var, var, intptr ; res = QISearch(that, pqit, riid, ppv) ; that : void* in/out -> "intptr" ; pqit : QITAB* -> "var" ; riid : GUID* -> "var" ; ppv : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT QISearch(void* that, QITAB* pqit, GUID* riid, void** ppv) #uselib "SHLWAPI.dll" #cfunc global QISearch "QISearch" intptr, intptr, intptr, intptr ; res = QISearch(that, varptr(pqit), varptr(riid), ppv) ; that : void* in/out -> "intptr" ; pqit : QITAB* -> "intptr" ; riid : GUID* -> "intptr" ; ppv : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procQISearch = shlwapi.NewProc("QISearch")
)
// that (void* in/out), pqit (QITAB*), riid (GUID*), ppv (void** out)
r1, _, err := procQISearch.Call(
uintptr(that),
uintptr(pqit),
uintptr(riid),
uintptr(ppv),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction QISearch(
that: Pointer; // void* in/out
pqit: Pointer; // QITAB*
riid: PGUID; // GUID*
ppv: Pointer // void** out
): Integer; stdcall;
external 'SHLWAPI.dll' name 'QISearch';result := DllCall("SHLWAPI\QISearch"
, "Ptr", that ; void* in/out
, "Ptr", pqit ; QITAB*
, "Ptr", riid ; GUID*
, "Ptr", ppv ; void** out
, "Int") ; return: HRESULT●QISearch(that, pqit, riid, ppv) = DLL("SHLWAPI.dll", "int QISearch(void*, void*, void*, void*)")
# 呼び出し: QISearch(that, pqit, riid, ppv)
# that : void* in/out -> "void*"
# pqit : QITAB* -> "void*"
# riid : GUID* -> "void*"
# ppv : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。