Win32 API 日本語リファレンス
ホームNetworking.ActiveDirectory › DsGetRdnW

DsGetRdnW

関数
識別名の先頭RDNからキーと値を抽出する(Unicode版)。
DLLDSPARSE.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// DSPARSE.dll
#include <windows.h>

DWORD DsGetRdnW(
    LPWSTR* ppDN,
    DWORD* pcDN,
    LPWSTR* ppKey,
    DWORD* pcKey,
    LPWSTR* ppVal,
    DWORD* pcVal
);

パラメーター

名前方向
ppDNLPWSTR*inout
pcDNDWORD*inout
ppKeyLPWSTR*out
pcKeyDWORD*out
ppValLPWSTR*out
pcValDWORD*out

戻り値の型: DWORD

各言語での呼び出し定義

// DSPARSE.dll
#include <windows.h>

DWORD DsGetRdnW(
    LPWSTR* ppDN,
    DWORD* pcDN,
    LPWSTR* ppKey,
    DWORD* pcKey,
    LPWSTR* ppVal,
    DWORD* pcVal
);
[DllImport("DSPARSE.dll", ExactSpelling = true)]
static extern uint DsGetRdnW(
    IntPtr ppDN,   // LPWSTR* in/out
    ref uint pcDN,   // DWORD* in/out
    IntPtr ppKey,   // LPWSTR* out
    out uint pcKey,   // DWORD* out
    IntPtr ppVal,   // LPWSTR* out
    out uint pcVal   // DWORD* out
);
<DllImport("DSPARSE.dll", ExactSpelling:=True)>
Public Shared Function DsGetRdnW(
    ppDN As IntPtr,   ' LPWSTR* in/out
    ByRef pcDN As UInteger,   ' DWORD* in/out
    ppKey As IntPtr,   ' LPWSTR* out
    <Out> ByRef pcKey As UInteger,   ' DWORD* out
    ppVal As IntPtr,   ' LPWSTR* out
    <Out> ByRef pcVal As UInteger   ' DWORD* out
) As UInteger
End Function
' ppDN : LPWSTR* in/out
' pcDN : DWORD* in/out
' ppKey : LPWSTR* out
' pcKey : DWORD* out
' ppVal : LPWSTR* out
' pcVal : DWORD* out
Declare PtrSafe Function DsGetRdnW Lib "dsparse" ( _
    ByVal ppDN As LongPtr, _
    ByRef pcDN As Long, _
    ByVal ppKey As LongPtr, _
    ByRef pcKey As Long, _
    ByVal ppVal As LongPtr, _
    ByRef pcVal As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DsGetRdnW = ctypes.windll.dsparse.DsGetRdnW
DsGetRdnW.restype = wintypes.DWORD
DsGetRdnW.argtypes = [
    ctypes.c_void_p,  # ppDN : LPWSTR* in/out
    ctypes.POINTER(wintypes.DWORD),  # pcDN : DWORD* in/out
    ctypes.c_void_p,  # ppKey : LPWSTR* out
    ctypes.POINTER(wintypes.DWORD),  # pcKey : DWORD* out
    ctypes.c_void_p,  # ppVal : LPWSTR* out
    ctypes.POINTER(wintypes.DWORD),  # pcVal : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DSPARSE.dll')
DsGetRdnW = Fiddle::Function.new(
  lib['DsGetRdnW'],
  [
    Fiddle::TYPE_VOIDP,  # ppDN : LPWSTR* in/out
    Fiddle::TYPE_VOIDP,  # pcDN : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # ppKey : LPWSTR* out
    Fiddle::TYPE_VOIDP,  # pcKey : DWORD* out
    Fiddle::TYPE_VOIDP,  # ppVal : LPWSTR* out
    Fiddle::TYPE_VOIDP,  # pcVal : DWORD* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "dsparse")]
extern "system" {
    fn DsGetRdnW(
        ppDN: *mut *mut u16,  // LPWSTR* in/out
        pcDN: *mut u32,  // DWORD* in/out
        ppKey: *mut *mut u16,  // LPWSTR* out
        pcKey: *mut u32,  // DWORD* out
        ppVal: *mut *mut u16,  // LPWSTR* out
        pcVal: *mut u32  // DWORD* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DSPARSE.dll")]
public static extern uint DsGetRdnW(IntPtr ppDN, ref uint pcDN, IntPtr ppKey, out uint pcKey, IntPtr ppVal, out uint pcVal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSPARSE_DsGetRdnW' -Namespace Win32 -PassThru
# $api::DsGetRdnW(ppDN, pcDN, ppKey, pcKey, ppVal, pcVal)
#uselib "DSPARSE.dll"
#func global DsGetRdnW "DsGetRdnW" sptr, sptr, sptr, sptr, sptr, sptr
; DsGetRdnW varptr(ppDN), varptr(pcDN), varptr(ppKey), varptr(pcKey), varptr(ppVal), varptr(pcVal)   ; 戻り値は stat
; ppDN : LPWSTR* in/out -> "sptr"
; pcDN : DWORD* in/out -> "sptr"
; ppKey : LPWSTR* out -> "sptr"
; pcKey : DWORD* out -> "sptr"
; ppVal : LPWSTR* out -> "sptr"
; pcVal : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DSPARSE.dll"
#cfunc global DsGetRdnW "DsGetRdnW" var, var, var, var, var, var
; res = DsGetRdnW(ppDN, pcDN, ppKey, pcKey, ppVal, pcVal)
; ppDN : LPWSTR* in/out -> "var"
; pcDN : DWORD* in/out -> "var"
; ppKey : LPWSTR* out -> "var"
; pcKey : DWORD* out -> "var"
; ppVal : LPWSTR* out -> "var"
; pcVal : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD DsGetRdnW(LPWSTR* ppDN, DWORD* pcDN, LPWSTR* ppKey, DWORD* pcKey, LPWSTR* ppVal, DWORD* pcVal)
#uselib "DSPARSE.dll"
#cfunc global DsGetRdnW "DsGetRdnW" var, var, var, var, var, var
; res = DsGetRdnW(ppDN, pcDN, ppKey, pcKey, ppVal, pcVal)
; ppDN : LPWSTR* in/out -> "var"
; pcDN : DWORD* in/out -> "var"
; ppKey : LPWSTR* out -> "var"
; pcKey : DWORD* out -> "var"
; ppVal : LPWSTR* out -> "var"
; pcVal : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dsparse = windows.NewLazySystemDLL("DSPARSE.dll")
	procDsGetRdnW = dsparse.NewProc("DsGetRdnW")
)

// ppDN (LPWSTR* in/out), pcDN (DWORD* in/out), ppKey (LPWSTR* out), pcKey (DWORD* out), ppVal (LPWSTR* out), pcVal (DWORD* out)
r1, _, err := procDsGetRdnW.Call(
	uintptr(ppDN),
	uintptr(pcDN),
	uintptr(ppKey),
	uintptr(pcKey),
	uintptr(ppVal),
	uintptr(pcVal),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function DsGetRdnW(
  ppDN: PPWideChar;   // LPWSTR* in/out
  pcDN: Pointer;   // DWORD* in/out
  ppKey: PPWideChar;   // LPWSTR* out
  pcKey: Pointer;   // DWORD* out
  ppVal: PPWideChar;   // LPWSTR* out
  pcVal: Pointer   // DWORD* out
): DWORD; stdcall;
  external 'DSPARSE.dll' name 'DsGetRdnW';
result := DllCall("DSPARSE\DsGetRdnW"
    , "Ptr", ppDN   ; LPWSTR* in/out
    , "Ptr", pcDN   ; DWORD* in/out
    , "Ptr", ppKey   ; LPWSTR* out
    , "Ptr", pcKey   ; DWORD* out
    , "Ptr", ppVal   ; LPWSTR* out
    , "Ptr", pcVal   ; DWORD* out
    , "UInt")   ; return: DWORD
●DsGetRdnW(ppDN, pcDN, ppKey, pcKey, ppVal, pcVal) = DLL("DSPARSE.dll", "dword DsGetRdnW(void*, void*, void*, void*, void*, void*)")
# 呼び出し: DsGetRdnW(ppDN, pcDN, ppKey, pcKey, ppVal, pcVal)
# ppDN : LPWSTR* in/out -> "void*"
# pcDN : DWORD* in/out -> "void*"
# ppKey : LPWSTR* out -> "void*"
# pcKey : DWORD* out -> "void*"
# ppVal : LPWSTR* out -> "void*"
# pcVal : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。