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

SetupDiGetHwProfileFriendlyNameExW

関数
指定マシンのハードウェアプロファイル名を取得する。
DLLSETUPAPI.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

BOOL SetupDiGetHwProfileFriendlyNameExW(
    DWORD HwProfile,
    LPWSTR FriendlyName,
    DWORD FriendlyNameSize,
    DWORD* RequiredSize,   // optional
    LPCWSTR MachineName,   // optional
    void* Reserved   // optional
);

パラメーター

名前方向説明
HwProfileDWORDinフレンドリ名を取得するハードウェアプロファイル番号。0で現在のプロファイル。
FriendlyNameLPWSTRoutプロファイルのフレンドリ名を受け取るバッファ(Unicode)。
FriendlyNameSizeDWORDinFriendlyNameバッファの文字数。終端NUL含む。
RequiredSizeDWORD*outoptional名前に必要な文字数を受け取るポインタ。不足判定に使う。NULL可。
MachineNameLPCWSTRinoptional対象リモートコンピュータ名(Unicode)。NULL指定でローカルマシンを対象とする。
Reservedvoid*optional予約済み。NULLを指定する。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetupDiGetHwProfileFriendlyNameExW(
    DWORD HwProfile,
    LPWSTR FriendlyName,
    DWORD FriendlyNameSize,
    DWORD* RequiredSize,   // optional
    LPCWSTR MachineName,   // optional
    void* Reserved   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupDiGetHwProfileFriendlyNameExW(
    uint HwProfile,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder FriendlyName,   // LPWSTR out
    uint FriendlyNameSize,   // DWORD
    IntPtr RequiredSize,   // DWORD* optional, out
    [MarshalAs(UnmanagedType.LPWStr)] string MachineName,   // LPCWSTR optional
    IntPtr Reserved   // void* optional
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupDiGetHwProfileFriendlyNameExW(
    HwProfile As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> FriendlyName As System.Text.StringBuilder,   ' LPWSTR out
    FriendlyNameSize As UInteger,   ' DWORD
    RequiredSize As IntPtr,   ' DWORD* optional, out
    <MarshalAs(UnmanagedType.LPWStr)> MachineName As String,   ' LPCWSTR optional
    Reserved As IntPtr   ' void* optional
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' HwProfile : DWORD
' FriendlyName : LPWSTR out
' FriendlyNameSize : DWORD
' RequiredSize : DWORD* optional, out
' MachineName : LPCWSTR optional
' Reserved : void* optional
Declare PtrSafe Function SetupDiGetHwProfileFriendlyNameExW Lib "setupapi" ( _
    ByVal HwProfile As Long, _
    ByVal FriendlyName As LongPtr, _
    ByVal FriendlyNameSize As Long, _
    ByVal RequiredSize As LongPtr, _
    ByVal MachineName As LongPtr, _
    ByVal Reserved 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

SetupDiGetHwProfileFriendlyNameExW = ctypes.windll.setupapi.SetupDiGetHwProfileFriendlyNameExW
SetupDiGetHwProfileFriendlyNameExW.restype = wintypes.BOOL
SetupDiGetHwProfileFriendlyNameExW.argtypes = [
    wintypes.DWORD,  # HwProfile : DWORD
    wintypes.LPWSTR,  # FriendlyName : LPWSTR out
    wintypes.DWORD,  # FriendlyNameSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # RequiredSize : DWORD* optional, out
    wintypes.LPCWSTR,  # MachineName : LPCWSTR optional
    ctypes.POINTER(None),  # Reserved : void* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupDiGetHwProfileFriendlyNameExW = Fiddle::Function.new(
  lib['SetupDiGetHwProfileFriendlyNameExW'],
  [
    -Fiddle::TYPE_INT,  # HwProfile : DWORD
    Fiddle::TYPE_VOIDP,  # FriendlyName : LPWSTR out
    -Fiddle::TYPE_INT,  # FriendlyNameSize : DWORD
    Fiddle::TYPE_VOIDP,  # RequiredSize : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # MachineName : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # Reserved : void* optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "setupapi")]
extern "system" {
    fn SetupDiGetHwProfileFriendlyNameExW(
        HwProfile: u32,  // DWORD
        FriendlyName: *mut u16,  // LPWSTR out
        FriendlyNameSize: u32,  // DWORD
        RequiredSize: *mut u32,  // DWORD* optional, out
        MachineName: *const u16,  // LPCWSTR optional
        Reserved: *mut ()  // void* 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 SetupDiGetHwProfileFriendlyNameExW(uint HwProfile, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder FriendlyName, uint FriendlyNameSize, IntPtr RequiredSize, [MarshalAs(UnmanagedType.LPWStr)] string MachineName, IntPtr Reserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupDiGetHwProfileFriendlyNameExW' -Namespace Win32 -PassThru
# $api::SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
#uselib "SETUPAPI.dll"
#func global SetupDiGetHwProfileFriendlyNameExW "SetupDiGetHwProfileFriendlyNameExW" wptr, wptr, wptr, wptr, wptr, wptr
; SetupDiGetHwProfileFriendlyNameExW HwProfile, varptr(FriendlyName), FriendlyNameSize, varptr(RequiredSize), MachineName, Reserved   ; 戻り値は stat
; HwProfile : DWORD -> "wptr"
; FriendlyName : LPWSTR out -> "wptr"
; FriendlyNameSize : DWORD -> "wptr"
; RequiredSize : DWORD* optional, out -> "wptr"
; MachineName : LPCWSTR optional -> "wptr"
; Reserved : void* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SETUPAPI.dll"
#cfunc global SetupDiGetHwProfileFriendlyNameExW "SetupDiGetHwProfileFriendlyNameExW" int, var, int, var, wstr, sptr
; res = SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
; HwProfile : DWORD -> "int"
; FriendlyName : LPWSTR out -> "var"
; FriendlyNameSize : DWORD -> "int"
; RequiredSize : DWORD* optional, out -> "var"
; MachineName : LPCWSTR optional -> "wstr"
; Reserved : void* optional -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL SetupDiGetHwProfileFriendlyNameExW(DWORD HwProfile, LPWSTR FriendlyName, DWORD FriendlyNameSize, DWORD* RequiredSize, LPCWSTR MachineName, void* Reserved)
#uselib "SETUPAPI.dll"
#cfunc global SetupDiGetHwProfileFriendlyNameExW "SetupDiGetHwProfileFriendlyNameExW" int, var, int, var, wstr, intptr
; res = SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
; HwProfile : DWORD -> "int"
; FriendlyName : LPWSTR out -> "var"
; FriendlyNameSize : DWORD -> "int"
; RequiredSize : DWORD* optional, out -> "var"
; MachineName : LPCWSTR optional -> "wstr"
; Reserved : void* optional -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupDiGetHwProfileFriendlyNameExW = setupapi.NewProc("SetupDiGetHwProfileFriendlyNameExW")
)

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

extern "setupapi" fn SetupDiGetHwProfileFriendlyNameExW(
    HwProfile: u32, // DWORD
    FriendlyName: [*c]u16, // LPWSTR out
    FriendlyNameSize: u32, // DWORD
    RequiredSize: [*c]u32, // DWORD* optional, out
    MachineName: [*c]const u16, // LPCWSTR optional
    Reserved: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc SetupDiGetHwProfileFriendlyNameExW(
    HwProfile: uint32,  # DWORD
    FriendlyName: ptr uint16,  # LPWSTR out
    FriendlyNameSize: uint32,  # DWORD
    RequiredSize: ptr uint32,  # DWORD* optional, out
    MachineName: WideCString,  # LPCWSTR optional
    Reserved: pointer  # void* optional
): int32 {.importc: "SetupDiGetHwProfileFriendlyNameExW", stdcall, dynlib: "SETUPAPI.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "setupapi");
extern(Windows)
int SetupDiGetHwProfileFriendlyNameExW(
    uint HwProfile,   // DWORD
    wchar* FriendlyName,   // LPWSTR out
    uint FriendlyNameSize,   // DWORD
    uint* RequiredSize,   // DWORD* optional, out
    const(wchar)* MachineName,   // LPCWSTR optional
    void* Reserved   // void* optional
);
ccall((:SetupDiGetHwProfileFriendlyNameExW, "SETUPAPI.dll"), stdcall, Int32,
      (UInt32, Ptr{UInt16}, UInt32, Ptr{UInt32}, Cwstring, Ptr{Cvoid}),
      HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
# HwProfile : DWORD -> UInt32
# FriendlyName : LPWSTR out -> Ptr{UInt16}
# FriendlyNameSize : DWORD -> UInt32
# RequiredSize : DWORD* optional, out -> Ptr{UInt32}
# MachineName : LPCWSTR optional -> Cwstring
# Reserved : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t SetupDiGetHwProfileFriendlyNameExW(
    uint32_t HwProfile,
    uint16_t* FriendlyName,
    uint32_t FriendlyNameSize,
    uint32_t* RequiredSize,
    const uint16_t* MachineName,
    void* Reserved);
]]
local setupapi = ffi.load("setupapi")
-- setupapi.SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
-- HwProfile : DWORD
-- FriendlyName : LPWSTR out
-- FriendlyNameSize : DWORD
-- RequiredSize : DWORD* optional, out
-- MachineName : LPCWSTR optional
-- Reserved : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('SETUPAPI.dll');
const SetupDiGetHwProfileFriendlyNameExW = lib.func('__stdcall', 'SetupDiGetHwProfileFriendlyNameExW', 'int32_t', ['uint32_t', 'uint16_t *', 'uint32_t', 'uint32_t *', 'str16', 'void *']);
// SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
// HwProfile : DWORD -> 'uint32_t'
// FriendlyName : LPWSTR out -> 'uint16_t *'
// FriendlyNameSize : DWORD -> 'uint32_t'
// RequiredSize : DWORD* optional, out -> 'uint32_t *'
// MachineName : LPCWSTR optional -> 'str16'
// Reserved : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SETUPAPI.dll", {
  SetupDiGetHwProfileFriendlyNameExW: { parameters: ["u32", "buffer", "u32", "pointer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved)
// HwProfile : DWORD -> "u32"
// FriendlyName : LPWSTR out -> "buffer"
// FriendlyNameSize : DWORD -> "u32"
// RequiredSize : DWORD* optional, out -> "pointer"
// MachineName : LPCWSTR optional -> "buffer"
// Reserved : void* optional -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t SetupDiGetHwProfileFriendlyNameExW(
    uint32_t HwProfile,
    uint16_t* FriendlyName,
    uint32_t FriendlyNameSize,
    uint32_t* RequiredSize,
    const uint16_t* MachineName,
    void* Reserved);
C, "SETUPAPI.dll");
// $ffi->SetupDiGetHwProfileFriendlyNameExW(HwProfile, FriendlyName, FriendlyNameSize, RequiredSize, MachineName, Reserved);
// HwProfile : DWORD
// FriendlyName : LPWSTR out
// FriendlyNameSize : DWORD
// RequiredSize : DWORD* optional, out
// MachineName : LPCWSTR optional
// Reserved : void* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Setupapi extends StdCallLibrary {
    Setupapi INSTANCE = Native.load("setupapi", Setupapi.class, W32APIOptions.UNICODE_OPTIONS);
    boolean SetupDiGetHwProfileFriendlyNameExW(
        int HwProfile,   // DWORD
        char[] FriendlyName,   // LPWSTR out
        int FriendlyNameSize,   // DWORD
        IntByReference RequiredSize,   // DWORD* optional, out
        WString MachineName,   // LPCWSTR optional
        Pointer Reserved   // void* optional
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("setupapi")]
lib LibSETUPAPI
  fun SetupDiGetHwProfileFriendlyNameExW = SetupDiGetHwProfileFriendlyNameExW(
    HwProfile : UInt32,   # DWORD
    FriendlyName : UInt16*,   # LPWSTR out
    FriendlyNameSize : UInt32,   # DWORD
    RequiredSize : UInt32*,   # DWORD* optional, out
    MachineName : UInt16*,   # LPCWSTR optional
    Reserved : Void*   # void* optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SetupDiGetHwProfileFriendlyNameExWNative = Int32 Function(Uint32, Pointer<Utf16>, Uint32, Pointer<Uint32>, Pointer<Utf16>, Pointer<Void>);
typedef SetupDiGetHwProfileFriendlyNameExWDart = int Function(int, Pointer<Utf16>, int, Pointer<Uint32>, Pointer<Utf16>, Pointer<Void>);
final SetupDiGetHwProfileFriendlyNameExW = DynamicLibrary.open('SETUPAPI.dll')
    .lookupFunction<SetupDiGetHwProfileFriendlyNameExWNative, SetupDiGetHwProfileFriendlyNameExWDart>('SetupDiGetHwProfileFriendlyNameExW');
// HwProfile : DWORD -> Uint32
// FriendlyName : LPWSTR out -> Pointer<Utf16>
// FriendlyNameSize : DWORD -> Uint32
// RequiredSize : DWORD* optional, out -> Pointer<Uint32>
// MachineName : LPCWSTR optional -> Pointer<Utf16>
// Reserved : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SetupDiGetHwProfileFriendlyNameExW(
  HwProfile: DWORD;   // DWORD
  FriendlyName: PWideChar;   // LPWSTR out
  FriendlyNameSize: DWORD;   // DWORD
  RequiredSize: Pointer;   // DWORD* optional, out
  MachineName: PWideChar;   // LPCWSTR optional
  Reserved: Pointer   // void* optional
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupDiGetHwProfileFriendlyNameExW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SetupDiGetHwProfileFriendlyNameExW"
  c_SetupDiGetHwProfileFriendlyNameExW :: Word32 -> CWString -> Word32 -> Ptr Word32 -> CWString -> Ptr () -> IO CInt
-- HwProfile : DWORD -> Word32
-- FriendlyName : LPWSTR out -> CWString
-- FriendlyNameSize : DWORD -> Word32
-- RequiredSize : DWORD* optional, out -> Ptr Word32
-- MachineName : LPCWSTR optional -> CWString
-- Reserved : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let setupdigethwprofilefriendlynameexw =
  foreign "SetupDiGetHwProfileFriendlyNameExW"
    (uint32_t @-> (ptr uint16_t) @-> uint32_t @-> (ptr uint32_t) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* HwProfile : DWORD -> uint32_t *)
(* FriendlyName : LPWSTR out -> (ptr uint16_t) *)
(* FriendlyNameSize : DWORD -> uint32_t *)
(* RequiredSize : DWORD* optional, out -> (ptr uint32_t) *)
(* MachineName : LPCWSTR optional -> (ptr uint16_t) *)
(* Reserved : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library setupapi (t "SETUPAPI.dll"))
(cffi:use-foreign-library setupapi)

(cffi:defcfun ("SetupDiGetHwProfileFriendlyNameExW" setup-di-get-hw-profile-friendly-name-ex-w :convention :stdcall) :int32
  (hw-profile :uint32)   ; DWORD
  (friendly-name :pointer)   ; LPWSTR out
  (friendly-name-size :uint32)   ; DWORD
  (required-size :pointer)   ; DWORD* optional, out
  (machine-name (:string :encoding :utf-16le))   ; LPCWSTR optional
  (reserved :pointer))   ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SetupDiGetHwProfileFriendlyNameExW = Win32::API::More->new('SETUPAPI',
    'BOOL SetupDiGetHwProfileFriendlyNameExW(DWORD HwProfile, LPWSTR FriendlyName, DWORD FriendlyNameSize, LPVOID RequiredSize, LPCWSTR MachineName, LPVOID Reserved)');
# my $ret = $SetupDiGetHwProfileFriendlyNameExW->Call($HwProfile, $FriendlyName, $FriendlyNameSize, $RequiredSize, $MachineName, $Reserved);
# HwProfile : DWORD -> DWORD
# FriendlyName : LPWSTR out -> LPWSTR
# FriendlyNameSize : DWORD -> DWORD
# RequiredSize : DWORD* optional, out -> LPVOID
# MachineName : LPCWSTR optional -> LPCWSTR
# Reserved : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
類似 API