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

RpcNsProfileEltInqNextA

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

シグネチャ

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

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

パラメーター

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

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNsProfileEltInqNextA(
    void* InquiryContext,
    RPC_IF_ID* IfId,   // optional
    LPSTR* MemberName,
    DWORD* Priority,
    LPSTR* Annotation
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcNsProfileEltInqNextA(
    IntPtr InquiryContext,   // void*
    IntPtr IfId,   // RPC_IF_ID* optional, out
    IntPtr MemberName,   // LPSTR* out
    out uint Priority,   // DWORD* out
    IntPtr Annotation   // LPSTR* out
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcNsProfileEltInqNextA(
    InquiryContext As IntPtr,   ' void*
    IfId As IntPtr,   ' RPC_IF_ID* optional, out
    MemberName As IntPtr,   ' LPSTR* out
    <Out> ByRef Priority As UInteger,   ' DWORD* out
    Annotation As IntPtr   ' LPSTR* out
) As Integer
End Function
' InquiryContext : void*
' IfId : RPC_IF_ID* optional, out
' MemberName : LPSTR* out
' Priority : DWORD* out
' Annotation : LPSTR* out
Declare PtrSafe Function RpcNsProfileEltInqNextA Lib "rpcns4" ( _
    ByVal InquiryContext As LongPtr, _
    ByVal IfId As LongPtr, _
    ByVal MemberName As LongPtr, _
    ByRef Priority As Long, _
    ByVal Annotation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileEltInqNextA = rpcns4.NewProc("RpcNsProfileEltInqNextA")
)

// InquiryContext (void*), IfId (RPC_IF_ID* optional, out), MemberName (LPSTR* out), Priority (DWORD* out), Annotation (LPSTR* out)
r1, _, err := procRpcNsProfileEltInqNextA.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 RpcNsProfileEltInqNextA(
  InquiryContext: Pointer;   // void*
  IfId: Pointer;   // RPC_IF_ID* optional, out
  MemberName: PPAnsiChar;   // LPSTR* out
  Priority: Pointer;   // DWORD* out
  Annotation: PPAnsiChar   // LPSTR* out
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsProfileEltInqNextA';
result := DllCall("RPCNS4\RpcNsProfileEltInqNextA"
    , "Ptr", InquiryContext   ; void*
    , "Ptr", IfId   ; RPC_IF_ID* optional, out
    , "Ptr", MemberName   ; LPSTR* out
    , "Ptr", Priority   ; DWORD* out
    , "Ptr", Annotation   ; LPSTR* out
    , "Int")   ; return: RPC_STATUS
●RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation) = DLL("RPCNS4.dll", "int RpcNsProfileEltInqNextA(void*, void*, void*, void*, void*)")
# 呼び出し: RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation)
# InquiryContext : void* -> "void*"
# IfId : RPC_IF_ID* optional, out -> "void*"
# MemberName : LPSTR* out -> "void*"
# Priority : DWORD* out -> "void*"
# Annotation : LPSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "rpcns4" fn RpcNsProfileEltInqNextA(
    InquiryContext: ?*anyopaque, // void*
    IfId: [*c]RPC_IF_ID, // RPC_IF_ID* optional, out
    MemberName: [*c][*c]u8, // LPSTR* out
    Priority: [*c]u32, // DWORD* out
    Annotation: [*c][*c]u8 // LPSTR* out
) callconv(std.os.windows.WINAPI) i32;
proc RpcNsProfileEltInqNextA(
    InquiryContext: pointer,  # void*
    IfId: ptr RPC_IF_ID,  # RPC_IF_ID* optional, out
    MemberName: ptr cstring,  # LPSTR* out
    Priority: ptr uint32,  # DWORD* out
    Annotation: ptr cstring  # LPSTR* out
): int32 {.importc: "RpcNsProfileEltInqNextA", stdcall, dynlib: "RPCNS4.dll".}
pragma(lib, "rpcns4");
extern(Windows)
int RpcNsProfileEltInqNextA(
    void* InquiryContext,   // void*
    RPC_IF_ID* IfId,   // RPC_IF_ID* optional, out
    char** MemberName,   // LPSTR* out
    uint* Priority,   // DWORD* out
    char** Annotation   // LPSTR* out
);
ccall((:RpcNsProfileEltInqNextA, "RPCNS4.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{RPC_IF_ID}, Ptr{Ptr{UInt8}}, Ptr{UInt32}, Ptr{Ptr{UInt8}}),
      InquiryContext, IfId, MemberName, Priority, Annotation)
# InquiryContext : void* -> Ptr{Cvoid}
# IfId : RPC_IF_ID* optional, out -> Ptr{RPC_IF_ID}
# MemberName : LPSTR* out -> Ptr{Ptr{UInt8}}
# Priority : DWORD* out -> Ptr{UInt32}
# Annotation : LPSTR* out -> Ptr{Ptr{UInt8}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcNsProfileEltInqNextA(
    void* InquiryContext,
    void* IfId,
    char** MemberName,
    uint32_t* Priority,
    char** Annotation);
]]
local rpcns4 = ffi.load("rpcns4")
-- rpcns4.RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation)
-- InquiryContext : void*
-- IfId : RPC_IF_ID* optional, out
-- MemberName : LPSTR* out
-- Priority : DWORD* out
-- Annotation : LPSTR* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RPCNS4.dll');
const RpcNsProfileEltInqNextA = lib.func('__stdcall', 'RpcNsProfileEltInqNextA', 'int32_t', ['void *', 'void *', 'void *', 'uint32_t *', 'void *']);
// RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation)
// InquiryContext : void* -> 'void *'
// IfId : RPC_IF_ID* optional, out -> 'void *'
// MemberName : LPSTR* out -> 'void *'
// Priority : DWORD* out -> 'uint32_t *'
// Annotation : LPSTR* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCNS4.dll", {
  RpcNsProfileEltInqNextA: { parameters: ["pointer", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation)
// InquiryContext : void* -> "pointer"
// IfId : RPC_IF_ID* optional, out -> "pointer"
// MemberName : LPSTR* out -> "pointer"
// Priority : DWORD* out -> "pointer"
// Annotation : LPSTR* out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcNsProfileEltInqNextA(
    void* InquiryContext,
    void* IfId,
    char** MemberName,
    uint32_t* Priority,
    char** Annotation);
