ホーム › System.Com › CreateUriWithFragment
CreateUriWithFragment
関数フラグメントを付加したURIからIUriオブジェクトを作成する。
シグネチャ
// urlmon.dll
#include <windows.h>
HRESULT CreateUriWithFragment(
LPCWSTR pwzURI,
LPCWSTR pwzFragment, // optional
DWORD dwFlags,
UINT_PTR dwReserved, // optional
IUri** ppURI
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pwzURI | LPCWSTR | in | 解析対象のURI文字列。NULL終端のワイド文字列。 |
| pwzFragment | LPCWSTR | inoptional | URIに付加するフラグメント文字列。pwzURI自体にフラグメントが含まれていなければ使われる。NULL可。 |
| dwFlags | DWORD | in | URIの解析と正規化を制御するURI_CREATE_FLAGS値。 |
| dwReserved | UINT_PTR | optional | 予約済みパラメーター。0を指定する。 |
| ppURI | IUri** | out | 生成されたIUriインターフェイスを受け取る出力ポインター。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// urlmon.dll
#include <windows.h>
HRESULT CreateUriWithFragment(
LPCWSTR pwzURI,
LPCWSTR pwzFragment, // optional
DWORD dwFlags,
UINT_PTR dwReserved, // optional
IUri** ppURI
);[DllImport("urlmon.dll", ExactSpelling = true)]
static extern int CreateUriWithFragment(
[MarshalAs(UnmanagedType.LPWStr)] string pwzURI, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pwzFragment, // LPCWSTR optional
uint dwFlags, // DWORD
UIntPtr dwReserved, // UINT_PTR optional
IntPtr ppURI // IUri** out
);<DllImport("urlmon.dll", ExactSpelling:=True)>
Public Shared Function CreateUriWithFragment(
<MarshalAs(UnmanagedType.LPWStr)> pwzURI As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pwzFragment As String, ' LPCWSTR optional
dwFlags As UInteger, ' DWORD
dwReserved As UIntPtr, ' UINT_PTR optional
ppURI As IntPtr ' IUri** out
) As Integer
End Function' pwzURI : LPCWSTR
' pwzFragment : LPCWSTR optional
' dwFlags : DWORD
' dwReserved : UINT_PTR optional
' ppURI : IUri** out
Declare PtrSafe Function CreateUriWithFragment Lib "urlmon" ( _
ByVal pwzURI As LongPtr, _
ByVal pwzFragment As LongPtr, _
ByVal dwFlags As Long, _
ByVal dwReserved As LongPtr, _
ByVal ppURI As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateUriWithFragment = ctypes.windll.urlmon.CreateUriWithFragment
CreateUriWithFragment.restype = ctypes.c_int
CreateUriWithFragment.argtypes = [
wintypes.LPCWSTR, # pwzURI : LPCWSTR
wintypes.LPCWSTR, # pwzFragment : LPCWSTR optional
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_size_t, # dwReserved : UINT_PTR optional
ctypes.c_void_p, # ppURI : IUri** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('urlmon.dll')
CreateUriWithFragment = Fiddle::Function.new(
lib['CreateUriWithFragment'],
[
Fiddle::TYPE_VOIDP, # pwzURI : LPCWSTR
Fiddle::TYPE_VOIDP, # pwzFragment : LPCWSTR optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_UINTPTR_T, # dwReserved : UINT_PTR optional
Fiddle::TYPE_VOIDP, # ppURI : IUri** out
],
Fiddle::TYPE_INT)#[link(name = "urlmon")]
extern "system" {
fn CreateUriWithFragment(
pwzURI: *const u16, // LPCWSTR
pwzFragment: *const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
dwReserved: usize, // UINT_PTR optional
ppURI: *mut *mut core::ffi::c_void // IUri** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("urlmon.dll")]
public static extern int CreateUriWithFragment([MarshalAs(UnmanagedType.LPWStr)] string pwzURI, [MarshalAs(UnmanagedType.LPWStr)] string pwzFragment, uint dwFlags, UIntPtr dwReserved, IntPtr ppURI);
"@
$api = Add-Type -MemberDefinition $sig -Name 'urlmon_CreateUriWithFragment' -Namespace Win32 -PassThru
# $api::CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)#uselib "urlmon.dll"
#func global CreateUriWithFragment "CreateUriWithFragment" sptr, sptr, sptr, sptr, sptr
; CreateUriWithFragment pwzURI, pwzFragment, dwFlags, dwReserved, ppURI ; 戻り値は stat
; pwzURI : LPCWSTR -> "sptr"
; pwzFragment : LPCWSTR optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; dwReserved : UINT_PTR optional -> "sptr"
; ppURI : IUri** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "urlmon.dll"
#cfunc global CreateUriWithFragment "CreateUriWithFragment" wstr, wstr, int, sptr, sptr
; res = CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
; pwzURI : LPCWSTR -> "wstr"
; pwzFragment : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; dwReserved : UINT_PTR optional -> "sptr"
; ppURI : IUri** out -> "sptr"; HRESULT CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD dwFlags, UINT_PTR dwReserved, IUri** ppURI)
#uselib "urlmon.dll"
#cfunc global CreateUriWithFragment "CreateUriWithFragment" wstr, wstr, int, intptr, intptr
; res = CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
; pwzURI : LPCWSTR -> "wstr"
; pwzFragment : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; dwReserved : UINT_PTR optional -> "intptr"
; ppURI : IUri** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
urlmon = windows.NewLazySystemDLL("urlmon.dll")
procCreateUriWithFragment = urlmon.NewProc("CreateUriWithFragment")
)
// pwzURI (LPCWSTR), pwzFragment (LPCWSTR optional), dwFlags (DWORD), dwReserved (UINT_PTR optional), ppURI (IUri** out)
r1, _, err := procCreateUriWithFragment.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzURI))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzFragment))),
uintptr(dwFlags),
uintptr(dwReserved),
uintptr(ppURI),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CreateUriWithFragment(
pwzURI: PWideChar; // LPCWSTR
pwzFragment: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
dwReserved: NativeUInt; // UINT_PTR optional
ppURI: Pointer // IUri** out
): Integer; stdcall;
external 'urlmon.dll' name 'CreateUriWithFragment';result := DllCall("urlmon\CreateUriWithFragment"
, "WStr", pwzURI ; LPCWSTR
, "WStr", pwzFragment ; LPCWSTR optional
, "UInt", dwFlags ; DWORD
, "UPtr", dwReserved ; UINT_PTR optional
, "Ptr", ppURI ; IUri** out
, "Int") ; return: HRESULT●CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI) = DLL("urlmon.dll", "int CreateUriWithFragment(char*, char*, dword, int, void*)")
# 呼び出し: CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
# pwzURI : LPCWSTR -> "char*"
# pwzFragment : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# dwReserved : UINT_PTR optional -> "int"
# ppURI : IUri** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "urlmon" fn CreateUriWithFragment(
pwzURI: [*c]const u16, // LPCWSTR
pwzFragment: [*c]const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
dwReserved: usize, // UINT_PTR optional
ppURI: ?*anyopaque // IUri** out
) callconv(std.os.windows.WINAPI) i32;proc CreateUriWithFragment(
pwzURI: WideCString, # LPCWSTR
pwzFragment: WideCString, # LPCWSTR optional
dwFlags: uint32, # DWORD
dwReserved: uint, # UINT_PTR optional
ppURI: pointer # IUri** out
): int32 {.importc: "CreateUriWithFragment", stdcall, dynlib: "urlmon.dll".}pragma(lib, "urlmon");
extern(Windows)
int CreateUriWithFragment(
const(wchar)* pwzURI, // LPCWSTR
const(wchar)* pwzFragment, // LPCWSTR optional
uint dwFlags, // DWORD
size_t dwReserved, // UINT_PTR optional
void* ppURI // IUri** out
);ccall((:CreateUriWithFragment, "urlmon.dll"), stdcall, Int32,
(Cwstring, Cwstring, UInt32, Csize_t, Ptr{Cvoid}),
pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
# pwzURI : LPCWSTR -> Cwstring
# pwzFragment : LPCWSTR optional -> Cwstring
# dwFlags : DWORD -> UInt32
# dwReserved : UINT_PTR optional -> Csize_t
# ppURI : IUri** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CreateUriWithFragment(
const uint16_t* pwzURI,
const uint16_t* pwzFragment,
uint32_t dwFlags,
uintptr_t dwReserved,
void* ppURI);
]]
local urlmon = ffi.load("urlmon")
-- urlmon.CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
-- pwzURI : LPCWSTR
-- pwzFragment : LPCWSTR optional
-- dwFlags : DWORD
-- dwReserved : UINT_PTR optional
-- ppURI : IUri** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('urlmon.dll');
const CreateUriWithFragment = lib.func('__stdcall', 'CreateUriWithFragment', 'int32_t', ['str16', 'str16', 'uint32_t', 'uintptr_t', 'void *']);
// CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
// pwzURI : LPCWSTR -> 'str16'
// pwzFragment : LPCWSTR optional -> 'str16'
// dwFlags : DWORD -> 'uint32_t'
// dwReserved : UINT_PTR optional -> 'uintptr_t'
// ppURI : IUri** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("urlmon.dll", {
CreateUriWithFragment: { parameters: ["buffer", "buffer", "u32", "usize", "pointer"], result: "i32" },
});
// lib.symbols.CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
// pwzURI : LPCWSTR -> "buffer"
// pwzFragment : LPCWSTR optional -> "buffer"
// dwFlags : DWORD -> "u32"
// dwReserved : UINT_PTR optional -> "usize"
// ppURI : IUri** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CreateUriWithFragment(
const uint16_t* pwzURI,
const uint16_t* pwzFragment,
uint32_t dwFlags,
size_t dwReserved,
void* ppURI);
C, "urlmon.dll");
// $ffi->CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI);
// pwzURI : LPCWSTR
// pwzFragment : LPCWSTR optional
// dwFlags : DWORD
// dwReserved : UINT_PTR optional
// ppURI : IUri** 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 Urlmon extends StdCallLibrary {
Urlmon INSTANCE = Native.load("urlmon", Urlmon.class);
int CreateUriWithFragment(
WString pwzURI, // LPCWSTR
WString pwzFragment, // LPCWSTR optional
int dwFlags, // DWORD
long dwReserved, // UINT_PTR optional
Pointer ppURI // IUri** out
);
}@[Link("urlmon")]
lib Liburlmon
fun CreateUriWithFragment = CreateUriWithFragment(
pwzURI : UInt16*, # LPCWSTR
pwzFragment : UInt16*, # LPCWSTR optional
dwFlags : UInt32, # DWORD
dwReserved : LibC::SizeT, # UINT_PTR optional
ppURI : Void* # IUri** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreateUriWithFragmentNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Uint32, UintPtr, Pointer<Void>);
typedef CreateUriWithFragmentDart = int Function(Pointer<Utf16>, Pointer<Utf16>, int, int, Pointer<Void>);
final CreateUriWithFragment = DynamicLibrary.open('urlmon.dll')
.lookupFunction<CreateUriWithFragmentNative, CreateUriWithFragmentDart>('CreateUriWithFragment');
// pwzURI : LPCWSTR -> Pointer<Utf16>
// pwzFragment : LPCWSTR optional -> Pointer<Utf16>
// dwFlags : DWORD -> Uint32
// dwReserved : UINT_PTR optional -> UintPtr
// ppURI : IUri** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreateUriWithFragment(
pwzURI: PWideChar; // LPCWSTR
pwzFragment: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
dwReserved: NativeUInt; // UINT_PTR optional
ppURI: Pointer // IUri** out
): Integer; stdcall;
external 'urlmon.dll' name 'CreateUriWithFragment';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreateUriWithFragment"
c_CreateUriWithFragment :: CWString -> CWString -> Word32 -> CUIntPtr -> Ptr () -> IO Int32
-- pwzURI : LPCWSTR -> CWString
-- pwzFragment : LPCWSTR optional -> CWString
-- dwFlags : DWORD -> Word32
-- dwReserved : UINT_PTR optional -> CUIntPtr
-- ppURI : IUri** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createuriwithfragment =
foreign "CreateUriWithFragment"
((ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> size_t @-> (ptr void) @-> returning int32_t)
(* pwzURI : LPCWSTR -> (ptr uint16_t) *)
(* pwzFragment : LPCWSTR optional -> (ptr uint16_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* dwReserved : UINT_PTR optional -> size_t *)
(* ppURI : IUri** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library urlmon (t "urlmon.dll"))
(cffi:use-foreign-library urlmon)
(cffi:defcfun ("CreateUriWithFragment" create-uri-with-fragment :convention :stdcall) :int32
(pwz-uri (:string :encoding :utf-16le)) ; LPCWSTR
(pwz-fragment (:string :encoding :utf-16le)) ; LPCWSTR optional
(dw-flags :uint32) ; DWORD
(dw-reserved :uint64) ; UINT_PTR optional
(pp-uri :pointer)) ; IUri** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreateUriWithFragment = Win32::API::More->new('urlmon',
'int CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD dwFlags, WPARAM dwReserved, LPVOID ppURI)');
# my $ret = $CreateUriWithFragment->Call($pwzURI, $pwzFragment, $dwFlags, $dwReserved, $ppURI);
# pwzURI : LPCWSTR -> LPCWSTR
# pwzFragment : LPCWSTR optional -> LPCWSTR
# dwFlags : DWORD -> DWORD
# dwReserved : UINT_PTR optional -> WPARAM
# ppURI : IUri** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型