ホーム › Networking.ActiveDirectory › DsUnquoteRdnValueA
DsUnquoteRdnValueA
関数引用されたRDN値のエスケープを解除する(ANSI版)。
シグネチャ
// DSPARSE.dll (ANSI / -A)
#include <windows.h>
DWORD DsUnquoteRdnValueA(
DWORD cQuotedRdnValueLength,
LPCSTR psQuotedRdnValue,
DWORD* pcUnquotedRdnValueLength,
LPSTR psUnquotedRdnValue
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| cQuotedRdnValueLength | DWORD | in |
| psQuotedRdnValue | LPCSTR | in |
| pcUnquotedRdnValueLength | DWORD* | inout |
| psUnquotedRdnValue | LPSTR | out |
戻り値の型: DWORD
各言語での呼び出し定義
// DSPARSE.dll (ANSI / -A)
#include <windows.h>
DWORD DsUnquoteRdnValueA(
DWORD cQuotedRdnValueLength,
LPCSTR psQuotedRdnValue,
DWORD* pcUnquotedRdnValueLength,
LPSTR psUnquotedRdnValue
);[DllImport("DSPARSE.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint DsUnquoteRdnValueA(
uint cQuotedRdnValueLength, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string psQuotedRdnValue, // LPCSTR
ref uint pcUnquotedRdnValueLength, // DWORD* in/out
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder psUnquotedRdnValue // LPSTR out
);<DllImport("DSPARSE.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DsUnquoteRdnValueA(
cQuotedRdnValueLength As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> psQuotedRdnValue As String, ' LPCSTR
ByRef pcUnquotedRdnValueLength As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPStr)> psUnquotedRdnValue As System.Text.StringBuilder ' LPSTR out
) As UInteger
End Function' cQuotedRdnValueLength : DWORD
' psQuotedRdnValue : LPCSTR
' pcUnquotedRdnValueLength : DWORD* in/out
' psUnquotedRdnValue : LPSTR out
Declare PtrSafe Function DsUnquoteRdnValueA Lib "dsparse" ( _
ByVal cQuotedRdnValueLength As Long, _
ByVal psQuotedRdnValue As String, _
ByRef pcUnquotedRdnValueLength As Long, _
ByVal psUnquotedRdnValue As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DsUnquoteRdnValueA = ctypes.windll.dsparse.DsUnquoteRdnValueA
DsUnquoteRdnValueA.restype = wintypes.DWORD
DsUnquoteRdnValueA.argtypes = [
wintypes.DWORD, # cQuotedRdnValueLength : DWORD
wintypes.LPCSTR, # psQuotedRdnValue : LPCSTR
ctypes.POINTER(wintypes.DWORD), # pcUnquotedRdnValueLength : DWORD* in/out
wintypes.LPSTR, # psUnquotedRdnValue : LPSTR out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSPARSE.dll')
DsUnquoteRdnValueA = Fiddle::Function.new(
lib['DsUnquoteRdnValueA'],
[
-Fiddle::TYPE_INT, # cQuotedRdnValueLength : DWORD
Fiddle::TYPE_VOIDP, # psQuotedRdnValue : LPCSTR
Fiddle::TYPE_VOIDP, # pcUnquotedRdnValueLength : DWORD* in/out
Fiddle::TYPE_VOIDP, # psUnquotedRdnValue : LPSTR out
],
-Fiddle::TYPE_INT)#[link(name = "dsparse")]
extern "system" {
fn DsUnquoteRdnValueA(
cQuotedRdnValueLength: u32, // DWORD
psQuotedRdnValue: *const u8, // LPCSTR
pcUnquotedRdnValueLength: *mut u32, // DWORD* in/out
psUnquotedRdnValue: *mut u8 // LPSTR out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DSPARSE.dll", CharSet = CharSet.Ansi)]
public static extern uint DsUnquoteRdnValueA(uint cQuotedRdnValueLength, [MarshalAs(UnmanagedType.LPStr)] string psQuotedRdnValue, ref uint pcUnquotedRdnValueLength, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder psUnquotedRdnValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSPARSE_DsUnquoteRdnValueA' -Namespace Win32 -PassThru
# $api::DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, pcUnquotedRdnValueLength, psUnquotedRdnValue)#uselib "DSPARSE.dll"
#func global DsUnquoteRdnValueA "DsUnquoteRdnValueA" sptr, sptr, sptr, sptr
; DsUnquoteRdnValueA cQuotedRdnValueLength, psQuotedRdnValue, varptr(pcUnquotedRdnValueLength), varptr(psUnquotedRdnValue) ; 戻り値は stat
; cQuotedRdnValueLength : DWORD -> "sptr"
; psQuotedRdnValue : LPCSTR -> "sptr"
; pcUnquotedRdnValueLength : DWORD* in/out -> "sptr"
; psUnquotedRdnValue : LPSTR out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DSPARSE.dll" #cfunc global DsUnquoteRdnValueA "DsUnquoteRdnValueA" int, str, var, var ; res = DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, pcUnquotedRdnValueLength, psUnquotedRdnValue) ; cQuotedRdnValueLength : DWORD -> "int" ; psQuotedRdnValue : LPCSTR -> "str" ; pcUnquotedRdnValueLength : DWORD* in/out -> "var" ; psUnquotedRdnValue : LPSTR out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DSPARSE.dll" #cfunc global DsUnquoteRdnValueA "DsUnquoteRdnValueA" int, str, sptr, sptr ; res = DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, varptr(pcUnquotedRdnValueLength), varptr(psUnquotedRdnValue)) ; cQuotedRdnValueLength : DWORD -> "int" ; psQuotedRdnValue : LPCSTR -> "str" ; pcUnquotedRdnValueLength : DWORD* in/out -> "sptr" ; psUnquotedRdnValue : LPSTR out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DsUnquoteRdnValueA(DWORD cQuotedRdnValueLength, LPCSTR psQuotedRdnValue, DWORD* pcUnquotedRdnValueLength, LPSTR psUnquotedRdnValue) #uselib "DSPARSE.dll" #cfunc global DsUnquoteRdnValueA "DsUnquoteRdnValueA" int, str, var, var ; res = DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, pcUnquotedRdnValueLength, psUnquotedRdnValue) ; cQuotedRdnValueLength : DWORD -> "int" ; psQuotedRdnValue : LPCSTR -> "str" ; pcUnquotedRdnValueLength : DWORD* in/out -> "var" ; psUnquotedRdnValue : LPSTR out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DsUnquoteRdnValueA(DWORD cQuotedRdnValueLength, LPCSTR psQuotedRdnValue, DWORD* pcUnquotedRdnValueLength, LPSTR psUnquotedRdnValue) #uselib "DSPARSE.dll" #cfunc global DsUnquoteRdnValueA "DsUnquoteRdnValueA" int, str, intptr, intptr ; res = DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, varptr(pcUnquotedRdnValueLength), varptr(psUnquotedRdnValue)) ; cQuotedRdnValueLength : DWORD -> "int" ; psQuotedRdnValue : LPCSTR -> "str" ; pcUnquotedRdnValueLength : DWORD* in/out -> "intptr" ; psUnquotedRdnValue : LPSTR out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsparse = windows.NewLazySystemDLL("DSPARSE.dll")
procDsUnquoteRdnValueA = dsparse.NewProc("DsUnquoteRdnValueA")
)
// cQuotedRdnValueLength (DWORD), psQuotedRdnValue (LPCSTR), pcUnquotedRdnValueLength (DWORD* in/out), psUnquotedRdnValue (LPSTR out)
r1, _, err := procDsUnquoteRdnValueA.Call(
uintptr(cQuotedRdnValueLength),
uintptr(unsafe.Pointer(windows.BytePtrFromString(psQuotedRdnValue))),
uintptr(pcUnquotedRdnValueLength),
uintptr(psUnquotedRdnValue),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DsUnquoteRdnValueA(
cQuotedRdnValueLength: DWORD; // DWORD
psQuotedRdnValue: PAnsiChar; // LPCSTR
pcUnquotedRdnValueLength: Pointer; // DWORD* in/out
psUnquotedRdnValue: PAnsiChar // LPSTR out
): DWORD; stdcall;
external 'DSPARSE.dll' name 'DsUnquoteRdnValueA';result := DllCall("DSPARSE\DsUnquoteRdnValueA"
, "UInt", cQuotedRdnValueLength ; DWORD
, "AStr", psQuotedRdnValue ; LPCSTR
, "Ptr", pcUnquotedRdnValueLength ; DWORD* in/out
, "Ptr", psUnquotedRdnValue ; LPSTR out
, "UInt") ; return: DWORD●DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, pcUnquotedRdnValueLength, psUnquotedRdnValue) = DLL("DSPARSE.dll", "dword DsUnquoteRdnValueA(dword, char*, void*, char*)")
# 呼び出し: DsUnquoteRdnValueA(cQuotedRdnValueLength, psQuotedRdnValue, pcUnquotedRdnValueLength, psUnquotedRdnValue)
# cQuotedRdnValueLength : DWORD -> "dword"
# psQuotedRdnValue : LPCSTR -> "char*"
# pcUnquotedRdnValueLength : DWORD* in/out -> "void*"
# psUnquotedRdnValue : LPSTR out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。