ホーム › UI.ColorSystem › CreateDeviceLinkProfile
CreateDeviceLinkProfile
関数複数プロファイルからデバイスリンクプロファイルを作成する。
シグネチャ
// mscms.dll
#include <windows.h>
BOOL CreateDeviceLinkProfile(
INT_PTR* hProfile,
DWORD nProfiles,
DWORD* padwIntent,
DWORD nIntents,
DWORD dwFlags,
BYTE** pProfileData,
DWORD indexPreferredCMM
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hProfile | INT_PTR* | in | 連結するプロファイルハンドルの配列へのポインタ。 |
| nProfiles | DWORD | in | 配列内のプロファイル数。 |
| padwIntent | DWORD* | in | 各変換段で使用するレンダリングインテントのDWORD配列へのポインタ。 |
| nIntents | DWORD | in | インテント配列の要素数。 |
| dwFlags | DWORD | in | 変換生成時の最適化やガモットチェックを制御するフラグ。 |
| pProfileData | BYTE** | out | 生成されたデバイスリンクプロファイルのデータバッファアドレスを受け取るポインタ。 |
| indexPreferredCMM | DWORD | in | 優先して使用するCMMのインデックス値。 |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll
#include <windows.h>
BOOL CreateDeviceLinkProfile(
INT_PTR* hProfile,
DWORD nProfiles,
DWORD* padwIntent,
DWORD nIntents,
DWORD dwFlags,
BYTE** pProfileData,
DWORD indexPreferredCMM
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool CreateDeviceLinkProfile(
ref IntPtr hProfile, // INT_PTR*
uint nProfiles, // DWORD
ref uint padwIntent, // DWORD*
uint nIntents, // DWORD
uint dwFlags, // DWORD
IntPtr pProfileData, // BYTE** out
uint indexPreferredCMM // DWORD
);<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function CreateDeviceLinkProfile(
ByRef hProfile As IntPtr, ' INT_PTR*
nProfiles As UInteger, ' DWORD
ByRef padwIntent As UInteger, ' DWORD*
nIntents As UInteger, ' DWORD
dwFlags As UInteger, ' DWORD
pProfileData As IntPtr, ' BYTE** out
indexPreferredCMM As UInteger ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hProfile : INT_PTR*
' nProfiles : DWORD
' padwIntent : DWORD*
' nIntents : DWORD
' dwFlags : DWORD
' pProfileData : BYTE** out
' indexPreferredCMM : DWORD
Declare PtrSafe Function CreateDeviceLinkProfile Lib "mscms" ( _
ByRef hProfile As LongPtr, _
ByVal nProfiles As Long, _
ByRef padwIntent As Long, _
ByVal nIntents As Long, _
ByVal dwFlags As Long, _
ByVal pProfileData As LongPtr, _
ByVal indexPreferredCMM As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateDeviceLinkProfile = ctypes.windll.mscms.CreateDeviceLinkProfile
CreateDeviceLinkProfile.restype = wintypes.BOOL
CreateDeviceLinkProfile.argtypes = [
ctypes.POINTER(ctypes.c_ssize_t), # hProfile : INT_PTR*
wintypes.DWORD, # nProfiles : DWORD
ctypes.POINTER(wintypes.DWORD), # padwIntent : DWORD*
wintypes.DWORD, # nIntents : DWORD
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_void_p, # pProfileData : BYTE** out
wintypes.DWORD, # indexPreferredCMM : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
CreateDeviceLinkProfile = Fiddle::Function.new(
lib['CreateDeviceLinkProfile'],
[
Fiddle::TYPE_VOIDP, # hProfile : INT_PTR*
-Fiddle::TYPE_INT, # nProfiles : DWORD
Fiddle::TYPE_VOIDP, # padwIntent : DWORD*
-Fiddle::TYPE_INT, # nIntents : DWORD
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # pProfileData : BYTE** out
-Fiddle::TYPE_INT, # indexPreferredCMM : DWORD
],
Fiddle::TYPE_INT)#[link(name = "mscms")]
extern "system" {
fn CreateDeviceLinkProfile(
hProfile: *mut isize, // INT_PTR*
nProfiles: u32, // DWORD
padwIntent: *mut u32, // DWORD*
nIntents: u32, // DWORD
dwFlags: u32, // DWORD
pProfileData: *mut *mut u8, // BYTE** out
indexPreferredCMM: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool CreateDeviceLinkProfile(ref IntPtr hProfile, uint nProfiles, ref uint padwIntent, uint nIntents, uint dwFlags, IntPtr pProfileData, uint indexPreferredCMM);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_CreateDeviceLinkProfile' -Namespace Win32 -PassThru
# $api::CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)#uselib "mscms.dll"
#func global CreateDeviceLinkProfile "CreateDeviceLinkProfile" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CreateDeviceLinkProfile varptr(hProfile), nProfiles, varptr(padwIntent), nIntents, dwFlags, varptr(pProfileData), indexPreferredCMM ; 戻り値は stat
; hProfile : INT_PTR* -> "sptr"
; nProfiles : DWORD -> "sptr"
; padwIntent : DWORD* -> "sptr"
; nIntents : DWORD -> "sptr"
; dwFlags : DWORD -> "sptr"
; pProfileData : BYTE** out -> "sptr"
; indexPreferredCMM : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "mscms.dll" #cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" var, int, var, int, int, var, int ; res = CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM) ; hProfile : INT_PTR* -> "var" ; nProfiles : DWORD -> "int" ; padwIntent : DWORD* -> "var" ; nIntents : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pProfileData : BYTE** out -> "var" ; indexPreferredCMM : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "mscms.dll" #cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" sptr, int, sptr, int, int, sptr, int ; res = CreateDeviceLinkProfile(varptr(hProfile), nProfiles, varptr(padwIntent), nIntents, dwFlags, varptr(pProfileData), indexPreferredCMM) ; hProfile : INT_PTR* -> "sptr" ; nProfiles : DWORD -> "int" ; padwIntent : DWORD* -> "sptr" ; nIntents : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pProfileData : BYTE** out -> "sptr" ; indexPreferredCMM : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CreateDeviceLinkProfile(INT_PTR* hProfile, DWORD nProfiles, DWORD* padwIntent, DWORD nIntents, DWORD dwFlags, BYTE** pProfileData, DWORD indexPreferredCMM) #uselib "mscms.dll" #cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" var, int, var, int, int, var, int ; res = CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM) ; hProfile : INT_PTR* -> "var" ; nProfiles : DWORD -> "int" ; padwIntent : DWORD* -> "var" ; nIntents : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pProfileData : BYTE** out -> "var" ; indexPreferredCMM : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CreateDeviceLinkProfile(INT_PTR* hProfile, DWORD nProfiles, DWORD* padwIntent, DWORD nIntents, DWORD dwFlags, BYTE** pProfileData, DWORD indexPreferredCMM) #uselib "mscms.dll" #cfunc global CreateDeviceLinkProfile "CreateDeviceLinkProfile" intptr, int, intptr, int, int, intptr, int ; res = CreateDeviceLinkProfile(varptr(hProfile), nProfiles, varptr(padwIntent), nIntents, dwFlags, varptr(pProfileData), indexPreferredCMM) ; hProfile : INT_PTR* -> "intptr" ; nProfiles : DWORD -> "int" ; padwIntent : DWORD* -> "intptr" ; nIntents : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pProfileData : BYTE** out -> "intptr" ; indexPreferredCMM : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procCreateDeviceLinkProfile = mscms.NewProc("CreateDeviceLinkProfile")
)
// hProfile (INT_PTR*), nProfiles (DWORD), padwIntent (DWORD*), nIntents (DWORD), dwFlags (DWORD), pProfileData (BYTE** out), indexPreferredCMM (DWORD)
r1, _, err := procCreateDeviceLinkProfile.Call(
uintptr(hProfile),
uintptr(nProfiles),
uintptr(padwIntent),
uintptr(nIntents),
uintptr(dwFlags),
uintptr(pProfileData),
uintptr(indexPreferredCMM),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CreateDeviceLinkProfile(
hProfile: Pointer; // INT_PTR*
nProfiles: DWORD; // DWORD
padwIntent: Pointer; // DWORD*
nIntents: DWORD; // DWORD
dwFlags: DWORD; // DWORD
pProfileData: Pointer; // BYTE** out
indexPreferredCMM: DWORD // DWORD
): BOOL; stdcall;
external 'mscms.dll' name 'CreateDeviceLinkProfile';result := DllCall("mscms\CreateDeviceLinkProfile"
, "Ptr", hProfile ; INT_PTR*
, "UInt", nProfiles ; DWORD
, "Ptr", padwIntent ; DWORD*
, "UInt", nIntents ; DWORD
, "UInt", dwFlags ; DWORD
, "Ptr", pProfileData ; BYTE** out
, "UInt", indexPreferredCMM ; DWORD
, "Int") ; return: BOOL●CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM) = DLL("mscms.dll", "bool CreateDeviceLinkProfile(void*, dword, void*, dword, dword, void*, dword)")
# 呼び出し: CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
# hProfile : INT_PTR* -> "void*"
# nProfiles : DWORD -> "dword"
# padwIntent : DWORD* -> "void*"
# nIntents : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# pProfileData : BYTE** out -> "void*"
# indexPreferredCMM : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mscms" fn CreateDeviceLinkProfile(
hProfile: [*c]isize, // INT_PTR*
nProfiles: u32, // DWORD
padwIntent: [*c]u32, // DWORD*
nIntents: u32, // DWORD
dwFlags: u32, // DWORD
pProfileData: [*c][*c]u8, // BYTE** out
indexPreferredCMM: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc CreateDeviceLinkProfile(
hProfile: ptr int, # INT_PTR*
nProfiles: uint32, # DWORD
padwIntent: ptr uint32, # DWORD*
nIntents: uint32, # DWORD
dwFlags: uint32, # DWORD
pProfileData: ptr uint8, # BYTE** out
indexPreferredCMM: uint32 # DWORD
): int32 {.importc: "CreateDeviceLinkProfile", stdcall, dynlib: "mscms.dll".}pragma(lib, "mscms");
extern(Windows)
int CreateDeviceLinkProfile(
ptrdiff_t* hProfile, // INT_PTR*
uint nProfiles, // DWORD
uint* padwIntent, // DWORD*
uint nIntents, // DWORD
uint dwFlags, // DWORD
ubyte** pProfileData, // BYTE** out
uint indexPreferredCMM // DWORD
);ccall((:CreateDeviceLinkProfile, "mscms.dll"), stdcall, Int32,
(Ptr{Int}, UInt32, Ptr{UInt32}, UInt32, UInt32, Ptr{UInt8}, UInt32),
hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
# hProfile : INT_PTR* -> Ptr{Int}
# nProfiles : DWORD -> UInt32
# padwIntent : DWORD* -> Ptr{UInt32}
# nIntents : DWORD -> UInt32
# dwFlags : DWORD -> UInt32
# pProfileData : BYTE** out -> Ptr{UInt8}
# indexPreferredCMM : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CreateDeviceLinkProfile(
intptr_t* hProfile,
uint32_t nProfiles,
uint32_t* padwIntent,
uint32_t nIntents,
uint32_t dwFlags,
uint8_t** pProfileData,
uint32_t indexPreferredCMM);
]]
local mscms = ffi.load("mscms")
-- mscms.CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
-- hProfile : INT_PTR*
-- nProfiles : DWORD
-- padwIntent : DWORD*
-- nIntents : DWORD
-- dwFlags : DWORD
-- pProfileData : BYTE** out
-- indexPreferredCMM : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const CreateDeviceLinkProfile = lib.func('__stdcall', 'CreateDeviceLinkProfile', 'int32_t', ['intptr_t *', 'uint32_t', 'uint32_t *', 'uint32_t', 'uint32_t', 'uint8_t *', 'uint32_t']);
// CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
// hProfile : INT_PTR* -> 'intptr_t *'
// nProfiles : DWORD -> 'uint32_t'
// padwIntent : DWORD* -> 'uint32_t *'
// nIntents : DWORD -> 'uint32_t'
// dwFlags : DWORD -> 'uint32_t'
// pProfileData : BYTE** out -> 'uint8_t *'
// indexPreferredCMM : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mscms.dll", {
CreateDeviceLinkProfile: { parameters: ["pointer", "u32", "pointer", "u32", "u32", "pointer", "u32"], result: "i32" },
});
// lib.symbols.CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM)
// hProfile : INT_PTR* -> "pointer"
// nProfiles : DWORD -> "u32"
// padwIntent : DWORD* -> "pointer"
// nIntents : DWORD -> "u32"
// dwFlags : DWORD -> "u32"
// pProfileData : BYTE** out -> "pointer"
// indexPreferredCMM : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CreateDeviceLinkProfile(
intptr_t* hProfile,
uint32_t nProfiles,
uint32_t* padwIntent,
uint32_t nIntents,
uint32_t dwFlags,
uint8_t** pProfileData,
uint32_t indexPreferredCMM);
C, "mscms.dll");
// $ffi->CreateDeviceLinkProfile(hProfile, nProfiles, padwIntent, nIntents, dwFlags, pProfileData, indexPreferredCMM);
// hProfile : INT_PTR*
// nProfiles : DWORD
// padwIntent : DWORD*
// nIntents : DWORD
// dwFlags : DWORD
// pProfileData : BYTE** out
// indexPreferredCMM : 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);
boolean CreateDeviceLinkProfile(
LongByReference hProfile, // INT_PTR*
int nProfiles, // DWORD
IntByReference padwIntent, // DWORD*
int nIntents, // DWORD
int dwFlags, // DWORD
Pointer pProfileData, // BYTE** out
int indexPreferredCMM // DWORD
);
}@[Link("mscms")]
lib Libmscms
fun CreateDeviceLinkProfile = CreateDeviceLinkProfile(
hProfile : LibC::SSizeT*, # INT_PTR*
nProfiles : UInt32, # DWORD
padwIntent : UInt32*, # DWORD*
nIntents : UInt32, # DWORD
dwFlags : UInt32, # DWORD
pProfileData : UInt8**, # BYTE** out
indexPreferredCMM : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreateDeviceLinkProfileNative = Int32 Function(Pointer<IntPtr>, Uint32, Pointer<Uint32>, Uint32, Uint32, Pointer<Uint8>, Uint32);
typedef CreateDeviceLinkProfileDart = int Function(Pointer<IntPtr>, int, Pointer<Uint32>, int, int, Pointer<Uint8>, int);
final CreateDeviceLinkProfile = DynamicLibrary.open('mscms.dll')
.lookupFunction<CreateDeviceLinkProfileNative, CreateDeviceLinkProfileDart>('CreateDeviceLinkProfile');
// hProfile : INT_PTR* -> Pointer<IntPtr>
// nProfiles : DWORD -> Uint32
// padwIntent : DWORD* -> Pointer<Uint32>
// nIntents : DWORD -> Uint32
// dwFlags : DWORD -> Uint32
// pProfileData : BYTE** out -> Pointer<Uint8>
// indexPreferredCMM : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreateDeviceLinkProfile(
hProfile: Pointer; // INT_PTR*
nProfiles: DWORD; // DWORD
padwIntent: Pointer; // DWORD*
nIntents: DWORD; // DWORD
dwFlags: DWORD; // DWORD
pProfileData: Pointer; // BYTE** out
indexPreferredCMM: DWORD // DWORD
): BOOL; stdcall;
external 'mscms.dll' name 'CreateDeviceLinkProfile';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreateDeviceLinkProfile"
c_CreateDeviceLinkProfile :: Ptr CIntPtr -> Word32 -> Ptr Word32 -> Word32 -> Word32 -> Ptr Word8 -> Word32 -> IO CInt
-- hProfile : INT_PTR* -> Ptr CIntPtr
-- nProfiles : DWORD -> Word32
-- padwIntent : DWORD* -> Ptr Word32
-- nIntents : DWORD -> Word32
-- dwFlags : DWORD -> Word32
-- pProfileData : BYTE** out -> Ptr Word8
-- indexPreferredCMM : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createdevicelinkprofile =
foreign "CreateDeviceLinkProfile"
((ptr intptr_t) @-> uint32_t @-> (ptr uint32_t) @-> uint32_t @-> uint32_t @-> (ptr uint8_t) @-> uint32_t @-> returning int32_t)
(* hProfile : INT_PTR* -> (ptr intptr_t) *)
(* nProfiles : DWORD -> uint32_t *)
(* padwIntent : DWORD* -> (ptr uint32_t) *)
(* nIntents : DWORD -> uint32_t *)
(* dwFlags : DWORD -> uint32_t *)
(* pProfileData : BYTE** out -> (ptr uint8_t) *)
(* indexPreferredCMM : 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 ("CreateDeviceLinkProfile" create-device-link-profile :convention :stdcall) :int32
(h-profile :pointer) ; INT_PTR*
(n-profiles :uint32) ; DWORD
(padw-intent :pointer) ; DWORD*
(n-intents :uint32) ; DWORD
(dw-flags :uint32) ; DWORD
(p-profile-data :pointer) ; BYTE** out
(index-preferred-cmm :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreateDeviceLinkProfile = Win32::API::More->new('mscms',
'BOOL CreateDeviceLinkProfile(LPVOID hProfile, DWORD nProfiles, LPVOID padwIntent, DWORD nIntents, DWORD dwFlags, LPVOID pProfileData, DWORD indexPreferredCMM)');
# my $ret = $CreateDeviceLinkProfile->Call($hProfile, $nProfiles, $padwIntent, $nIntents, $dwFlags, $pProfileData, $indexPreferredCMM);
# hProfile : INT_PTR* -> LPVOID
# nProfiles : DWORD -> DWORD
# padwIntent : DWORD* -> LPVOID
# nIntents : DWORD -> DWORD
# dwFlags : DWORD -> DWORD
# pProfileData : BYTE** out -> LPVOID
# indexPreferredCMM : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。