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

RpcNsProfileEltInqNextW

関数
プロファイル要素列挙から次の要素を取得する(Unicode版)。
DLLRPCNS4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcNsProfileEltInqNextW(
    void* InquiryContext,
    RPC_IF_ID* IfId,   // optional
    LPWSTR* MemberName,
    DWORD* Priority,
    LPWSTR* Annotation
);

パラメーター

名前方向説明
InquiryContextvoid*inInqBeginで取得した列挙コンテキスト。プロファイル要素列挙の状態を保持する。
IfIdRPC_IF_ID*outoptional次の要素のインターフェイス識別子を受け取るRPC_IF_IDへのポインタ。
MemberNameLPWSTR*out次の要素のメンバー名(Unicode文字列)を受け取るポインタのアドレス。解放が必要。NULL可。
PriorityDWORD*out次の要素の優先順位を受け取るDWORDへのポインタ。NULL可。
AnnotationLPWSTR*out次の要素の注釈文字列(Unicode)を受け取るポインタのアドレス。解放が必要。NULL可。

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcNsProfileEltInqNextW(
    void* InquiryContext,
    RPC_IF_ID* IfId,   // optional
    LPWSTR* MemberName,
    DWORD* Priority,
    LPWSTR* Annotation
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsProfileEltInqNextW(
    IntPtr InquiryContext,   // void*
    IntPtr IfId,   // RPC_IF_ID* optional, out
    IntPtr MemberName,   // LPWSTR* out
    out uint Priority,   // DWORD* out
    IntPtr Annotation   // LPWSTR* out
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsProfileEltInqNextW(
    InquiryContext As IntPtr,   ' void*
    IfId As IntPtr,   ' RPC_IF_ID* optional, out
    MemberName As IntPtr,   ' LPWSTR* out
    <Out> ByRef Priority As UInteger,   ' DWORD* out
    Annotation As IntPtr   ' LPWSTR* out
) As Integer
End Function
' InquiryContext : void*
' IfId : RPC_IF_ID* optional, out
' MemberName : LPWSTR* out
' Priority : DWORD* out
' Annotation : LPWSTR* out
Declare PtrSafe Function RpcNsProfileEltInqNextW Lib "rpcns4" ( _
    ByVal InquiryContext As LongPtr, _
    ByVal IfId As LongPtr, _
    ByVal MemberName As LongPtr, _
    ByRef 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

RpcNsProfileEltInqNextW = ctypes.windll.rpcns4.RpcNsProfileEltInqNextW
RpcNsProfileEltInqNextW.restype = ctypes.c_int
RpcNsProfileEltInqNextW.argtypes = [
    ctypes.POINTER(None),  # InquiryContext : void*
    ctypes.c_void_p,  # IfId : RPC_IF_ID* optional, out
    ctypes.c_void_p,  # MemberName : LPWSTR* out
    ctypes.POINTER(wintypes.DWORD),  # Priority : DWORD* out
    ctypes.c_void_p,  # Annotation : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileEltInqNextW = rpcns4.NewProc("RpcNsProfileEltInqNextW")
)

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

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

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

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

let rpcnsprofileeltinqnextw =
  foreign "RpcNsProfileEltInqNextW"
    ((ptr void) @-> (ptr void) @-> (ptr (ptr uint16_t)) @-> (ptr uint32_t) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* InquiryContext : void* -> (ptr void) *)
(* IfId : RPC_IF_ID* optional, out -> (ptr void) *)
(* MemberName : LPWSTR* out -> (ptr (ptr uint16_t)) *)
(* Priority : DWORD* out -> (ptr uint32_t) *)
(* Annotation : LPWSTR* out -> (ptr (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 ("RpcNsProfileEltInqNextW" rpc-ns-profile-elt-inq-next-w :convention :stdcall) :int32
  (inquiry-context :pointer)   ; void*
  (if-id :pointer)   ; RPC_IF_ID* optional, out
  (member-name :pointer)   ; LPWSTR* out
  (priority :pointer)   ; DWORD* out
  (annotation :pointer))   ; LPWSTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcNsProfileEltInqNextW = Win32::API::More->new('RPCNS4',
    'int RpcNsProfileEltInqNextW(LPVOID InquiryContext, LPVOID IfId, LPVOID MemberName, LPVOID Priority, LPVOID Annotation)');
# my $ret = $RpcNsProfileEltInqNextW->Call($InquiryContext, $IfId, $MemberName, $Priority, $Annotation);
# InquiryContext : void* -> LPVOID
# IfId : RPC_IF_ID* optional, out -> LPVOID
# MemberName : LPWSTR* out -> LPVOID
# Priority : DWORD* out -> LPVOID
# Annotation : LPWSTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

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