C, "RPCNS4.dll");
// $ffi->RpcNsProfileEltInqNextA(InquiryContext, IfId, MemberName, Priority, Annotation);
// InquiryContext : void*
// IfId : RPC_IF_ID* optional, out
// MemberName : LPSTR* out
// Priority : DWORD* out
// Annotation : LPSTR* 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.ASCII_OPTIONS);
    int RpcNsProfileEltInqNextA(
        Pointer InquiryContext,   // void*
        Pointer IfId,   // RPC_IF_ID* optional, out
        PointerByReference MemberName,   // LPSTR* out
        IntByReference Priority,   // DWORD* out
        PointerByReference Annotation   // LPSTR* out
    );
}
@[Link("rpcns4")]
lib LibRPCNS4
  fun RpcNsProfileEltInqNextA = RpcNsProfileEltInqNextA(
    InquiryContext : Void*,   # void*
    IfId : RPC_IF_ID*,   # RPC_IF_ID* optional, out
    MemberName : UInt8**,   # LPSTR* out
    Priority : UInt32*,   # DWORD* out
    Annotation : UInt8**   # LPSTR* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

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

let rpcnsprofileeltinqnexta =
  foreign "RpcNsProfileEltInqNextA"
    ((ptr void) @-> (ptr void) @-> (ptr string) @-> (ptr uint32_t) @-> (ptr string) @-> returning int32_t)
(* InquiryContext : void* -> (ptr void) *)
(* IfId : RPC_IF_ID* optional, out -> (ptr void) *)
(* MemberName : LPSTR* out -> (ptr string) *)
(* Priority : DWORD* out -> (ptr uint32_t) *)
(* Annotation : LPSTR* out -> (ptr string) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcns4 (t "RPCNS4.dll"))
(cffi:use-foreign-library rpcns4)

(cffi:defcfun ("RpcNsProfileEltInqNextA" rpc-ns-profile-elt-inq-next-a :convention :stdcall) :int32
  (inquiry-context :pointer)   ; void*
  (if-id :pointer)   ; RPC_IF_ID* optional, out
  (member-name :pointer)   ; LPSTR* out
  (priority :pointer)   ; DWORD* out
  (annotation :pointer))   ; LPSTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcNsProfileEltInqNextA = Win32::API::More->new('RPCNS4',
    'int RpcNsProfileEltInqNextA(LPVOID InquiryContext, LPVOID IfId, LPVOID MemberName, LPVOID Priority, LPVOID Annotation)');
# my $ret = $RpcNsProfileEltInqNextA->Call($InquiryContext, $IfId, $MemberName, $Priority, $Annotation);
# InquiryContext : void* -> LPVOID
# IfId : RPC_IF_ID* optional, out -> LPVOID
# MemberName : LPSTR* out -> LPVOID
# Priority : DWORD* out -> LPVOID
# Annotation : LPSTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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