Win32 API 日本語リファレンス
ホームSystem.Rpc › RpcNsProfileEltAddW

RpcNsProfileEltAddW

関数
ネームサービスのプロファイルに要素を追加する(Unicode版)。
DLLRPCNS4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcNsProfileEltAddW(
    DWORD ProfileNameSyntax,
    LPWSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPWSTR MemberName,
    DWORD Priority,
    LPWSTR Annotation   // optional
);

パラメーター

名前方向説明
ProfileNameSyntaxDWORDinProfileNameの名前構文を指定するDWORD。0で既定構文を使用する。
ProfileNameLPWSTRin要素を追加する対象プロファイルのエントリ名(Unicode文字列)。
IfIdRPC_IF_ID*inoptional追加する要素のインターフェイス識別子(RPC_IF_ID)へのポインタ。
MemberNameSyntaxDWORDinMemberNameの名前構文を指定するDWORD。0で既定構文を使用する。
MemberNameLPWSTRinプロファイル要素が参照するメンバーのエントリ名(Unicode文字列)。
PriorityDWORDin要素の検索優先順位。0が最優先で値が小さいほど優先される。
AnnotationLPWSTRinoptional要素に付与する注釈文字列(Unicode)。NULL可。

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcNsProfileEltAddW(
    DWORD ProfileNameSyntax,
    LPWSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPWSTR MemberName,
    DWORD Priority,
    LPWSTR Annotation   // optional
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsProfileEltAddW(
    uint ProfileNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string ProfileName,   // LPWSTR
    IntPtr IfId,   // RPC_IF_ID* optional
    uint MemberNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string MemberName,   // LPWSTR
    uint Priority,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string Annotation   // LPWSTR optional
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsProfileEltAddW(
    ProfileNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> ProfileName As String,   ' LPWSTR
    IfId As IntPtr,   ' RPC_IF_ID* optional
    MemberNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> MemberName As String,   ' LPWSTR
    Priority As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> Annotation As String   ' LPWSTR optional
) As Integer
End Function
' ProfileNameSyntax : DWORD
' ProfileName : LPWSTR
' IfId : RPC_IF_ID* optional
' MemberNameSyntax : DWORD
' MemberName : LPWSTR
' Priority : DWORD
' Annotation : LPWSTR optional
Declare PtrSafe Function RpcNsProfileEltAddW Lib "rpcns4" ( _
    ByVal ProfileNameSyntax As Long, _
    ByVal ProfileName As LongPtr, _
    ByVal IfId As LongPtr, _
    ByVal MemberNameSyntax As Long, _
    ByVal MemberName As LongPtr, _
    ByVal Priority As Long, _
    ByVal Annotation 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

RpcNsProfileEltAddW = ctypes.windll.rpcns4.RpcNsProfileEltAddW
RpcNsProfileEltAddW.restype = ctypes.c_int
RpcNsProfileEltAddW.argtypes = [
    wintypes.DWORD,  # ProfileNameSyntax : DWORD
    wintypes.LPCWSTR,  # ProfileName : LPWSTR
    ctypes.c_void_p,  # IfId : RPC_IF_ID* optional
    wintypes.DWORD,  # MemberNameSyntax : DWORD
    wintypes.LPCWSTR,  # MemberName : LPWSTR
    wintypes.DWORD,  # Priority : DWORD
    wintypes.LPCWSTR,  # Annotation : LPWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsProfileEltAddW = Fiddle::Function.new(
  lib['RpcNsProfileEltAddW'],
  [
    -Fiddle::TYPE_INT,  # ProfileNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # ProfileName : LPWSTR
    Fiddle::TYPE_VOIDP,  # IfId : RPC_IF_ID* optional
    -Fiddle::TYPE_INT,  # MemberNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # MemberName : LPWSTR
    -Fiddle::TYPE_INT,  # Priority : DWORD
    Fiddle::TYPE_VOIDP,  # Annotation : LPWSTR optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsProfileEltAddW(
        ProfileNameSyntax: u32,  // DWORD
        ProfileName: *mut u16,  // LPWSTR
        IfId: *mut RPC_IF_ID,  // RPC_IF_ID* optional
        MemberNameSyntax: u32,  // DWORD
        MemberName: *mut u16,  // LPWSTR
        Priority: u32,  // DWORD
        Annotation: *mut u16  // LPWSTR optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcNsProfileEltAddW(uint ProfileNameSyntax, [MarshalAs(UnmanagedType.LPWStr)] string ProfileName, IntPtr IfId, uint MemberNameSyntax, [MarshalAs(UnmanagedType.LPWStr)] string MemberName, uint Priority, [MarshalAs(UnmanagedType.LPWStr)] string Annotation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsProfileEltAddW' -Namespace Win32 -PassThru
# $api::RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
#uselib "RPCNS4.dll"
#func global RpcNsProfileEltAddW "RpcNsProfileEltAddW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; RpcNsProfileEltAddW ProfileNameSyntax, ProfileName, varptr(IfId), MemberNameSyntax, MemberName, Priority, Annotation   ; 戻り値は stat
; ProfileNameSyntax : DWORD -> "wptr"
; ProfileName : LPWSTR -> "wptr"
; IfId : RPC_IF_ID* optional -> "wptr"
; MemberNameSyntax : DWORD -> "wptr"
; MemberName : LPWSTR -> "wptr"
; Priority : DWORD -> "wptr"
; Annotation : LPWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCNS4.dll"
#cfunc global RpcNsProfileEltAddW "RpcNsProfileEltAddW" int, wstr, var, int, wstr, int, wstr
; res = RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
; ProfileNameSyntax : DWORD -> "int"
; ProfileName : LPWSTR -> "wstr"
; IfId : RPC_IF_ID* optional -> "var"
; MemberNameSyntax : DWORD -> "int"
; MemberName : LPWSTR -> "wstr"
; Priority : DWORD -> "int"
; Annotation : LPWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcNsProfileEltAddW(DWORD ProfileNameSyntax, LPWSTR ProfileName, RPC_IF_ID* IfId, DWORD MemberNameSyntax, LPWSTR MemberName, DWORD Priority, LPWSTR Annotation)
#uselib "RPCNS4.dll"
#cfunc global RpcNsProfileEltAddW "RpcNsProfileEltAddW" int, wstr, var, int, wstr, int, wstr
; res = RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
; ProfileNameSyntax : DWORD -> "int"
; ProfileName : LPWSTR -> "wstr"
; IfId : RPC_IF_ID* optional -> "var"
; MemberNameSyntax : DWORD -> "int"
; MemberName : LPWSTR -> "wstr"
; Priority : DWORD -> "int"
; Annotation : LPWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileEltAddW = rpcns4.NewProc("RpcNsProfileEltAddW")
)

// ProfileNameSyntax (DWORD), ProfileName (LPWSTR), IfId (RPC_IF_ID* optional), MemberNameSyntax (DWORD), MemberName (LPWSTR), Priority (DWORD), Annotation (LPWSTR optional)
r1, _, err := procRpcNsProfileEltAddW.Call(
	uintptr(ProfileNameSyntax),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ProfileName))),
	uintptr(IfId),
	uintptr(MemberNameSyntax),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(MemberName))),
	uintptr(Priority),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Annotation))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsProfileEltAddW(
  ProfileNameSyntax: DWORD;   // DWORD
  ProfileName: PWideChar;   // LPWSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  MemberNameSyntax: DWORD;   // DWORD
  MemberName: PWideChar;   // LPWSTR
  Priority: DWORD;   // DWORD
  Annotation: PWideChar   // LPWSTR optional
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsProfileEltAddW';
result := DllCall("RPCNS4\RpcNsProfileEltAddW"
    , "UInt", ProfileNameSyntax   ; DWORD
    , "WStr", ProfileName   ; LPWSTR
    , "Ptr", IfId   ; RPC_IF_ID* optional
    , "UInt", MemberNameSyntax   ; DWORD
    , "WStr", MemberName   ; LPWSTR
    , "UInt", Priority   ; DWORD
    , "WStr", Annotation   ; LPWSTR optional
    , "Int")   ; return: RPC_STATUS
●RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation) = DLL("RPCNS4.dll", "int RpcNsProfileEltAddW(dword, char*, void*, dword, char*, dword, char*)")
# 呼び出し: RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
# ProfileNameSyntax : DWORD -> "dword"
# ProfileName : LPWSTR -> "char*"
# IfId : RPC_IF_ID* optional -> "void*"
# MemberNameSyntax : DWORD -> "dword"
# MemberName : LPWSTR -> "char*"
# Priority : DWORD -> "dword"
# Annotation : LPWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "rpcns4" fn RpcNsProfileEltAddW(
    ProfileNameSyntax: u32, // DWORD
    ProfileName: [*c]const u16, // LPWSTR
    IfId: [*c]RPC_IF_ID, // RPC_IF_ID* optional
    MemberNameSyntax: u32, // DWORD
    MemberName: [*c]const u16, // LPWSTR
    Priority: u32, // DWORD
    Annotation: [*c]const u16 // LPWSTR optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RpcNsProfileEltAddW(
    ProfileNameSyntax: uint32,  # DWORD
    ProfileName: WideCString,  # LPWSTR
    IfId: ptr RPC_IF_ID,  # RPC_IF_ID* optional
    MemberNameSyntax: uint32,  # DWORD
    MemberName: WideCString,  # LPWSTR
    Priority: uint32,  # DWORD
    Annotation: WideCString  # LPWSTR optional
): int32 {.importc: "RpcNsProfileEltAddW", stdcall, dynlib: "RPCNS4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "rpcns4");
extern(Windows)
int RpcNsProfileEltAddW(
    uint ProfileNameSyntax,   // DWORD
    const(wchar)* ProfileName,   // LPWSTR
    RPC_IF_ID* IfId,   // RPC_IF_ID* optional
    uint MemberNameSyntax,   // DWORD
    const(wchar)* MemberName,   // LPWSTR
    uint Priority,   // DWORD
    const(wchar)* Annotation   // LPWSTR optional
);
ccall((:RpcNsProfileEltAddW, "RPCNS4.dll"), stdcall, Int32,
      (UInt32, Cwstring, Ptr{RPC_IF_ID}, UInt32, Cwstring, UInt32, Cwstring),
      ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
# ProfileNameSyntax : DWORD -> UInt32
# ProfileName : LPWSTR -> Cwstring
# IfId : RPC_IF_ID* optional -> Ptr{RPC_IF_ID}
# MemberNameSyntax : DWORD -> UInt32
# MemberName : LPWSTR -> Cwstring
# Priority : DWORD -> UInt32
# Annotation : LPWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcNsProfileEltAddW(
    uint32_t ProfileNameSyntax,
    const uint16_t* ProfileName,
    void* IfId,
    uint32_t MemberNameSyntax,
    const uint16_t* MemberName,
    uint32_t Priority,
    const uint16_t* Annotation);
]]
local rpcns4 = ffi.load("rpcns4")
-- rpcns4.RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
-- ProfileNameSyntax : DWORD
-- ProfileName : LPWSTR
-- IfId : RPC_IF_ID* optional
-- MemberNameSyntax : DWORD
-- MemberName : LPWSTR
-- Priority : DWORD
-- Annotation : LPWSTR 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('RPCNS4.dll');
const RpcNsProfileEltAddW = lib.func('__stdcall', 'RpcNsProfileEltAddW', 'int32_t', ['uint32_t', 'str16', 'void *', 'uint32_t', 'str16', 'uint32_t', 'str16']);
// RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
// ProfileNameSyntax : DWORD -> 'uint32_t'
// ProfileName : LPWSTR -> 'str16'
// IfId : RPC_IF_ID* optional -> 'void *'
// MemberNameSyntax : DWORD -> 'uint32_t'
// MemberName : LPWSTR -> 'str16'
// Priority : DWORD -> 'uint32_t'
// Annotation : LPWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCNS4.dll", {
  RpcNsProfileEltAddW: { parameters: ["u32", "buffer", "pointer", "u32", "buffer", "u32", "buffer"], result: "i32" },
});
// lib.symbols.RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation)
// ProfileNameSyntax : DWORD -> "u32"
// ProfileName : LPWSTR -> "buffer"
// IfId : RPC_IF_ID* optional -> "pointer"
// MemberNameSyntax : DWORD -> "u32"
// MemberName : LPWSTR -> "buffer"
// Priority : DWORD -> "u32"
// Annotation : LPWSTR optional -> "buffer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcNsProfileEltAddW(
    uint32_t ProfileNameSyntax,
    const uint16_t* ProfileName,
    void* IfId,
    uint32_t MemberNameSyntax,
    const uint16_t* MemberName,
    uint32_t Priority,
    const uint16_t* Annotation);
