ホーム › UI.ColorSystem › WcsOpenColorProfileW
WcsOpenColorProfileW
関数WCSの複数プロファイルを開きハンドルを返す(Unicode版)。
シグネチャ
// mscms.dll (Unicode / -W)
#include <windows.h>
INT_PTR WcsOpenColorProfileW(
PROFILE* pCDMPProfile,
PROFILE* pCAMPProfile, // optional
PROFILE* pGMMPProfile, // optional
DWORD dwDesireAccess,
DWORD dwShareMode,
DWORD dwCreationMode,
DWORD dwFlags
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pCDMPProfile | PROFILE* | in | デバイスモデルプロファイル(CDMP)を記述するPROFILE構造体(Unicode)へのポインタ。 |
| pCAMPProfile | PROFILE* | inoptional | 色外観モデルプロファイル(CAMP)を記述するPROFILE構造体へのポインタ。NULL可。 |
| pGMMPProfile | PROFILE* | inoptional | ガモットマップモデルプロファイル(GMMP)を記述するPROFILE構造体へのポインタ。NULL可。 |
| dwDesireAccess | DWORD | in | プロファイルへのアクセス権を指定するフラグ。 |
| dwShareMode | DWORD | in | 他プロセスとの共有モードを指定するフラグ。 |
| dwCreationMode | DWORD | in | プロファイルを開く際の作成動作を指定する値。 |
| dwFlags | DWORD | in | WCSプロファイルの取り扱い方法を制御するフラグ。 |
戻り値の型: INT_PTR
各言語での呼び出し定義
// mscms.dll (Unicode / -W)
#include <windows.h>
INT_PTR WcsOpenColorProfileW(
PROFILE* pCDMPProfile,
PROFILE* pCAMPProfile, // optional
PROFILE* pGMMPProfile, // optional
DWORD dwDesireAccess,
DWORD dwShareMode,
DWORD dwCreationMode,
DWORD dwFlags
);[DllImport("mscms.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr WcsOpenColorProfileW(
IntPtr pCDMPProfile, // PROFILE*
IntPtr pCAMPProfile, // PROFILE* optional
IntPtr pGMMPProfile, // PROFILE* optional
uint dwDesireAccess, // DWORD
uint dwShareMode, // DWORD
uint dwCreationMode, // DWORD
uint dwFlags // DWORD
);<DllImport("mscms.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function WcsOpenColorProfileW(
pCDMPProfile As IntPtr, ' PROFILE*
pCAMPProfile As IntPtr, ' PROFILE* optional
pGMMPProfile As IntPtr, ' PROFILE* optional
dwDesireAccess As UInteger, ' DWORD
dwShareMode As UInteger, ' DWORD
dwCreationMode As UInteger, ' DWORD
dwFlags As UInteger ' DWORD
) As IntPtr
End Function' pCDMPProfile : PROFILE*
' pCAMPProfile : PROFILE* optional
' pGMMPProfile : PROFILE* optional
' dwDesireAccess : DWORD
' dwShareMode : DWORD
' dwCreationMode : DWORD
' dwFlags : DWORD
Declare PtrSafe Function WcsOpenColorProfileW Lib "mscms" ( _
ByVal pCDMPProfile As LongPtr, _
ByVal pCAMPProfile As LongPtr, _
ByVal pGMMPProfile As LongPtr, _
ByVal dwDesireAccess As Long, _
ByVal dwShareMode As Long, _
ByVal dwCreationMode As Long, _
ByVal dwFlags As Long) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WcsOpenColorProfileW = ctypes.windll.mscms.WcsOpenColorProfileW
WcsOpenColorProfileW.restype = ctypes.c_ssize_t
WcsOpenColorProfileW.argtypes = [
ctypes.c_void_p, # pCDMPProfile : PROFILE*
ctypes.c_void_p, # pCAMPProfile : PROFILE* optional
ctypes.c_void_p, # pGMMPProfile : PROFILE* optional
wintypes.DWORD, # dwDesireAccess : DWORD
wintypes.DWORD, # dwShareMode : DWORD
wintypes.DWORD, # dwCreationMode : DWORD
wintypes.DWORD, # dwFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
WcsOpenColorProfileW = Fiddle::Function.new(
lib['WcsOpenColorProfileW'],
[
Fiddle::TYPE_VOIDP, # pCDMPProfile : PROFILE*
Fiddle::TYPE_VOIDP, # pCAMPProfile : PROFILE* optional
Fiddle::TYPE_VOIDP, # pGMMPProfile : PROFILE* optional
-Fiddle::TYPE_INT, # dwDesireAccess : DWORD
-Fiddle::TYPE_INT, # dwShareMode : DWORD
-Fiddle::TYPE_INT, # dwCreationMode : DWORD
-Fiddle::TYPE_INT, # dwFlags : DWORD
],
Fiddle::TYPE_INTPTR_T)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "mscms")]
extern "system" {
fn WcsOpenColorProfileW(
pCDMPProfile: *mut PROFILE, // PROFILE*
pCAMPProfile: *mut PROFILE, // PROFILE* optional
pGMMPProfile: *mut PROFILE, // PROFILE* optional
dwDesireAccess: u32, // DWORD
dwShareMode: u32, // DWORD
dwCreationMode: u32, // DWORD
dwFlags: u32 // DWORD
) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mscms.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr WcsOpenColorProfileW(IntPtr pCDMPProfile, IntPtr pCAMPProfile, IntPtr pGMMPProfile, uint dwDesireAccess, uint dwShareMode, uint dwCreationMode, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsOpenColorProfileW' -Namespace Win32 -PassThru
# $api::WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)#uselib "mscms.dll"
#func global WcsOpenColorProfileW "WcsOpenColorProfileW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; WcsOpenColorProfileW varptr(pCDMPProfile), varptr(pCAMPProfile), varptr(pGMMPProfile), dwDesireAccess, dwShareMode, dwCreationMode, dwFlags ; 戻り値は stat
; pCDMPProfile : PROFILE* -> "wptr"
; pCAMPProfile : PROFILE* optional -> "wptr"
; pGMMPProfile : PROFILE* optional -> "wptr"
; dwDesireAccess : DWORD -> "wptr"
; dwShareMode : DWORD -> "wptr"
; dwCreationMode : DWORD -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "mscms.dll" #cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" var, var, var, int, int, int, int ; res = WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) ; pCDMPProfile : PROFILE* -> "var" ; pCAMPProfile : PROFILE* optional -> "var" ; pGMMPProfile : PROFILE* optional -> "var" ; dwDesireAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "mscms.dll" #cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" sptr, sptr, sptr, int, int, int, int ; res = WcsOpenColorProfileW(varptr(pCDMPProfile), varptr(pCAMPProfile), varptr(pGMMPProfile), dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) ; pCDMPProfile : PROFILE* -> "sptr" ; pCAMPProfile : PROFILE* optional -> "sptr" ; pGMMPProfile : PROFILE* optional -> "sptr" ; dwDesireAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT_PTR WcsOpenColorProfileW(PROFILE* pCDMPProfile, PROFILE* pCAMPProfile, PROFILE* pGMMPProfile, DWORD dwDesireAccess, DWORD dwShareMode, DWORD dwCreationMode, DWORD dwFlags) #uselib "mscms.dll" #cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" var, var, var, int, int, int, int ; res = WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) ; pCDMPProfile : PROFILE* -> "var" ; pCAMPProfile : PROFILE* optional -> "var" ; pGMMPProfile : PROFILE* optional -> "var" ; dwDesireAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT_PTR WcsOpenColorProfileW(PROFILE* pCDMPProfile, PROFILE* pCAMPProfile, PROFILE* pGMMPProfile, DWORD dwDesireAccess, DWORD dwShareMode, DWORD dwCreationMode, DWORD dwFlags) #uselib "mscms.dll" #cfunc global WcsOpenColorProfileW "WcsOpenColorProfileW" intptr, intptr, intptr, int, int, int, int ; res = WcsOpenColorProfileW(varptr(pCDMPProfile), varptr(pCAMPProfile), varptr(pGMMPProfile), dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) ; pCDMPProfile : PROFILE* -> "intptr" ; pCAMPProfile : PROFILE* optional -> "intptr" ; pGMMPProfile : PROFILE* optional -> "intptr" ; dwDesireAccess : DWORD -> "int" ; dwShareMode : DWORD -> "int" ; dwCreationMode : DWORD -> "int" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procWcsOpenColorProfileW = mscms.NewProc("WcsOpenColorProfileW")
)
// pCDMPProfile (PROFILE*), pCAMPProfile (PROFILE* optional), pGMMPProfile (PROFILE* optional), dwDesireAccess (DWORD), dwShareMode (DWORD), dwCreationMode (DWORD), dwFlags (DWORD)
r1, _, err := procWcsOpenColorProfileW.Call(
uintptr(pCDMPProfile),
uintptr(pCAMPProfile),
uintptr(pGMMPProfile),
uintptr(dwDesireAccess),
uintptr(dwShareMode),
uintptr(dwCreationMode),
uintptr(dwFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INT_PTRfunction WcsOpenColorProfileW(
pCDMPProfile: Pointer; // PROFILE*
pCAMPProfile: Pointer; // PROFILE* optional
pGMMPProfile: Pointer; // PROFILE* optional
dwDesireAccess: DWORD; // DWORD
dwShareMode: DWORD; // DWORD
dwCreationMode: DWORD; // DWORD
dwFlags: DWORD // DWORD
): NativeInt; stdcall;
external 'mscms.dll' name 'WcsOpenColorProfileW';result := DllCall("mscms\WcsOpenColorProfileW"
, "Ptr", pCDMPProfile ; PROFILE*
, "Ptr", pCAMPProfile ; PROFILE* optional
, "Ptr", pGMMPProfile ; PROFILE* optional
, "UInt", dwDesireAccess ; DWORD
, "UInt", dwShareMode ; DWORD
, "UInt", dwCreationMode ; DWORD
, "UInt", dwFlags ; DWORD
, "Ptr") ; return: INT_PTR●WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags) = DLL("mscms.dll", "int WcsOpenColorProfileW(void*, void*, void*, dword, dword, dword, dword)")
# 呼び出し: WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
# pCDMPProfile : PROFILE* -> "void*"
# pCAMPProfile : PROFILE* optional -> "void*"
# pGMMPProfile : PROFILE* optional -> "void*"
# dwDesireAccess : DWORD -> "dword"
# dwShareMode : DWORD -> "dword"
# dwCreationMode : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "mscms" fn WcsOpenColorProfileW(
pCDMPProfile: [*c]PROFILE, // PROFILE*
pCAMPProfile: [*c]PROFILE, // PROFILE* optional
pGMMPProfile: [*c]PROFILE, // PROFILE* optional
dwDesireAccess: u32, // DWORD
dwShareMode: u32, // DWORD
dwCreationMode: u32, // DWORD
dwFlags: u32 // DWORD
) callconv(std.os.windows.WINAPI) isize;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc WcsOpenColorProfileW(
pCDMPProfile: ptr PROFILE, # PROFILE*
pCAMPProfile: ptr PROFILE, # PROFILE* optional
pGMMPProfile: ptr PROFILE, # PROFILE* optional
dwDesireAccess: uint32, # DWORD
dwShareMode: uint32, # DWORD
dwCreationMode: uint32, # DWORD
dwFlags: uint32 # DWORD
): int {.importc: "WcsOpenColorProfileW", stdcall, dynlib: "mscms.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "mscms");
extern(Windows)
ptrdiff_t WcsOpenColorProfileW(
PROFILE* pCDMPProfile, // PROFILE*
PROFILE* pCAMPProfile, // PROFILE* optional
PROFILE* pGMMPProfile, // PROFILE* optional
uint dwDesireAccess, // DWORD
uint dwShareMode, // DWORD
uint dwCreationMode, // DWORD
uint dwFlags // DWORD
);ccall((:WcsOpenColorProfileW, "mscms.dll"), stdcall, Int,
(Ptr{PROFILE}, Ptr{PROFILE}, Ptr{PROFILE}, UInt32, UInt32, UInt32, UInt32),
pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
# pCDMPProfile : PROFILE* -> Ptr{PROFILE}
# pCAMPProfile : PROFILE* optional -> Ptr{PROFILE}
# pGMMPProfile : PROFILE* optional -> Ptr{PROFILE}
# dwDesireAccess : DWORD -> UInt32
# dwShareMode : DWORD -> UInt32
# dwCreationMode : DWORD -> UInt32
# dwFlags : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
intptr_t WcsOpenColorProfileW(
void* pCDMPProfile,
void* pCAMPProfile,
void* pGMMPProfile,
uint32_t dwDesireAccess,
uint32_t dwShareMode,
uint32_t dwCreationMode,
uint32_t dwFlags);
]]
local mscms = ffi.load("mscms")
-- mscms.WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
-- pCDMPProfile : PROFILE*
-- pCAMPProfile : PROFILE* optional
-- pGMMPProfile : PROFILE* optional
-- dwDesireAccess : DWORD
-- dwShareMode : DWORD
-- dwCreationMode : DWORD
-- dwFlags : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const WcsOpenColorProfileW = lib.func('__stdcall', 'WcsOpenColorProfileW', 'intptr_t', ['void *', 'void *', 'void *', 'uint32_t', 'uint32_t', 'uint32_t', 'uint32_t']);
// WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
// pCDMPProfile : PROFILE* -> 'void *'
// pCAMPProfile : PROFILE* optional -> 'void *'
// pGMMPProfile : PROFILE* optional -> 'void *'
// dwDesireAccess : DWORD -> 'uint32_t'
// dwShareMode : DWORD -> 'uint32_t'
// dwCreationMode : DWORD -> 'uint32_t'
// dwFlags : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
WcsOpenColorProfileW: { parameters: ["pointer", "pointer", "pointer", "u32", "u32", "u32", "u32"], result: "isize" },
});
// lib.symbols.WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags)
// pCDMPProfile : PROFILE* -> "pointer"
// pCAMPProfile : PROFILE* optional -> "pointer"
// pGMMPProfile : PROFILE* optional -> "pointer"
// dwDesireAccess : DWORD -> "u32"
// dwShareMode : DWORD -> "u32"
// dwCreationMode : DWORD -> "u32"
// dwFlags : DWORD -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
intptr_t WcsOpenColorProfileW(
void* pCDMPProfile,
void* pCAMPProfile,
void* pGMMPProfile,
uint32_t dwDesireAccess,
uint32_t dwShareMode,
uint32_t dwCreationMode,
uint32_t dwFlags);
C, "mscms.dll");
// $ffi->WcsOpenColorProfileW(pCDMPProfile, pCAMPProfile, pGMMPProfile, dwDesireAccess, dwShareMode, dwCreationMode, dwFlags);
// pCDMPProfile : PROFILE*
// pCAMPProfile : PROFILE* optional
// pGMMPProfile : PROFILE* optional
// dwDesireAccess : DWORD
// dwShareMode : DWORD
// dwCreationMode : DWORD
// dwFlags : DWORD
// 構造体/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 Mscms extends StdCallLibrary {
Mscms INSTANCE = Native.load("mscms", Mscms.class, W32APIOptions.UNICODE_OPTIONS);
long WcsOpenColorProfileW(
Pointer pCDMPProfile, // PROFILE*
Pointer pCAMPProfile, // PROFILE* optional
Pointer pGMMPProfile, // PROFILE* optional
int dwDesireAccess, // DWORD
int dwShareMode, // DWORD
int dwCreationMode, // DWORD
int dwFlags // DWORD
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("mscms")]
lib Libmscms
fun WcsOpenColorProfileW = WcsOpenColorProfileW(
pCDMPProfile : PROFILE*, # PROFILE*
pCAMPProfile : PROFILE*, # PROFILE* optional
pGMMPProfile : PROFILE*, # PROFILE* optional
dwDesireAccess : UInt32, # DWORD
dwShareMode : UInt32, # DWORD
dwCreationMode : UInt32, # DWORD
dwFlags : UInt32 # DWORD
) : LibC::SSizeT
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WcsOpenColorProfileWNative = IntPtr Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Uint32, Uint32, Uint32, Uint32);
typedef WcsOpenColorProfileWDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, int, int, int, int);
final WcsOpenColorProfileW = DynamicLibrary.open('mscms.dll')
.lookupFunction<WcsOpenColorProfileWNative, WcsOpenColorProfileWDart>('WcsOpenColorProfileW');
// pCDMPProfile : PROFILE* -> Pointer<Void>
// pCAMPProfile : PROFILE* optional -> Pointer<Void>
// pGMMPProfile : PROFILE* optional -> Pointer<Void>
// dwDesireAccess : DWORD -> Uint32
// dwShareMode : DWORD -> Uint32
// dwCreationMode : DWORD -> Uint32
// dwFlags : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WcsOpenColorProfileW(
pCDMPProfile: Pointer; // PROFILE*
pCAMPProfile: Pointer; // PROFILE* optional
pGMMPProfile: Pointer; // PROFILE* optional
dwDesireAccess: DWORD; // DWORD
dwShareMode: DWORD; // DWORD
dwCreationMode: DWORD; // DWORD
dwFlags: DWORD // DWORD
): NativeInt; stdcall;
external 'mscms.dll' name 'WcsOpenColorProfileW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WcsOpenColorProfileW"
c_WcsOpenColorProfileW :: Ptr () -> Ptr () -> Ptr () -> Word32 -> Word32 -> Word32 -> Word32 -> IO CIntPtr
-- pCDMPProfile : PROFILE* -> Ptr ()
-- pCAMPProfile : PROFILE* optional -> Ptr ()
-- pGMMPProfile : PROFILE* optional -> Ptr ()
-- dwDesireAccess : DWORD -> Word32
-- dwShareMode : DWORD -> Word32
-- dwCreationMode : DWORD -> Word32
-- dwFlags : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wcsopencolorprofilew =
foreign "WcsOpenColorProfileW"
((ptr void) @-> (ptr void) @-> (ptr void) @-> uint32_t @-> uint32_t @-> uint32_t @-> uint32_t @-> returning intptr_t)
(* pCDMPProfile : PROFILE* -> (ptr void) *)
(* pCAMPProfile : PROFILE* optional -> (ptr void) *)
(* pGMMPProfile : PROFILE* optional -> (ptr void) *)
(* dwDesireAccess : DWORD -> uint32_t *)
(* dwShareMode : DWORD -> uint32_t *)
(* dwCreationMode : DWORD -> uint32_t *)
(* dwFlags : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)
(cffi:defcfun ("WcsOpenColorProfileW" wcs-open-color-profile-w :convention :stdcall) :int64
(p-cdmpprofile :pointer) ; PROFILE*
(p-campprofile :pointer) ; PROFILE* optional
(p-gmmpprofile :pointer) ; PROFILE* optional
(dw-desire-access :uint32) ; DWORD
(dw-share-mode :uint32) ; DWORD
(dw-creation-mode :uint32) ; DWORD
(dw-flags :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WcsOpenColorProfileW = Win32::API::More->new('mscms',
'LPARAM WcsOpenColorProfileW(LPVOID pCDMPProfile, LPVOID pCAMPProfile, LPVOID pGMMPProfile, DWORD dwDesireAccess, DWORD dwShareMode, DWORD dwCreationMode, DWORD dwFlags)');
# my $ret = $WcsOpenColorProfileW->Call($pCDMPProfile, $pCAMPProfile, $pGMMPProfile, $dwDesireAccess, $dwShareMode, $dwCreationMode, $dwFlags);
# pCDMPProfile : PROFILE* -> LPVOID
# pCAMPProfile : PROFILE* optional -> LPVOID
# pGMMPProfile : PROFILE* optional -> LPVOID
# dwDesireAccess : DWORD -> DWORD
# dwShareMode : DWORD -> DWORD
# dwCreationMode : DWORD -> DWORD
# dwFlags : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f WcsOpenColorProfileA (ANSI版) — WCSの複数プロファイルを開きハンドルを返す(ANSI版)。
使用する型