ホーム › Devices.WebServicesOnDevices › WSDUriDecode
WSDUriDecode
関数URIエンコードされた文字列を元の文字列にデコードする。
シグネチャ
// wsdapi.dll
#include <windows.h>
HRESULT WSDUriDecode(
LPCWSTR source,
DWORD cchSource,
LPWSTR* destOut,
DWORD* cchDestOut // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| source | LPCWSTR | in |
| cchSource | DWORD | in |
| destOut | LPWSTR* | out |
| cchDestOut | DWORD* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// wsdapi.dll
#include <windows.h>
HRESULT WSDUriDecode(
LPCWSTR source,
DWORD cchSource,
LPWSTR* destOut,
DWORD* cchDestOut // optional
);[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDUriDecode(
[MarshalAs(UnmanagedType.LPWStr)] string source, // LPCWSTR
uint cchSource, // DWORD
IntPtr destOut, // LPWSTR* out
IntPtr cchDestOut // DWORD* optional, out
);<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDUriDecode(
<MarshalAs(UnmanagedType.LPWStr)> source As String, ' LPCWSTR
cchSource As UInteger, ' DWORD
destOut As IntPtr, ' LPWSTR* out
cchDestOut As IntPtr ' DWORD* optional, out
) As Integer
End Function' source : LPCWSTR
' cchSource : DWORD
' destOut : LPWSTR* out
' cchDestOut : DWORD* optional, out
Declare PtrSafe Function WSDUriDecode Lib "wsdapi" ( _
ByVal source As LongPtr, _
ByVal cchSource As Long, _
ByVal destOut As LongPtr, _
ByVal cchDestOut As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSDUriDecode = ctypes.windll.wsdapi.WSDUriDecode
WSDUriDecode.restype = ctypes.c_int
WSDUriDecode.argtypes = [
wintypes.LPCWSTR, # source : LPCWSTR
wintypes.DWORD, # cchSource : DWORD
ctypes.c_void_p, # destOut : LPWSTR* out
ctypes.POINTER(wintypes.DWORD), # cchDestOut : DWORD* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wsdapi.dll')
WSDUriDecode = Fiddle::Function.new(
lib['WSDUriDecode'],
[
Fiddle::TYPE_VOIDP, # source : LPCWSTR
-Fiddle::TYPE_INT, # cchSource : DWORD
Fiddle::TYPE_VOIDP, # destOut : LPWSTR* out
Fiddle::TYPE_VOIDP, # cchDestOut : DWORD* optional, out
],
Fiddle::TYPE_INT)#[link(name = "wsdapi")]
extern "system" {
fn WSDUriDecode(
source: *const u16, // LPCWSTR
cchSource: u32, // DWORD
destOut: *mut *mut u16, // LPWSTR* out
cchDestOut: *mut u32 // DWORD* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDUriDecode([MarshalAs(UnmanagedType.LPWStr)] string source, uint cchSource, IntPtr destOut, IntPtr cchDestOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDUriDecode' -Namespace Win32 -PassThru
# $api::WSDUriDecode(source, cchSource, destOut, cchDestOut)#uselib "wsdapi.dll"
#func global WSDUriDecode "WSDUriDecode" sptr, sptr, sptr, sptr
; WSDUriDecode source, cchSource, varptr(destOut), varptr(cchDestOut) ; 戻り値は stat
; source : LPCWSTR -> "sptr"
; cchSource : DWORD -> "sptr"
; destOut : LPWSTR* out -> "sptr"
; cchDestOut : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wsdapi.dll" #cfunc global WSDUriDecode "WSDUriDecode" wstr, int, var, var ; res = WSDUriDecode(source, cchSource, destOut, cchDestOut) ; source : LPCWSTR -> "wstr" ; cchSource : DWORD -> "int" ; destOut : LPWSTR* out -> "var" ; cchDestOut : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wsdapi.dll" #cfunc global WSDUriDecode "WSDUriDecode" wstr, int, sptr, sptr ; res = WSDUriDecode(source, cchSource, varptr(destOut), varptr(cchDestOut)) ; source : LPCWSTR -> "wstr" ; cchSource : DWORD -> "int" ; destOut : LPWSTR* out -> "sptr" ; cchDestOut : DWORD* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WSDUriDecode(LPCWSTR source, DWORD cchSource, LPWSTR* destOut, DWORD* cchDestOut) #uselib "wsdapi.dll" #cfunc global WSDUriDecode "WSDUriDecode" wstr, int, var, var ; res = WSDUriDecode(source, cchSource, destOut, cchDestOut) ; source : LPCWSTR -> "wstr" ; cchSource : DWORD -> "int" ; destOut : LPWSTR* out -> "var" ; cchDestOut : DWORD* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WSDUriDecode(LPCWSTR source, DWORD cchSource, LPWSTR* destOut, DWORD* cchDestOut) #uselib "wsdapi.dll" #cfunc global WSDUriDecode "WSDUriDecode" wstr, int, intptr, intptr ; res = WSDUriDecode(source, cchSource, varptr(destOut), varptr(cchDestOut)) ; source : LPCWSTR -> "wstr" ; cchSource : DWORD -> "int" ; destOut : LPWSTR* out -> "intptr" ; cchDestOut : DWORD* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
procWSDUriDecode = wsdapi.NewProc("WSDUriDecode")
)
// source (LPCWSTR), cchSource (DWORD), destOut (LPWSTR* out), cchDestOut (DWORD* optional, out)
r1, _, err := procWSDUriDecode.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(source))),
uintptr(cchSource),
uintptr(destOut),
uintptr(cchDestOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WSDUriDecode(
source: PWideChar; // LPCWSTR
cchSource: DWORD; // DWORD
destOut: PPWideChar; // LPWSTR* out
cchDestOut: Pointer // DWORD* optional, out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDUriDecode';result := DllCall("wsdapi\WSDUriDecode"
, "WStr", source ; LPCWSTR
, "UInt", cchSource ; DWORD
, "Ptr", destOut ; LPWSTR* out
, "Ptr", cchDestOut ; DWORD* optional, out
, "Int") ; return: HRESULT●WSDUriDecode(source, cchSource, destOut, cchDestOut) = DLL("wsdapi.dll", "int WSDUriDecode(char*, dword, void*, void*)")
# 呼び出し: WSDUriDecode(source, cchSource, destOut, cchDestOut)
# source : LPCWSTR -> "char*"
# cchSource : DWORD -> "dword"
# destOut : LPWSTR* out -> "void*"
# cchDestOut : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。