C, "RPCNS4.dll");
// $ffi->RpcNsProfileEltAddW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName, Priority, Annotation);
// ProfileNameSyntax : DWORD
// ProfileName : LPWSTR
// IfId : RPC_IF_ID* optional
// MemberNameSyntax : DWORD
// MemberName : LPWSTR
// Priority : DWORD
// Annotation : LPWSTR 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 Rpcns4 extends StdCallLibrary {
    Rpcns4 INSTANCE = Native.load("rpcns4", Rpcns4.class, W32APIOptions.UNICODE_OPTIONS);
    int RpcNsProfileEltAddW(
        int ProfileNameSyntax,   // DWORD
        WString ProfileName,   // LPWSTR
        Pointer IfId,   // RPC_IF_ID* optional
        int MemberNameSyntax,   // DWORD
        WString MemberName,   // LPWSTR
        int Priority,   // DWORD
        WString Annotation   // LPWSTR optional
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("rpcns4")]
lib LibRPCNS4
  fun RpcNsProfileEltAddW = RpcNsProfileEltAddW(
    ProfileNameSyntax : UInt32,   # DWORD
    ProfileName : UInt16*,   # LPWSTR
    IfId : RPC_IF_ID*,   # RPC_IF_ID* optional
    MemberNameSyntax : UInt32,   # DWORD
    MemberName : UInt16*,   # LPWSTR
    Priority : UInt32,   # DWORD
    Annotation : UInt16*   # LPWSTR optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RpcNsProfileEltAddWNative = Int32 Function(Uint32, Pointer<Utf16>, Pointer<Void>, Uint32, Pointer<Utf16>, Uint32, Pointer<Utf16>);
typedef RpcNsProfileEltAddWDart = int Function(int, Pointer<Utf16>, Pointer<Void>, int, Pointer<Utf16>, int, Pointer<Utf16>);
final RpcNsProfileEltAddW = DynamicLibrary.open('RPCNS4.dll')
    .lookupFunction<RpcNsProfileEltAddWNative, RpcNsProfileEltAddWDart>('RpcNsProfileEltAddW');
// ProfileNameSyntax : DWORD -> Uint32
// ProfileName : LPWSTR -> Pointer<Utf16>
// IfId : RPC_IF_ID* optional -> Pointer<Void>
// MemberNameSyntax : DWORD -> Uint32
// MemberName : LPWSTR -> Pointer<Utf16>
// Priority : DWORD -> Uint32
// Annotation : LPWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RpcNsProfileEltAddW(
  ProfileNameSyntax: DWORD;   // DWORD
  ProfileName: PWideChar;   // LPWSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  MemberNameSyntax: DWORD;   // DWORD
  MemberName: PWideChar;   // LPWSTR
  Priority: DWORD;   // DWORD
  Annotation: PWideChar   // LPWSTR optional
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsProfileEltAddW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcNsProfileEltAddW"
  c_RpcNsProfileEltAddW :: Word32 -> CWString -> Ptr () -> Word32 -> CWString -> Word32 -> CWString -> IO Int32
-- ProfileNameSyntax : DWORD -> Word32
-- ProfileName : LPWSTR -> CWString
-- IfId : RPC_IF_ID* optional -> Ptr ()
-- MemberNameSyntax : DWORD -> Word32
-- MemberName : LPWSTR -> CWString
-- Priority : DWORD -> Word32
-- Annotation : LPWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rpcnsprofileeltaddw =
  foreign "RpcNsProfileEltAddW"
    (uint32_t @-> (ptr uint16_t) @-> (ptr void) @-> uint32_t @-> (ptr uint16_t) @-> uint32_t @-> (ptr uint16_t) @-> returning int32_t)
(* ProfileNameSyntax : DWORD -> uint32_t *)
(* ProfileName : LPWSTR -> (ptr uint16_t) *)
(* IfId : RPC_IF_ID* optional -> (ptr void) *)
(* MemberNameSyntax : DWORD -> uint32_t *)
(* MemberName : LPWSTR -> (ptr uint16_t) *)
(* Priority : DWORD -> uint32_t *)
(* Annotation : LPWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcns4 (t "RPCNS4.dll"))
(cffi:use-foreign-library rpcns4)

(cffi:defcfun ("RpcNsProfileEltAddW" rpc-ns-profile-elt-add-w :convention :stdcall) :int32
  (profile-name-syntax :uint32)   ; DWORD
  (profile-name (:string :encoding :utf-16le))   ; LPWSTR
  (if-id :pointer)   ; RPC_IF_ID* optional
  (member-name-syntax :uint32)   ; DWORD
  (member-name (:string :encoding :utf-16le))   ; LPWSTR
  (priority :uint32)   ; DWORD
  (annotation (:string :encoding :utf-16le)))   ; LPWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcNsProfileEltAddW = Win32::API::More->new('RPCNS4',
    'int RpcNsProfileEltAddW(DWORD ProfileNameSyntax, LPCWSTR ProfileName, LPVOID IfId, DWORD MemberNameSyntax, LPCWSTR MemberName, DWORD Priority, LPCWSTR Annotation)');
# my $ret = $RpcNsProfileEltAddW->Call($ProfileNameSyntax, $ProfileName, $IfId, $MemberNameSyntax, $MemberName, $Priority, $Annotation);
# ProfileNameSyntax : DWORD -> DWORD
# ProfileName : LPWSTR -> LPCWSTR
# IfId : RPC_IF_ID* optional -> LPVOID
# MemberNameSyntax : DWORD -> DWORD
# MemberName : LPWSTR -> LPCWSTR
# Priority : DWORD -> DWORD
# Annotation : LPWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型