Win32 API 日本語リファレンス
ホームDevices.PortableDevices › DMProcessConfigXMLFiltered

DMProcessConfigXMLFiltered

関数
許可ノードに限定してデバイス管理構成XMLを処理する。
DLLDMProcessXMLFiltered.dll呼出規約winapi

シグネチャ

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

HRESULT DMProcessConfigXMLFiltered(
    LPCWSTR pszXmlIn,
    LPCWSTR* rgszAllowedCspNodes,
    DWORD dwNumAllowedCspNodes,
    LPWSTR* pbstrXmlOut
);

パラメーター

名前方向説明
pszXmlInLPCWSTRin処理対象の設定XMLを格納したNULL終端ワイド文字列へのポインタ。
rgszAllowedCspNodesLPCWSTR*in許可するCSPノード名の文字列配列へのポインタ。許可リストとして機能する。
dwNumAllowedCspNodesDWORDinrgszAllowedCspNodes配列の要素数を指定する。
pbstrXmlOutLPWSTR*out処理結果XMLを受け取るBSTRへのポインタ。呼び出し側が解放する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DMProcessConfigXMLFiltered(
    LPCWSTR pszXmlIn,
    LPCWSTR* rgszAllowedCspNodes,
    DWORD dwNumAllowedCspNodes,
    LPWSTR* pbstrXmlOut
);
[DllImport("DMProcessXMLFiltered.dll", ExactSpelling = true)]
static extern int DMProcessConfigXMLFiltered(
    [MarshalAs(UnmanagedType.LPWStr)] string pszXmlIn,   // LPCWSTR
    IntPtr rgszAllowedCspNodes,   // LPCWSTR*
    uint dwNumAllowedCspNodes,   // DWORD
    IntPtr pbstrXmlOut   // LPWSTR* out
);
<DllImport("DMProcessXMLFiltered.dll", ExactSpelling:=True)>
Public Shared Function DMProcessConfigXMLFiltered(
    <MarshalAs(UnmanagedType.LPWStr)> pszXmlIn As String,   ' LPCWSTR
    rgszAllowedCspNodes As IntPtr,   ' LPCWSTR*
    dwNumAllowedCspNodes As UInteger,   ' DWORD
    pbstrXmlOut As IntPtr   ' LPWSTR* out
) As Integer
End Function
' pszXmlIn : LPCWSTR
' rgszAllowedCspNodes : LPCWSTR*
' dwNumAllowedCspNodes : DWORD
' pbstrXmlOut : LPWSTR* out
Declare PtrSafe Function DMProcessConfigXMLFiltered Lib "dmprocessxmlfiltered" ( _
    ByVal pszXmlIn As LongPtr, _
    ByVal rgszAllowedCspNodes As LongPtr, _
    ByVal dwNumAllowedCspNodes As Long, _
    ByVal pbstrXmlOut As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DMProcessConfigXMLFiltered = ctypes.windll.dmprocessxmlfiltered.DMProcessConfigXMLFiltered
DMProcessConfigXMLFiltered.restype = ctypes.c_int
DMProcessConfigXMLFiltered.argtypes = [
    wintypes.LPCWSTR,  # pszXmlIn : LPCWSTR
    ctypes.c_void_p,  # rgszAllowedCspNodes : LPCWSTR*
    wintypes.DWORD,  # dwNumAllowedCspNodes : DWORD
    ctypes.c_void_p,  # pbstrXmlOut : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DMProcessXMLFiltered.dll')
DMProcessConfigXMLFiltered = Fiddle::Function.new(
  lib['DMProcessConfigXMLFiltered'],
  [
    Fiddle::TYPE_VOIDP,  # pszXmlIn : LPCWSTR
    Fiddle::TYPE_VOIDP,  # rgszAllowedCspNodes : LPCWSTR*
    -Fiddle::TYPE_INT,  # dwNumAllowedCspNodes : DWORD
    Fiddle::TYPE_VOIDP,  # pbstrXmlOut : LPWSTR* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dmprocessxmlfiltered")]
extern "system" {
    fn DMProcessConfigXMLFiltered(
        pszXmlIn: *const u16,  // LPCWSTR
        rgszAllowedCspNodes: *const *const u16,  // LPCWSTR*
        dwNumAllowedCspNodes: u32,  // DWORD
        pbstrXmlOut: *mut *mut u16  // LPWSTR* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DMProcessXMLFiltered.dll")]
public static extern int DMProcessConfigXMLFiltered([MarshalAs(UnmanagedType.LPWStr)] string pszXmlIn, IntPtr rgszAllowedCspNodes, uint dwNumAllowedCspNodes, IntPtr pbstrXmlOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DMProcessXMLFiltered_DMProcessConfigXMLFiltered' -Namespace Win32 -PassThru
# $api::DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
#uselib "DMProcessXMLFiltered.dll"
#func global DMProcessConfigXMLFiltered "DMProcessConfigXMLFiltered" sptr, sptr, sptr, sptr
; DMProcessConfigXMLFiltered pszXmlIn, varptr(rgszAllowedCspNodes), dwNumAllowedCspNodes, varptr(pbstrXmlOut)   ; 戻り値は stat
; pszXmlIn : LPCWSTR -> "sptr"
; rgszAllowedCspNodes : LPCWSTR* -> "sptr"
; dwNumAllowedCspNodes : DWORD -> "sptr"
; pbstrXmlOut : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DMProcessXMLFiltered.dll"
#cfunc global DMProcessConfigXMLFiltered "DMProcessConfigXMLFiltered" wstr, var, int, var
; res = DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
; pszXmlIn : LPCWSTR -> "wstr"
; rgszAllowedCspNodes : LPCWSTR* -> "var"
; dwNumAllowedCspNodes : DWORD -> "int"
; pbstrXmlOut : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT DMProcessConfigXMLFiltered(LPCWSTR pszXmlIn, LPCWSTR* rgszAllowedCspNodes, DWORD dwNumAllowedCspNodes, LPWSTR* pbstrXmlOut)
#uselib "DMProcessXMLFiltered.dll"
#cfunc global DMProcessConfigXMLFiltered "DMProcessConfigXMLFiltered" wstr, var, int, var
; res = DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
; pszXmlIn : LPCWSTR -> "wstr"
; rgszAllowedCspNodes : LPCWSTR* -> "var"
; dwNumAllowedCspNodes : DWORD -> "int"
; pbstrXmlOut : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dmprocessxmlfiltered = windows.NewLazySystemDLL("DMProcessXMLFiltered.dll")
	procDMProcessConfigXMLFiltered = dmprocessxmlfiltered.NewProc("DMProcessConfigXMLFiltered")
)

// pszXmlIn (LPCWSTR), rgszAllowedCspNodes (LPCWSTR*), dwNumAllowedCspNodes (DWORD), pbstrXmlOut (LPWSTR* out)
r1, _, err := procDMProcessConfigXMLFiltered.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszXmlIn))),
	uintptr(rgszAllowedCspNodes),
	uintptr(dwNumAllowedCspNodes),
	uintptr(pbstrXmlOut),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DMProcessConfigXMLFiltered(
  pszXmlIn: PWideChar;   // LPCWSTR
  rgszAllowedCspNodes: PPWideChar;   // LPCWSTR*
  dwNumAllowedCspNodes: DWORD;   // DWORD
  pbstrXmlOut: PPWideChar   // LPWSTR* out
): Integer; stdcall;
  external 'DMProcessXMLFiltered.dll' name 'DMProcessConfigXMLFiltered';
result := DllCall("DMProcessXMLFiltered\DMProcessConfigXMLFiltered"
    , "WStr", pszXmlIn   ; LPCWSTR
    , "Ptr", rgszAllowedCspNodes   ; LPCWSTR*
    , "UInt", dwNumAllowedCspNodes   ; DWORD
    , "Ptr", pbstrXmlOut   ; LPWSTR* out
    , "Int")   ; return: HRESULT
●DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut) = DLL("DMProcessXMLFiltered.dll", "int DMProcessConfigXMLFiltered(char*, void*, dword, void*)")
# 呼び出し: DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
# pszXmlIn : LPCWSTR -> "char*"
# rgszAllowedCspNodes : LPCWSTR* -> "void*"
# dwNumAllowedCspNodes : DWORD -> "dword"
# pbstrXmlOut : LPWSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "dmprocessxmlfiltered" fn DMProcessConfigXMLFiltered(
    pszXmlIn: [*c]const u16, // LPCWSTR
    rgszAllowedCspNodes: [*c][*c]u16, // LPCWSTR*
    dwNumAllowedCspNodes: u32, // DWORD
    pbstrXmlOut: [*c][*c]u16 // LPWSTR* out
) callconv(std.os.windows.WINAPI) i32;
proc DMProcessConfigXMLFiltered(
    pszXmlIn: WideCString,  # LPCWSTR
    rgszAllowedCspNodes: ptr WideCString,  # LPCWSTR*
    dwNumAllowedCspNodes: uint32,  # DWORD
    pbstrXmlOut: ptr WideCString  # LPWSTR* out
): int32 {.importc: "DMProcessConfigXMLFiltered", stdcall, dynlib: "DMProcessXMLFiltered.dll".}
pragma(lib, "dmprocessxmlfiltered");
extern(Windows)
int DMProcessConfigXMLFiltered(
    const(wchar)* pszXmlIn,   // LPCWSTR
    wchar** rgszAllowedCspNodes,   // LPCWSTR*
    uint dwNumAllowedCspNodes,   // DWORD
    wchar** pbstrXmlOut   // LPWSTR* out
);
ccall((:DMProcessConfigXMLFiltered, "DMProcessXMLFiltered.dll"), stdcall, Int32,
      (Cwstring, Ptr{Ptr{UInt16}}, UInt32, Ptr{Ptr{UInt16}}),
      pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
# pszXmlIn : LPCWSTR -> Cwstring
# rgszAllowedCspNodes : LPCWSTR* -> Ptr{Ptr{UInt16}}
# dwNumAllowedCspNodes : DWORD -> UInt32
# pbstrXmlOut : LPWSTR* out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DMProcessConfigXMLFiltered(
    const uint16_t* pszXmlIn,
    uint16_t** rgszAllowedCspNodes,
    uint32_t dwNumAllowedCspNodes,
    uint16_t** pbstrXmlOut);
]]
local dmprocessxmlfiltered = ffi.load("dmprocessxmlfiltered")
-- dmprocessxmlfiltered.DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
-- pszXmlIn : LPCWSTR
-- rgszAllowedCspNodes : LPCWSTR*
-- dwNumAllowedCspNodes : DWORD
-- pbstrXmlOut : LPWSTR* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('DMProcessXMLFiltered.dll');
const DMProcessConfigXMLFiltered = lib.func('__stdcall', 'DMProcessConfigXMLFiltered', 'int32_t', ['str16', 'void *', 'uint32_t', 'void *']);
// DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
// pszXmlIn : LPCWSTR -> 'str16'
// rgszAllowedCspNodes : LPCWSTR* -> 'void *'
// dwNumAllowedCspNodes : DWORD -> 'uint32_t'
// pbstrXmlOut : LPWSTR* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("DMProcessXMLFiltered.dll", {
  DMProcessConfigXMLFiltered: { parameters: ["buffer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut)
// pszXmlIn : LPCWSTR -> "buffer"
// rgszAllowedCspNodes : LPCWSTR* -> "pointer"
// dwNumAllowedCspNodes : DWORD -> "u32"
// pbstrXmlOut : LPWSTR* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DMProcessConfigXMLFiltered(
    const uint16_t* pszXmlIn,
    uint16_t** rgszAllowedCspNodes,
    uint32_t dwNumAllowedCspNodes,
    uint16_t** pbstrXmlOut);
C, "DMProcessXMLFiltered.dll");
// $ffi->DMProcessConfigXMLFiltered(pszXmlIn, rgszAllowedCspNodes, dwNumAllowedCspNodes, pbstrXmlOut);
// pszXmlIn : LPCWSTR
// rgszAllowedCspNodes : LPCWSTR*
// dwNumAllowedCspNodes : DWORD
// pbstrXmlOut : LPWSTR* 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 Dmprocessxmlfiltered extends StdCallLibrary {
    Dmprocessxmlfiltered INSTANCE = Native.load("dmprocessxmlfiltered", Dmprocessxmlfiltered.class);
    int DMProcessConfigXMLFiltered(
        WString pszXmlIn,   // LPCWSTR
        PointerByReference rgszAllowedCspNodes,   // LPCWSTR*
        int dwNumAllowedCspNodes,   // DWORD
        PointerByReference pbstrXmlOut   // LPWSTR* out
    );
}
@[Link("dmprocessxmlfiltered")]
lib LibDMProcessXMLFiltered
  fun DMProcessConfigXMLFiltered = DMProcessConfigXMLFiltered(
    pszXmlIn : UInt16*,   # LPCWSTR
    rgszAllowedCspNodes : UInt16**,   # LPCWSTR*
    dwNumAllowedCspNodes : UInt32,   # DWORD
    pbstrXmlOut : UInt16**   # LPWSTR* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DMProcessConfigXMLFilteredNative = Int32 Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>, Uint32, Pointer<Pointer<Utf16>>);
typedef DMProcessConfigXMLFilteredDart = int Function(Pointer<Utf16>, Pointer<Pointer<Utf16>>, int, Pointer<Pointer<Utf16>>);
final DMProcessConfigXMLFiltered = DynamicLibrary.open('DMProcessXMLFiltered.dll')
    .lookupFunction<DMProcessConfigXMLFilteredNative, DMProcessConfigXMLFilteredDart>('DMProcessConfigXMLFiltered');
// pszXmlIn : LPCWSTR -> Pointer<Utf16>
// rgszAllowedCspNodes : LPCWSTR* -> Pointer<Pointer<Utf16>>
// dwNumAllowedCspNodes : DWORD -> Uint32
// pbstrXmlOut : LPWSTR* out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DMProcessConfigXMLFiltered(
  pszXmlIn: PWideChar;   // LPCWSTR
  rgszAllowedCspNodes: PPWideChar;   // LPCWSTR*
  dwNumAllowedCspNodes: DWORD;   // DWORD
  pbstrXmlOut: PPWideChar   // LPWSTR* out
): Integer; stdcall;
  external 'DMProcessXMLFiltered.dll' name 'DMProcessConfigXMLFiltered';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DMProcessConfigXMLFiltered"
  c_DMProcessConfigXMLFiltered :: CWString -> Ptr CWString -> Word32 -> Ptr CWString -> IO Int32
