ホーム › System.WinRT › CoDecodeProxy
CoDecodeProxy
関数クライアントのプロキシアドレスからサーバー情報を取得する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT CoDecodeProxy(
DWORD dwClientPid,
ULONGLONG ui64ProxyAddress,
ServerInformation* pServerInformation
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwClientPid | DWORD | in | プロキシを保有するクライアントプロセスのプロセスID。 |
| ui64ProxyAddress | ULONGLONG | in | デコード対象プロキシの64ビットメモリアドレス。 |
| pServerInformation | ServerInformation* | out | 出力としてサーバー情報を受け取るServerInformation構造体へのポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT CoDecodeProxy(
DWORD dwClientPid,
ULONGLONG ui64ProxyAddress,
ServerInformation* pServerInformation
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int CoDecodeProxy(
uint dwClientPid, // DWORD
ulong ui64ProxyAddress, // ULONGLONG
IntPtr pServerInformation // ServerInformation* out
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoDecodeProxy(
dwClientPid As UInteger, ' DWORD
ui64ProxyAddress As ULong, ' ULONGLONG
pServerInformation As IntPtr ' ServerInformation* out
) As Integer
End Function' dwClientPid : DWORD
' ui64ProxyAddress : ULONGLONG
' pServerInformation : ServerInformation* out
Declare PtrSafe Function CoDecodeProxy Lib "ole32" ( _
ByVal dwClientPid As Long, _
ByVal ui64ProxyAddress As LongLong, _
ByVal pServerInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoDecodeProxy = ctypes.windll.ole32.CoDecodeProxy
CoDecodeProxy.restype = ctypes.c_int
CoDecodeProxy.argtypes = [
wintypes.DWORD, # dwClientPid : DWORD
ctypes.c_ulonglong, # ui64ProxyAddress : ULONGLONG
ctypes.c_void_p, # pServerInformation : ServerInformation* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
CoDecodeProxy = Fiddle::Function.new(
lib['CoDecodeProxy'],
[
-Fiddle::TYPE_INT, # dwClientPid : DWORD
-Fiddle::TYPE_LONG_LONG, # ui64ProxyAddress : ULONGLONG
Fiddle::TYPE_VOIDP, # pServerInformation : ServerInformation* out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CoDecodeProxy(
dwClientPid: u32, // DWORD
ui64ProxyAddress: u64, // ULONGLONG
pServerInformation: *mut ServerInformation // ServerInformation* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int CoDecodeProxy(uint dwClientPid, ulong ui64ProxyAddress, IntPtr pServerInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoDecodeProxy' -Namespace Win32 -PassThru
# $api::CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation)#uselib "OLE32.dll"
#func global CoDecodeProxy "CoDecodeProxy" sptr, sptr, sptr
; CoDecodeProxy dwClientPid, ui64ProxyAddress, varptr(pServerInformation) ; 戻り値は stat
; dwClientPid : DWORD -> "sptr"
; ui64ProxyAddress : ULONGLONG -> "sptr"
; pServerInformation : ServerInformation* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLE32.dll" #cfunc global CoDecodeProxy "CoDecodeProxy" int, int64, var ; res = CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation) ; dwClientPid : DWORD -> "int" ; ui64ProxyAddress : ULONGLONG -> "int64" ; pServerInformation : ServerInformation* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "OLE32.dll" #cfunc global CoDecodeProxy "CoDecodeProxy" int, int64, sptr ; res = CoDecodeProxy(dwClientPid, ui64ProxyAddress, varptr(pServerInformation)) ; dwClientPid : DWORD -> "int" ; ui64ProxyAddress : ULONGLONG -> "int64" ; pServerInformation : ServerInformation* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT CoDecodeProxy(DWORD dwClientPid, ULONGLONG ui64ProxyAddress, ServerInformation* pServerInformation) #uselib "OLE32.dll" #cfunc global CoDecodeProxy "CoDecodeProxy" int, int64, var ; res = CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation) ; dwClientPid : DWORD -> "int" ; ui64ProxyAddress : ULONGLONG -> "int64" ; pServerInformation : ServerInformation* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT CoDecodeProxy(DWORD dwClientPid, ULONGLONG ui64ProxyAddress, ServerInformation* pServerInformation) #uselib "OLE32.dll" #cfunc global CoDecodeProxy "CoDecodeProxy" int, int64, intptr ; res = CoDecodeProxy(dwClientPid, ui64ProxyAddress, varptr(pServerInformation)) ; dwClientPid : DWORD -> "int" ; ui64ProxyAddress : ULONGLONG -> "int64" ; pServerInformation : ServerInformation* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procCoDecodeProxy = ole32.NewProc("CoDecodeProxy")
)
// dwClientPid (DWORD), ui64ProxyAddress (ULONGLONG), pServerInformation (ServerInformation* out)
r1, _, err := procCoDecodeProxy.Call(
uintptr(dwClientPid),
uintptr(ui64ProxyAddress),
uintptr(pServerInformation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CoDecodeProxy(
dwClientPid: DWORD; // DWORD
ui64ProxyAddress: UInt64; // ULONGLONG
pServerInformation: Pointer // ServerInformation* out
): Integer; stdcall;
external 'OLE32.dll' name 'CoDecodeProxy';result := DllCall("OLE32\CoDecodeProxy"
, "UInt", dwClientPid ; DWORD
, "Int64", ui64ProxyAddress ; ULONGLONG
, "Ptr", pServerInformation ; ServerInformation* out
, "Int") ; return: HRESULT●CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation) = DLL("OLE32.dll", "int CoDecodeProxy(dword, qword, void*)")
# 呼び出し: CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation)
# dwClientPid : DWORD -> "dword"
# ui64ProxyAddress : ULONGLONG -> "qword"
# pServerInformation : ServerInformation* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ole32" fn CoDecodeProxy(
dwClientPid: u32, // DWORD
ui64ProxyAddress: u64, // ULONGLONG
pServerInformation: [*c]ServerInformation // ServerInformation* out
) callconv(std.os.windows.WINAPI) i32;proc CoDecodeProxy(
dwClientPid: uint32, # DWORD
ui64ProxyAddress: uint64, # ULONGLONG
pServerInformation: ptr ServerInformation # ServerInformation* out
): int32 {.importc: "CoDecodeProxy", stdcall, dynlib: "OLE32.dll".}pragma(lib, "ole32");
extern(Windows)
int CoDecodeProxy(
uint dwClientPid, // DWORD
ulong ui64ProxyAddress, // ULONGLONG
ServerInformation* pServerInformation // ServerInformation* out
);ccall((:CoDecodeProxy, "OLE32.dll"), stdcall, Int32,
(UInt32, UInt64, Ptr{ServerInformation}),
dwClientPid, ui64ProxyAddress, pServerInformation)
# dwClientPid : DWORD -> UInt32
# ui64ProxyAddress : ULONGLONG -> UInt64
# pServerInformation : ServerInformation* out -> Ptr{ServerInformation}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CoDecodeProxy(
uint32_t dwClientPid,
uint64_t ui64ProxyAddress,
void* pServerInformation);
]]
local ole32 = ffi.load("ole32")
-- ole32.CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation)
-- dwClientPid : DWORD
-- ui64ProxyAddress : ULONGLONG
-- pServerInformation : ServerInformation* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLE32.dll');
const CoDecodeProxy = lib.func('__stdcall', 'CoDecodeProxy', 'int32_t', ['uint32_t', 'uint64_t', 'void *']);
// CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation)
// dwClientPid : DWORD -> 'uint32_t'
// ui64ProxyAddress : ULONGLONG -> 'uint64_t'
// pServerInformation : ServerInformation* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLE32.dll", {
CoDecodeProxy: { parameters: ["u32", "u64", "pointer"], result: "i32" },
});
// lib.symbols.CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation)
// dwClientPid : DWORD -> "u32"
// ui64ProxyAddress : ULONGLONG -> "u64"
// pServerInformation : ServerInformation* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CoDecodeProxy(
uint32_t dwClientPid,
uint64_t ui64ProxyAddress,
void* pServerInformation);
C, "OLE32.dll");
// $ffi->CoDecodeProxy(dwClientPid, ui64ProxyAddress, pServerInformation);
// dwClientPid : DWORD
// ui64ProxyAddress : ULONGLONG
// pServerInformation : ServerInformation* 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 Ole32 extends StdCallLibrary {
Ole32 INSTANCE = Native.load("ole32", Ole32.class);
int CoDecodeProxy(
int dwClientPid, // DWORD
long ui64ProxyAddress, // ULONGLONG
Pointer pServerInformation // ServerInformation* out
);
}@[Link("ole32")]
lib LibOLE32
fun CoDecodeProxy = CoDecodeProxy(
dwClientPid : UInt32, # DWORD
ui64ProxyAddress : UInt64, # ULONGLONG
pServerInformation : ServerInformation* # ServerInformation* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CoDecodeProxyNative = Int32 Function(Uint32, Uint64, Pointer<Void>);
typedef CoDecodeProxyDart = int Function(int, int, Pointer<Void>);
final CoDecodeProxy = DynamicLibrary.open('OLE32.dll')
.lookupFunction<CoDecodeProxyNative, CoDecodeProxyDart>('CoDecodeProxy');
// dwClientPid : DWORD -> Uint32
// ui64ProxyAddress : ULONGLONG -> Uint64
// pServerInformation : ServerInformation* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CoDecodeProxy(
dwClientPid: DWORD; // DWORD
ui64ProxyAddress: UInt64; // ULONGLONG
pServerInformation: Pointer // ServerInformation* out
): Integer; stdcall;
external 'OLE32.dll' name 'CoDecodeProxy';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CoDecodeProxy"
c_CoDecodeProxy :: Word32 -> Word64 -> Ptr () -> IO Int32
-- dwClientPid : DWORD -> Word32
-- ui64ProxyAddress : ULONGLONG -> Word64
-- pServerInformation : ServerInformation* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let codecodeproxy =
foreign "CoDecodeProxy"
(uint32_t @-> uint64_t @-> (ptr void) @-> returning int32_t)
(* dwClientPid : DWORD -> uint32_t *)
(* ui64ProxyAddress : ULONGLONG -> uint64_t *)
(* pServerInformation : ServerInformation* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ole32 (t "OLE32.dll"))
(cffi:use-foreign-library ole32)
(cffi:defcfun ("CoDecodeProxy" co-decode-proxy :convention :stdcall) :int32
(dw-client-pid :uint32) ; DWORD
(ui64-proxy-address :uint64) ; ULONGLONG
(p-server-information :pointer)) ; ServerInformation* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CoDecodeProxy = Win32::API::More->new('OLE32',
'int CoDecodeProxy(DWORD dwClientPid, UINT64 ui64ProxyAddress, LPVOID pServerInformation)');
# my $ret = $CoDecodeProxy->Call($dwClientPid, $ui64ProxyAddress, $pServerInformation);
# dwClientPid : DWORD -> DWORD
# ui64ProxyAddress : ULONGLONG -> UINT64
# pServerInformation : ServerInformation* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型