Win32 API 日本語リファレンス
ホームUI.ColorSystem › CMCreateDeviceLinkProfile

CMCreateDeviceLinkProfile

関数
CMMでデバイスリンクプロファイルを作成する。
DLLICM32.dll呼出規約winapi

シグネチャ

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

BOOL CMCreateDeviceLinkProfile(
    INT_PTR* pahProfiles,
    DWORD nProfiles,
    DWORD* padwIntents,
    DWORD nIntents,
    DWORD dwFlags,
    BYTE** lpProfileData
);

パラメーター

名前方向
pahProfilesINT_PTR*in
nProfilesDWORDin
padwIntentsDWORD*in
nIntentsDWORDin
dwFlagsDWORDin
lpProfileDataBYTE**out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL CMCreateDeviceLinkProfile(
    INT_PTR* pahProfiles,
    DWORD nProfiles,
    DWORD* padwIntents,
    DWORD nIntents,
    DWORD dwFlags,
    BYTE** lpProfileData
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ICM32.dll", ExactSpelling = true)]
static extern bool CMCreateDeviceLinkProfile(
    ref IntPtr pahProfiles,   // INT_PTR*
    uint nProfiles,   // DWORD
    ref uint padwIntents,   // DWORD*
    uint nIntents,   // DWORD
    uint dwFlags,   // DWORD
    IntPtr lpProfileData   // BYTE** out
);
<DllImport("ICM32.dll", ExactSpelling:=True)>
Public Shared Function CMCreateDeviceLinkProfile(
    ByRef pahProfiles As IntPtr,   ' INT_PTR*
    nProfiles As UInteger,   ' DWORD
    ByRef padwIntents As UInteger,   ' DWORD*
    nIntents As UInteger,   ' DWORD
    dwFlags As UInteger,   ' DWORD
    lpProfileData As IntPtr   ' BYTE** out
) As Boolean
End Function
' pahProfiles : INT_PTR*
' nProfiles : DWORD
' padwIntents : DWORD*
' nIntents : DWORD
' dwFlags : DWORD
' lpProfileData : BYTE** out
Declare PtrSafe Function CMCreateDeviceLinkProfile Lib "icm32" ( _
    ByRef pahProfiles As LongPtr, _
    ByVal nProfiles As Long, _
    ByRef padwIntents As Long, _
    ByVal nIntents As Long, _
    ByVal dwFlags As Long, _
    ByVal lpProfileData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CMCreateDeviceLinkProfile = ctypes.windll.icm32.CMCreateDeviceLinkProfile
CMCreateDeviceLinkProfile.restype = wintypes.BOOL
CMCreateDeviceLinkProfile.argtypes = [
    ctypes.POINTER(ctypes.c_ssize_t),  # pahProfiles : INT_PTR*
    wintypes.DWORD,  # nProfiles : DWORD
    ctypes.POINTER(wintypes.DWORD),  # padwIntents : DWORD*
    wintypes.DWORD,  # nIntents : DWORD
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.c_void_p,  # lpProfileData : BYTE** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icm32 = windows.NewLazySystemDLL("ICM32.dll")
	procCMCreateDeviceLinkProfile = icm32.NewProc("CMCreateDeviceLinkProfile")
)

// pahProfiles (INT_PTR*), nProfiles (DWORD), padwIntents (DWORD*), nIntents (DWORD), dwFlags (DWORD), lpProfileData (BYTE** out)
r1, _, err := procCMCreateDeviceLinkProfile.Call(
	uintptr(pahProfiles),
	uintptr(nProfiles),
	uintptr(padwIntents),
	uintptr(nIntents),
	uintptr(dwFlags),
	uintptr(lpProfileData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CMCreateDeviceLinkProfile(
  pahProfiles: Pointer;   // INT_PTR*
  nProfiles: DWORD;   // DWORD
  padwIntents: Pointer;   // DWORD*
  nIntents: DWORD;   // DWORD
  dwFlags: DWORD;   // DWORD
  lpProfileData: Pointer   // BYTE** out
): BOOL; stdcall;
  external 'ICM32.dll' name 'CMCreateDeviceLinkProfile';
result := DllCall("ICM32\CMCreateDeviceLinkProfile"
    , "Ptr", pahProfiles   ; INT_PTR*
    , "UInt", nProfiles   ; DWORD
    , "Ptr", padwIntents   ; DWORD*
    , "UInt", nIntents   ; DWORD
    , "UInt", dwFlags   ; DWORD
    , "Ptr", lpProfileData   ; BYTE** out
    , "Int")   ; return: BOOL
●CMCreateDeviceLinkProfile(pahProfiles, nProfiles, padwIntents, nIntents, dwFlags, lpProfileData) = DLL("ICM32.dll", "bool CMCreateDeviceLinkProfile(void*, dword, void*, dword, dword, void*)")
# 呼び出し: CMCreateDeviceLinkProfile(pahProfiles, nProfiles, padwIntents, nIntents, dwFlags, lpProfileData)
# pahProfiles : INT_PTR* -> "void*"
# nProfiles : DWORD -> "dword"
# padwIntents : DWORD* -> "void*"
# nIntents : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# lpProfileData : BYTE** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。