-- pszXmlIn : LPCWSTR -> CWString
-- rgszAllowedCspNodes : LPCWSTR* -> Ptr CWString
-- dwNumAllowedCspNodes : DWORD -> Word32
-- pbstrXmlOut : LPWSTR* out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let dmprocessconfigxmlfiltered =
  foreign "DMProcessConfigXMLFiltered"
    ((ptr uint16_t) @-> (ptr (ptr uint16_t)) @-> uint32_t @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* pszXmlIn : LPCWSTR -> (ptr uint16_t) *)
(* rgszAllowedCspNodes : LPCWSTR* -> (ptr (ptr uint16_t)) *)
(* dwNumAllowedCspNodes : DWORD -> uint32_t *)
(* pbstrXmlOut : LPWSTR* out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dmprocessxmlfiltered (t "DMProcessXMLFiltered.dll"))
(cffi:use-foreign-library dmprocessxmlfiltered)

(cffi:defcfun ("DMProcessConfigXMLFiltered" dmprocess-config-xmlfiltered :convention :stdcall) :int32
  (psz-xml-in (:string :encoding :utf-16le))   ; LPCWSTR
  (rgsz-allowed-csp-nodes :pointer)   ; LPCWSTR*
  (dw-num-allowed-csp-nodes :uint32)   ; DWORD
  (pbstr-xml-out :pointer))   ; LPWSTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DMProcessConfigXMLFiltered = Win32::API::More->new('DMProcessXMLFiltered',
    'int DMProcessConfigXMLFiltered(LPCWSTR pszXmlIn, LPVOID rgszAllowedCspNodes, DWORD dwNumAllowedCspNodes, LPVOID pbstrXmlOut)');
# my $ret = $DMProcessConfigXMLFiltered->Call($pszXmlIn, $rgszAllowedCspNodes, $dwNumAllowedCspNodes, $pbstrXmlOut);
# pszXmlIn : LPCWSTR -> LPCWSTR
# rgszAllowedCspNodes : LPCWSTR* -> LPVOID
# dwNumAllowedCspNodes : DWORD -> DWORD
# pbstrXmlOut : LPWSTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。