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