Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipGetImageDecoders

GdipGetImageDecoders

関数
インストール済み画像デコーダーの情報一覧を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetImageDecoders(
    DWORD numDecoders,
    DWORD size,
    ImageCodecInfo* decoders
);

パラメーター

名前方向説明
numDecodersDWORDin取得するデコーダの数。GetImageDecodersSizeで得た値を渡す。
sizeDWORDindecodersバッファのバイトサイズ。GetImageDecodersSizeで得た値を渡す。
decodersImageCodecInfo*outデコーダ情報を受け取るImageCodecInfo配列へのポインタ(出力)。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetImageDecoders(
    DWORD numDecoders,
    DWORD size,
    ImageCodecInfo* decoders
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetImageDecoders(
    uint numDecoders,   // DWORD
    uint size,   // DWORD
    IntPtr decoders   // ImageCodecInfo* out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetImageDecoders(
    numDecoders As UInteger,   ' DWORD
    size As UInteger,   ' DWORD
    decoders As IntPtr   ' ImageCodecInfo* out
) As Integer
End Function
' numDecoders : DWORD
' size : DWORD
' decoders : ImageCodecInfo* out
Declare PtrSafe Function GdipGetImageDecoders Lib "gdiplus" ( _
    ByVal numDecoders As Long, _
    ByVal size As Long, _
    ByVal decoders As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetImageDecoders = ctypes.windll.gdiplus.GdipGetImageDecoders
GdipGetImageDecoders.restype = ctypes.c_int
GdipGetImageDecoders.argtypes = [
    wintypes.DWORD,  # numDecoders : DWORD
    wintypes.DWORD,  # size : DWORD
    ctypes.c_void_p,  # decoders : ImageCodecInfo* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetImageDecoders = gdiplus.NewProc("GdipGetImageDecoders")
)

// numDecoders (DWORD), size (DWORD), decoders (ImageCodecInfo* out)
r1, _, err := procGdipGetImageDecoders.Call(
	uintptr(numDecoders),
	uintptr(size),
	uintptr(decoders),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetImageDecoders(
  numDecoders: DWORD;   // DWORD
  size: DWORD;   // DWORD
  decoders: Pointer   // ImageCodecInfo* out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetImageDecoders';
result := DllCall("gdiplus\GdipGetImageDecoders"
    , "UInt", numDecoders   ; DWORD
    , "UInt", size   ; DWORD
    , "Ptr", decoders   ; ImageCodecInfo* out
    , "Int")   ; return: Status
●GdipGetImageDecoders(numDecoders, size, decoders) = DLL("gdiplus.dll", "int GdipGetImageDecoders(dword, dword, void*)")
# 呼び出し: GdipGetImageDecoders(numDecoders, size, decoders)
# numDecoders : DWORD -> "dword"
# size : DWORD -> "dword"
# decoders : ImageCodecInfo* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef GdipGetImageDecodersNative = Int32 Function(Uint32, Uint32, Pointer<Void>);
typedef GdipGetImageDecodersDart = int Function(int, int, Pointer<Void>);
final GdipGetImageDecoders = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipGetImageDecodersNative, GdipGetImageDecodersDart>('GdipGetImageDecoders');
// numDecoders : DWORD -> Uint32
// size : DWORD -> Uint32
// decoders : ImageCodecInfo* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipGetImageDecoders(
  numDecoders: DWORD;   // DWORD
  size: DWORD;   // DWORD
  decoders: Pointer   // ImageCodecInfo* out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetImageDecoders';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipGetImageDecoders"
  c_GdipGetImageDecoders :: Word32 -> Word32 -> Ptr () -> IO Int32
-- numDecoders : DWORD -> Word32
-- size : DWORD -> Word32
-- decoders : ImageCodecInfo* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipgetimagedecoders =
  foreign "GdipGetImageDecoders"
    (uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* numDecoders : DWORD -> uint32_t *)
(* size : DWORD -> uint32_t *)
(* decoders : ImageCodecInfo* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipGetImageDecoders" gdip-get-image-decoders :convention :stdcall) :int32
  (num-decoders :uint32)   ; DWORD
  (size :uint32)   ; DWORD
  (decoders :pointer))   ; ImageCodecInfo* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipGetImageDecoders = Win32::API::More->new('gdiplus',
    'int GdipGetImageDecoders(DWORD numDecoders, DWORD size, LPVOID decoders)');
# my $ret = $GdipGetImageDecoders->Call($numDecoders, $size, $decoders);
# numDecoders : DWORD -> DWORD
# size : DWORD -> DWORD
# decoders : ImageCodecInfo* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型