ホーム › System.DeploymentServices › PxeProviderRegister
PxeProviderRegister
関数WDS PXEプロバイダーをサーバーに登録する。
シグネチャ
// WDSPXE.dll
#include <windows.h>
DWORD PxeProviderRegister(
LPCWSTR pszProviderName,
LPCWSTR pszModulePath,
DWORD Index,
BOOL bIsCritical,
HKEY* phProviderKey // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pszProviderName | LPCWSTR | in | 登録するPXEプロバイダーの名前。 |
| pszModulePath | LPCWSTR | in | プロバイダーDLLのファイルパス。 |
| Index | DWORD | in | プロバイダーの呼び出し順序を決める優先インデックス。 |
| bIsCritical | BOOL | in | TRUEなら本プロバイダーの読み込み失敗時にサーバー起動を中止する重要扱いとする。 |
| phProviderKey | HKEY* | outoptional | プロバイダー設定用に開かれたレジストリキーハンドルを受け取るポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// WDSPXE.dll
#include <windows.h>
DWORD PxeProviderRegister(
LPCWSTR pszProviderName,
LPCWSTR pszModulePath,
DWORD Index,
BOOL bIsCritical,
HKEY* phProviderKey // optional
);[DllImport("WDSPXE.dll", ExactSpelling = true)]
static extern uint PxeProviderRegister(
[MarshalAs(UnmanagedType.LPWStr)] string pszProviderName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pszModulePath, // LPCWSTR
uint Index, // DWORD
bool bIsCritical, // BOOL
IntPtr phProviderKey // HKEY* optional, out
);<DllImport("WDSPXE.dll", ExactSpelling:=True)>
Public Shared Function PxeProviderRegister(
<MarshalAs(UnmanagedType.LPWStr)> pszProviderName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pszModulePath As String, ' LPCWSTR
Index As UInteger, ' DWORD
bIsCritical As Boolean, ' BOOL
phProviderKey As IntPtr ' HKEY* optional, out
) As UInteger
End Function' pszProviderName : LPCWSTR
' pszModulePath : LPCWSTR
' Index : DWORD
' bIsCritical : BOOL
' phProviderKey : HKEY* optional, out
Declare PtrSafe Function PxeProviderRegister Lib "wdspxe" ( _
ByVal pszProviderName As LongPtr, _
ByVal pszModulePath As LongPtr, _
ByVal Index As Long, _
ByVal bIsCritical As Long, _
ByVal phProviderKey As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PxeProviderRegister = ctypes.windll.wdspxe.PxeProviderRegister
PxeProviderRegister.restype = wintypes.DWORD
PxeProviderRegister.argtypes = [
wintypes.LPCWSTR, # pszProviderName : LPCWSTR
wintypes.LPCWSTR, # pszModulePath : LPCWSTR
wintypes.DWORD, # Index : DWORD
wintypes.BOOL, # bIsCritical : BOOL
ctypes.c_void_p, # phProviderKey : HKEY* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WDSPXE.dll')
PxeProviderRegister = Fiddle::Function.new(
lib['PxeProviderRegister'],
[
Fiddle::TYPE_VOIDP, # pszProviderName : LPCWSTR
Fiddle::TYPE_VOIDP, # pszModulePath : LPCWSTR
-Fiddle::TYPE_INT, # Index : DWORD
Fiddle::TYPE_INT, # bIsCritical : BOOL
Fiddle::TYPE_VOIDP, # phProviderKey : HKEY* optional, out
],
-Fiddle::TYPE_INT)#[link(name = "wdspxe")]
extern "system" {
fn PxeProviderRegister(
pszProviderName: *const u16, // LPCWSTR
pszModulePath: *const u16, // LPCWSTR
Index: u32, // DWORD
bIsCritical: i32, // BOOL
phProviderKey: *mut *mut core::ffi::c_void // HKEY* optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WDSPXE.dll")]
public static extern uint PxeProviderRegister([MarshalAs(UnmanagedType.LPWStr)] string pszProviderName, [MarshalAs(UnmanagedType.LPWStr)] string pszModulePath, uint Index, bool bIsCritical, IntPtr phProviderKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSPXE_PxeProviderRegister' -Namespace Win32 -PassThru
# $api::PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)#uselib "WDSPXE.dll"
#func global PxeProviderRegister "PxeProviderRegister" sptr, sptr, sptr, sptr, sptr
; PxeProviderRegister pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey ; 戻り値は stat
; pszProviderName : LPCWSTR -> "sptr"
; pszModulePath : LPCWSTR -> "sptr"
; Index : DWORD -> "sptr"
; bIsCritical : BOOL -> "sptr"
; phProviderKey : HKEY* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WDSPXE.dll"
#cfunc global PxeProviderRegister "PxeProviderRegister" wstr, wstr, int, int, sptr
; res = PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
; pszProviderName : LPCWSTR -> "wstr"
; pszModulePath : LPCWSTR -> "wstr"
; Index : DWORD -> "int"
; bIsCritical : BOOL -> "int"
; phProviderKey : HKEY* optional, out -> "sptr"; DWORD PxeProviderRegister(LPCWSTR pszProviderName, LPCWSTR pszModulePath, DWORD Index, BOOL bIsCritical, HKEY* phProviderKey)
#uselib "WDSPXE.dll"
#cfunc global PxeProviderRegister "PxeProviderRegister" wstr, wstr, int, int, intptr
; res = PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
; pszProviderName : LPCWSTR -> "wstr"
; pszModulePath : LPCWSTR -> "wstr"
; Index : DWORD -> "int"
; bIsCritical : BOOL -> "int"
; phProviderKey : HKEY* optional, out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
procPxeProviderRegister = wdspxe.NewProc("PxeProviderRegister")
)
// pszProviderName (LPCWSTR), pszModulePath (LPCWSTR), Index (DWORD), bIsCritical (BOOL), phProviderKey (HKEY* optional, out)
r1, _, err := procPxeProviderRegister.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszProviderName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszModulePath))),
uintptr(Index),
uintptr(bIsCritical),
uintptr(phProviderKey),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PxeProviderRegister(
pszProviderName: PWideChar; // LPCWSTR
pszModulePath: PWideChar; // LPCWSTR
Index: DWORD; // DWORD
bIsCritical: BOOL; // BOOL
phProviderKey: Pointer // HKEY* optional, out
): DWORD; stdcall;
external 'WDSPXE.dll' name 'PxeProviderRegister';result := DllCall("WDSPXE\PxeProviderRegister"
, "WStr", pszProviderName ; LPCWSTR
, "WStr", pszModulePath ; LPCWSTR
, "UInt", Index ; DWORD
, "Int", bIsCritical ; BOOL
, "Ptr", phProviderKey ; HKEY* optional, out
, "UInt") ; return: DWORD●PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey) = DLL("WDSPXE.dll", "dword PxeProviderRegister(char*, char*, dword, bool, void*)")
# 呼び出し: PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
# pszProviderName : LPCWSTR -> "char*"
# pszModulePath : LPCWSTR -> "char*"
# Index : DWORD -> "dword"
# bIsCritical : BOOL -> "bool"
# phProviderKey : HKEY* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wdspxe" fn PxeProviderRegister(
pszProviderName: [*c]const u16, // LPCWSTR
pszModulePath: [*c]const u16, // LPCWSTR
Index: u32, // DWORD
bIsCritical: i32, // BOOL
phProviderKey: ?*anyopaque // HKEY* optional, out
) callconv(std.os.windows.WINAPI) u32;proc PxeProviderRegister(
pszProviderName: WideCString, # LPCWSTR
pszModulePath: WideCString, # LPCWSTR
Index: uint32, # DWORD
bIsCritical: int32, # BOOL
phProviderKey: pointer # HKEY* optional, out
): uint32 {.importc: "PxeProviderRegister", stdcall, dynlib: "WDSPXE.dll".}pragma(lib, "wdspxe");
extern(Windows)
uint PxeProviderRegister(
const(wchar)* pszProviderName, // LPCWSTR
const(wchar)* pszModulePath, // LPCWSTR
uint Index, // DWORD
int bIsCritical, // BOOL
void* phProviderKey // HKEY* optional, out
);ccall((:PxeProviderRegister, "WDSPXE.dll"), stdcall, UInt32,
(Cwstring, Cwstring, UInt32, Int32, Ptr{Cvoid}),
pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
# pszProviderName : LPCWSTR -> Cwstring
# pszModulePath : LPCWSTR -> Cwstring
# Index : DWORD -> UInt32
# bIsCritical : BOOL -> Int32
# phProviderKey : HKEY* optional, out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t PxeProviderRegister(
const uint16_t* pszProviderName,
const uint16_t* pszModulePath,
uint32_t Index,
int32_t bIsCritical,
void* phProviderKey);
]]
local wdspxe = ffi.load("wdspxe")
-- wdspxe.PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
-- pszProviderName : LPCWSTR
-- pszModulePath : LPCWSTR
-- Index : DWORD
-- bIsCritical : BOOL
-- phProviderKey : HKEY* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WDSPXE.dll');
const PxeProviderRegister = lib.func('__stdcall', 'PxeProviderRegister', 'uint32_t', ['str16', 'str16', 'uint32_t', 'int32_t', 'void *']);
// PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
// pszProviderName : LPCWSTR -> 'str16'
// pszModulePath : LPCWSTR -> 'str16'
// Index : DWORD -> 'uint32_t'
// bIsCritical : BOOL -> 'int32_t'
// phProviderKey : HKEY* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WDSPXE.dll", {
PxeProviderRegister: { parameters: ["buffer", "buffer", "u32", "i32", "pointer"], result: "u32" },
});
// lib.symbols.PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey)
// pszProviderName : LPCWSTR -> "buffer"
// pszModulePath : LPCWSTR -> "buffer"
// Index : DWORD -> "u32"
// bIsCritical : BOOL -> "i32"
// phProviderKey : HKEY* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t PxeProviderRegister(
const uint16_t* pszProviderName,
const uint16_t* pszModulePath,
uint32_t Index,
int32_t bIsCritical,
void* phProviderKey);
C, "WDSPXE.dll");
// $ffi->PxeProviderRegister(pszProviderName, pszModulePath, Index, bIsCritical, phProviderKey);
// pszProviderName : LPCWSTR
// pszModulePath : LPCWSTR
// Index : DWORD
// bIsCritical : BOOL
// phProviderKey : HKEY* optional, 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 Wdspxe extends StdCallLibrary {
Wdspxe INSTANCE = Native.load("wdspxe", Wdspxe.class);
int PxeProviderRegister(
WString pszProviderName, // LPCWSTR
WString pszModulePath, // LPCWSTR
int Index, // DWORD
boolean bIsCritical, // BOOL
Pointer phProviderKey // HKEY* optional, out
);
}@[Link("wdspxe")]
lib LibWDSPXE
fun PxeProviderRegister = PxeProviderRegister(
pszProviderName : UInt16*, # LPCWSTR
pszModulePath : UInt16*, # LPCWSTR
Index : UInt32, # DWORD
bIsCritical : Int32, # BOOL
phProviderKey : Void* # HKEY* optional, out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef PxeProviderRegisterNative = Uint32 Function(Pointer<Utf16>, Pointer<Utf16>, Uint32, Int32, Pointer<Void>);
typedef PxeProviderRegisterDart = int Function(Pointer<Utf16>, Pointer<Utf16>, int, int, Pointer<Void>);
final PxeProviderRegister = DynamicLibrary.open('WDSPXE.dll')
.lookupFunction<PxeProviderRegisterNative, PxeProviderRegisterDart>('PxeProviderRegister');
// pszProviderName : LPCWSTR -> Pointer<Utf16>
// pszModulePath : LPCWSTR -> Pointer<Utf16>
// Index : DWORD -> Uint32
// bIsCritical : BOOL -> Int32
// phProviderKey : HKEY* optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function PxeProviderRegister(
pszProviderName: PWideChar; // LPCWSTR
pszModulePath: PWideChar; // LPCWSTR
Index: DWORD; // DWORD
bIsCritical: BOOL; // BOOL
phProviderKey: Pointer // HKEY* optional, out
): DWORD; stdcall;
external 'WDSPXE.dll' name 'PxeProviderRegister';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "PxeProviderRegister"
c_PxeProviderRegister :: CWString -> CWString -> Word32 -> CInt -> Ptr () -> IO Word32
-- pszProviderName : LPCWSTR -> CWString
-- pszModulePath : LPCWSTR -> CWString
-- Index : DWORD -> Word32
-- bIsCritical : BOOL -> CInt
-- phProviderKey : HKEY* optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let pxeproviderregister =
foreign "PxeProviderRegister"
((ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> int32_t @-> (ptr void) @-> returning uint32_t)
(* pszProviderName : LPCWSTR -> (ptr uint16_t) *)
(* pszModulePath : LPCWSTR -> (ptr uint16_t) *)
(* Index : DWORD -> uint32_t *)
(* bIsCritical : BOOL -> int32_t *)
(* phProviderKey : HKEY* optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wdspxe (t "WDSPXE.dll"))
(cffi:use-foreign-library wdspxe)
(cffi:defcfun ("PxeProviderRegister" pxe-provider-register :convention :stdcall) :uint32
(psz-provider-name (:string :encoding :utf-16le)) ; LPCWSTR
(psz-module-path (:string :encoding :utf-16le)) ; LPCWSTR
(index :uint32) ; DWORD
(b-is-critical :int32) ; BOOL
(ph-provider-key :pointer)) ; HKEY* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $PxeProviderRegister = Win32::API::More->new('WDSPXE',
'DWORD PxeProviderRegister(LPCWSTR pszProviderName, LPCWSTR pszModulePath, DWORD Index, BOOL bIsCritical, HANDLE phProviderKey)');
# my $ret = $PxeProviderRegister->Call($pszProviderName, $pszModulePath, $Index, $bIsCritical, $phProviderKey);
# pszProviderName : LPCWSTR -> LPCWSTR
# pszModulePath : LPCWSTR -> LPCWSTR
# Index : DWORD -> DWORD
# bIsCritical : BOOL -> BOOL
# phProviderKey : HKEY* optional, out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。