Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupSetFileQueueAlternatePlatformW

SetupSetFileQueueAlternatePlatformW

関数
ファイルキューに代替プラットフォーム情報を設定する(Unicode)。
DLLSETUPAPI.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL SetupSetFileQueueAlternatePlatformW(
    void* QueueHandle,
    SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo,   // optional
    LPCWSTR AlternateDefaultCatalogFile   // optional
);

パラメーター

名前方向
QueueHandlevoid*in
AlternatePlatformInfoSP_ALTPLATFORM_INFO_V2*inoptional
AlternateDefaultCatalogFileLPCWSTRinoptional

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL SetupSetFileQueueAlternatePlatformW(
    void* QueueHandle,
    SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo,   // optional
    LPCWSTR AlternateDefaultCatalogFile   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupSetFileQueueAlternatePlatformW(
    IntPtr QueueHandle,   // void*
    IntPtr AlternatePlatformInfo,   // SP_ALTPLATFORM_INFO_V2* optional
    [MarshalAs(UnmanagedType.LPWStr)] string AlternateDefaultCatalogFile   // LPCWSTR optional
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupSetFileQueueAlternatePlatformW(
    QueueHandle As IntPtr,   ' void*
    AlternatePlatformInfo As IntPtr,   ' SP_ALTPLATFORM_INFO_V2* optional
    <MarshalAs(UnmanagedType.LPWStr)> AlternateDefaultCatalogFile As String   ' LPCWSTR optional
) As Boolean
End Function
' QueueHandle : void*
' AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
' AlternateDefaultCatalogFile : LPCWSTR optional
Declare PtrSafe Function SetupSetFileQueueAlternatePlatformW Lib "setupapi" ( _
    ByVal QueueHandle As LongPtr, _
    ByVal AlternatePlatformInfo As LongPtr, _
    ByVal AlternateDefaultCatalogFile As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupSetFileQueueAlternatePlatformW = ctypes.windll.setupapi.SetupSetFileQueueAlternatePlatformW
SetupSetFileQueueAlternatePlatformW.restype = wintypes.BOOL
SetupSetFileQueueAlternatePlatformW.argtypes = [
    ctypes.POINTER(None),  # QueueHandle : void*
    ctypes.c_void_p,  # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
    wintypes.LPCWSTR,  # AlternateDefaultCatalogFile : LPCWSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupSetFileQueueAlternatePlatformW = Fiddle::Function.new(
  lib['SetupSetFileQueueAlternatePlatformW'],
  [
    Fiddle::TYPE_VOIDP,  # QueueHandle : void*
    Fiddle::TYPE_VOIDP,  # AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional
    Fiddle::TYPE_VOIDP,  # AlternateDefaultCatalogFile : LPCWSTR optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "setupapi")]
extern "system" {
    fn SetupSetFileQueueAlternatePlatformW(
        QueueHandle: *mut (),  // void*
        AlternatePlatformInfo: *mut SP_ALTPLATFORM_INFO_V2,  // SP_ALTPLATFORM_INFO_V2* optional
        AlternateDefaultCatalogFile: *const u16  // LPCWSTR optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SetupSetFileQueueAlternatePlatformW(IntPtr QueueHandle, IntPtr AlternatePlatformInfo, [MarshalAs(UnmanagedType.LPWStr)] string AlternateDefaultCatalogFile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupSetFileQueueAlternatePlatformW' -Namespace Win32 -PassThru
# $api::SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
#uselib "SETUPAPI.dll"
#func global SetupSetFileQueueAlternatePlatformW "SetupSetFileQueueAlternatePlatformW" wptr, wptr, wptr
; SetupSetFileQueueAlternatePlatformW QueueHandle, varptr(AlternatePlatformInfo), AlternateDefaultCatalogFile   ; 戻り値は stat
; QueueHandle : void* -> "wptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "wptr"
; AlternateDefaultCatalogFile : LPCWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SETUPAPI.dll"
#cfunc global SetupSetFileQueueAlternatePlatformW "SetupSetFileQueueAlternatePlatformW" sptr, var, wstr
; res = SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
; QueueHandle : void* -> "sptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var"
; AlternateDefaultCatalogFile : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL SetupSetFileQueueAlternatePlatformW(void* QueueHandle, SP_ALTPLATFORM_INFO_V2* AlternatePlatformInfo, LPCWSTR AlternateDefaultCatalogFile)
#uselib "SETUPAPI.dll"
#cfunc global SetupSetFileQueueAlternatePlatformW "SetupSetFileQueueAlternatePlatformW" intptr, var, wstr
; res = SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
; QueueHandle : void* -> "intptr"
; AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "var"
; AlternateDefaultCatalogFile : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupSetFileQueueAlternatePlatformW = setupapi.NewProc("SetupSetFileQueueAlternatePlatformW")
)

// QueueHandle (void*), AlternatePlatformInfo (SP_ALTPLATFORM_INFO_V2* optional), AlternateDefaultCatalogFile (LPCWSTR optional)
r1, _, err := procSetupSetFileQueueAlternatePlatformW.Call(
	uintptr(QueueHandle),
	uintptr(AlternatePlatformInfo),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(AlternateDefaultCatalogFile))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupSetFileQueueAlternatePlatformW(
  QueueHandle: Pointer;   // void*
  AlternatePlatformInfo: Pointer;   // SP_ALTPLATFORM_INFO_V2* optional
  AlternateDefaultCatalogFile: PWideChar   // LPCWSTR optional
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupSetFileQueueAlternatePlatformW';
result := DllCall("SETUPAPI\SetupSetFileQueueAlternatePlatformW"
    , "Ptr", QueueHandle   ; void*
    , "Ptr", AlternatePlatformInfo   ; SP_ALTPLATFORM_INFO_V2* optional
    , "WStr", AlternateDefaultCatalogFile   ; LPCWSTR optional
    , "Int")   ; return: BOOL
●SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile) = DLL("SETUPAPI.dll", "bool SetupSetFileQueueAlternatePlatformW(void*, void*, char*)")
# 呼び出し: SetupSetFileQueueAlternatePlatformW(QueueHandle, AlternatePlatformInfo, AlternateDefaultCatalogFile)
# QueueHandle : void* -> "void*"
# AlternatePlatformInfo : SP_ALTPLATFORM_INFO_V2* optional -> "void*"
# AlternateDefaultCatalogFile : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。