ホーム › Security.Authentication.Identity › SLActivateProduct
SLActivateProduct
関数製品SKUをライセンスサーバー経由でアクティブ化する。
シグネチャ
// slcext.dll
#include <windows.h>
HRESULT SLActivateProduct(
void* hSLC,
const GUID* pProductSkuId,
DWORD cbAppSpecificData, // optional
const void* pvAppSpecificData, // optional
const SL_ACTIVATION_INFO_HEADER* pActivationInfo, // optional
LPCWSTR pwszProxyServer, // optional
WORD wProxyPort // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hSLC | void* | in | SLOpenで取得したSLCハンドル。 |
| pProductSkuId | GUID* | in | ライセンス認証する製品SKUを識別するGUIDへのポインタ。 |
| cbAppSpecificData | DWORD | inoptional | pvAppSpecificDataのバイト長。データが無い場合は0。 |
| pvAppSpecificData | void* | inoptional | アプリケーション固有の認証データへのポインタ。NULL可。 |
| pActivationInfo | SL_ACTIVATION_INFO_HEADER* | inoptional | 認証情報を保持するSL_ACTIVATION_INFO_HEADER構造体へのポインタ。NULL可。 |
| pwszProxyServer | LPCWSTR | inoptional | 認証時に使用するプロキシサーバー名を指すUnicode文字列。NULL可。 |
| wProxyPort | WORD | inoptional | プロキシサーバーのポート番号。0で既定ポート。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// slcext.dll
#include <windows.h>
HRESULT SLActivateProduct(
void* hSLC,
const GUID* pProductSkuId,
DWORD cbAppSpecificData, // optional
const void* pvAppSpecificData, // optional
const SL_ACTIVATION_INFO_HEADER* pActivationInfo, // optional
LPCWSTR pwszProxyServer, // optional
WORD wProxyPort // optional
);[DllImport("slcext.dll", ExactSpelling = true)]
static extern int SLActivateProduct(
IntPtr hSLC, // void*
ref Guid pProductSkuId, // GUID*
uint cbAppSpecificData, // DWORD optional
IntPtr pvAppSpecificData, // void* optional
IntPtr pActivationInfo, // SL_ACTIVATION_INFO_HEADER* optional
[MarshalAs(UnmanagedType.LPWStr)] string pwszProxyServer, // LPCWSTR optional
ushort wProxyPort // WORD optional
);<DllImport("slcext.dll", ExactSpelling:=True)>
Public Shared Function SLActivateProduct(
hSLC As IntPtr, ' void*
ByRef pProductSkuId As Guid, ' GUID*
cbAppSpecificData As UInteger, ' DWORD optional
pvAppSpecificData As IntPtr, ' void* optional
pActivationInfo As IntPtr, ' SL_ACTIVATION_INFO_HEADER* optional
<MarshalAs(UnmanagedType.LPWStr)> pwszProxyServer As String, ' LPCWSTR optional
wProxyPort As UShort ' WORD optional
) As Integer
End Function' hSLC : void*
' pProductSkuId : GUID*
' cbAppSpecificData : DWORD optional
' pvAppSpecificData : void* optional
' pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional
' pwszProxyServer : LPCWSTR optional
' wProxyPort : WORD optional
Declare PtrSafe Function SLActivateProduct Lib "slcext" ( _
ByVal hSLC As LongPtr, _
ByVal pProductSkuId As LongPtr, _
ByVal cbAppSpecificData As Long, _
ByVal pvAppSpecificData As LongPtr, _
ByVal pActivationInfo As LongPtr, _
ByVal pwszProxyServer As LongPtr, _
ByVal wProxyPort As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SLActivateProduct = ctypes.windll.slcext.SLActivateProduct
SLActivateProduct.restype = ctypes.c_int
SLActivateProduct.argtypes = [
ctypes.POINTER(None), # hSLC : void*
ctypes.c_void_p, # pProductSkuId : GUID*
wintypes.DWORD, # cbAppSpecificData : DWORD optional
ctypes.POINTER(None), # pvAppSpecificData : void* optional
ctypes.c_void_p, # pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional
wintypes.LPCWSTR, # pwszProxyServer : LPCWSTR optional
ctypes.c_ushort, # wProxyPort : WORD optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('slcext.dll')
SLActivateProduct = Fiddle::Function.new(
lib['SLActivateProduct'],
[
Fiddle::TYPE_VOIDP, # hSLC : void*
Fiddle::TYPE_VOIDP, # pProductSkuId : GUID*
-Fiddle::TYPE_INT, # cbAppSpecificData : DWORD optional
Fiddle::TYPE_VOIDP, # pvAppSpecificData : void* optional
Fiddle::TYPE_VOIDP, # pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional
Fiddle::TYPE_VOIDP, # pwszProxyServer : LPCWSTR optional
-Fiddle::TYPE_SHORT, # wProxyPort : WORD optional
],
Fiddle::TYPE_INT)#[link(name = "slcext")]
extern "system" {
fn SLActivateProduct(
hSLC: *mut (), // void*
pProductSkuId: *const GUID, // GUID*
cbAppSpecificData: u32, // DWORD optional
pvAppSpecificData: *const (), // void* optional
pActivationInfo: *const SL_ACTIVATION_INFO_HEADER, // SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer: *const u16, // LPCWSTR optional
wProxyPort: u16 // WORD optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("slcext.dll")]
public static extern int SLActivateProduct(IntPtr hSLC, ref Guid pProductSkuId, uint cbAppSpecificData, IntPtr pvAppSpecificData, IntPtr pActivationInfo, [MarshalAs(UnmanagedType.LPWStr)] string pwszProxyServer, ushort wProxyPort);
"@
$api = Add-Type -MemberDefinition $sig -Name 'slcext_SLActivateProduct' -Namespace Win32 -PassThru
# $api::SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)#uselib "slcext.dll"
#func global SLActivateProduct "SLActivateProduct" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SLActivateProduct hSLC, varptr(pProductSkuId), cbAppSpecificData, pvAppSpecificData, varptr(pActivationInfo), pwszProxyServer, wProxyPort ; 戻り値は stat
; hSLC : void* -> "sptr"
; pProductSkuId : GUID* -> "sptr"
; cbAppSpecificData : DWORD optional -> "sptr"
; pvAppSpecificData : void* optional -> "sptr"
; pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "sptr"
; pwszProxyServer : LPCWSTR optional -> "sptr"
; wProxyPort : WORD optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "slcext.dll" #cfunc global SLActivateProduct "SLActivateProduct" sptr, var, int, sptr, var, wstr, int ; res = SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort) ; hSLC : void* -> "sptr" ; pProductSkuId : GUID* -> "var" ; cbAppSpecificData : DWORD optional -> "int" ; pvAppSpecificData : void* optional -> "sptr" ; pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "var" ; pwszProxyServer : LPCWSTR optional -> "wstr" ; wProxyPort : WORD optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "slcext.dll" #cfunc global SLActivateProduct "SLActivateProduct" sptr, sptr, int, sptr, sptr, wstr, int ; res = SLActivateProduct(hSLC, varptr(pProductSkuId), cbAppSpecificData, pvAppSpecificData, varptr(pActivationInfo), pwszProxyServer, wProxyPort) ; hSLC : void* -> "sptr" ; pProductSkuId : GUID* -> "sptr" ; cbAppSpecificData : DWORD optional -> "int" ; pvAppSpecificData : void* optional -> "sptr" ; pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "sptr" ; pwszProxyServer : LPCWSTR optional -> "wstr" ; wProxyPort : WORD optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SLActivateProduct(void* hSLC, GUID* pProductSkuId, DWORD cbAppSpecificData, void* pvAppSpecificData, SL_ACTIVATION_INFO_HEADER* pActivationInfo, LPCWSTR pwszProxyServer, WORD wProxyPort) #uselib "slcext.dll" #cfunc global SLActivateProduct "SLActivateProduct" intptr, var, int, intptr, var, wstr, int ; res = SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort) ; hSLC : void* -> "intptr" ; pProductSkuId : GUID* -> "var" ; cbAppSpecificData : DWORD optional -> "int" ; pvAppSpecificData : void* optional -> "intptr" ; pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "var" ; pwszProxyServer : LPCWSTR optional -> "wstr" ; wProxyPort : WORD optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SLActivateProduct(void* hSLC, GUID* pProductSkuId, DWORD cbAppSpecificData, void* pvAppSpecificData, SL_ACTIVATION_INFO_HEADER* pActivationInfo, LPCWSTR pwszProxyServer, WORD wProxyPort) #uselib "slcext.dll" #cfunc global SLActivateProduct "SLActivateProduct" intptr, intptr, int, intptr, intptr, wstr, int ; res = SLActivateProduct(hSLC, varptr(pProductSkuId), cbAppSpecificData, pvAppSpecificData, varptr(pActivationInfo), pwszProxyServer, wProxyPort) ; hSLC : void* -> "intptr" ; pProductSkuId : GUID* -> "intptr" ; cbAppSpecificData : DWORD optional -> "int" ; pvAppSpecificData : void* optional -> "intptr" ; pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "intptr" ; pwszProxyServer : LPCWSTR optional -> "wstr" ; wProxyPort : WORD optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
slcext = windows.NewLazySystemDLL("slcext.dll")
procSLActivateProduct = slcext.NewProc("SLActivateProduct")
)
// hSLC (void*), pProductSkuId (GUID*), cbAppSpecificData (DWORD optional), pvAppSpecificData (void* optional), pActivationInfo (SL_ACTIVATION_INFO_HEADER* optional), pwszProxyServer (LPCWSTR optional), wProxyPort (WORD optional)
r1, _, err := procSLActivateProduct.Call(
uintptr(hSLC),
uintptr(pProductSkuId),
uintptr(cbAppSpecificData),
uintptr(pvAppSpecificData),
uintptr(pActivationInfo),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszProxyServer))),
uintptr(wProxyPort),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SLActivateProduct(
hSLC: Pointer; // void*
pProductSkuId: PGUID; // GUID*
cbAppSpecificData: DWORD; // DWORD optional
pvAppSpecificData: Pointer; // void* optional
pActivationInfo: Pointer; // SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer: PWideChar; // LPCWSTR optional
wProxyPort: Word // WORD optional
): Integer; stdcall;
external 'slcext.dll' name 'SLActivateProduct';result := DllCall("slcext\SLActivateProduct"
, "Ptr", hSLC ; void*
, "Ptr", pProductSkuId ; GUID*
, "UInt", cbAppSpecificData ; DWORD optional
, "Ptr", pvAppSpecificData ; void* optional
, "Ptr", pActivationInfo ; SL_ACTIVATION_INFO_HEADER* optional
, "WStr", pwszProxyServer ; LPCWSTR optional
, "UShort", wProxyPort ; WORD optional
, "Int") ; return: HRESULT●SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort) = DLL("slcext.dll", "int SLActivateProduct(void*, void*, dword, void*, void*, char*, int)")
# 呼び出し: SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)
# hSLC : void* -> "void*"
# pProductSkuId : GUID* -> "void*"
# cbAppSpecificData : DWORD optional -> "dword"
# pvAppSpecificData : void* optional -> "void*"
# pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "void*"
# pwszProxyServer : LPCWSTR optional -> "char*"
# wProxyPort : WORD optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "slcext" fn SLActivateProduct(
hSLC: ?*anyopaque, // void*
pProductSkuId: [*c]GUID, // GUID*
cbAppSpecificData: u32, // DWORD optional
pvAppSpecificData: ?*anyopaque, // void* optional
pActivationInfo: [*c]SL_ACTIVATION_INFO_HEADER, // SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer: [*c]const u16, // LPCWSTR optional
wProxyPort: u16 // WORD optional
) callconv(std.os.windows.WINAPI) i32;proc SLActivateProduct(
hSLC: pointer, # void*
pProductSkuId: ptr GUID, # GUID*
cbAppSpecificData: uint32, # DWORD optional
pvAppSpecificData: pointer, # void* optional
pActivationInfo: ptr SL_ACTIVATION_INFO_HEADER, # SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer: WideCString, # LPCWSTR optional
wProxyPort: uint16 # WORD optional
): int32 {.importc: "SLActivateProduct", stdcall, dynlib: "slcext.dll".}pragma(lib, "slcext");
extern(Windows)
int SLActivateProduct(
void* hSLC, // void*
GUID* pProductSkuId, // GUID*
uint cbAppSpecificData, // DWORD optional
void* pvAppSpecificData, // void* optional
SL_ACTIVATION_INFO_HEADER* pActivationInfo, // SL_ACTIVATION_INFO_HEADER* optional
const(wchar)* pwszProxyServer, // LPCWSTR optional
ushort wProxyPort // WORD optional
);ccall((:SLActivateProduct, "slcext.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{GUID}, UInt32, Ptr{Cvoid}, Ptr{SL_ACTIVATION_INFO_HEADER}, Cwstring, UInt16),
hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)
# hSLC : void* -> Ptr{Cvoid}
# pProductSkuId : GUID* -> Ptr{GUID}
# cbAppSpecificData : DWORD optional -> UInt32
# pvAppSpecificData : void* optional -> Ptr{Cvoid}
# pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> Ptr{SL_ACTIVATION_INFO_HEADER}
# pwszProxyServer : LPCWSTR optional -> Cwstring
# wProxyPort : WORD optional -> UInt16
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SLActivateProduct(
void* hSLC,
void* pProductSkuId,
uint32_t cbAppSpecificData,
void* pvAppSpecificData,
void* pActivationInfo,
const uint16_t* pwszProxyServer,
uint16_t wProxyPort);
]]
local slcext = ffi.load("slcext")
-- slcext.SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)
-- hSLC : void*
-- pProductSkuId : GUID*
-- cbAppSpecificData : DWORD optional
-- pvAppSpecificData : void* optional
-- pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional
-- pwszProxyServer : LPCWSTR optional
-- wProxyPort : WORD optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('slcext.dll');
const SLActivateProduct = lib.func('__stdcall', 'SLActivateProduct', 'int32_t', ['void *', 'void *', 'uint32_t', 'void *', 'void *', 'str16', 'uint16_t']);
// SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)
// hSLC : void* -> 'void *'
// pProductSkuId : GUID* -> 'void *'
// cbAppSpecificData : DWORD optional -> 'uint32_t'
// pvAppSpecificData : void* optional -> 'void *'
// pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> 'void *'
// pwszProxyServer : LPCWSTR optional -> 'str16'
// wProxyPort : WORD optional -> 'uint16_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("slcext.dll", {
SLActivateProduct: { parameters: ["pointer", "pointer", "u32", "pointer", "pointer", "buffer", "u16"], result: "i32" },
});
// lib.symbols.SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort)
// hSLC : void* -> "pointer"
// pProductSkuId : GUID* -> "pointer"
// cbAppSpecificData : DWORD optional -> "u32"
// pvAppSpecificData : void* optional -> "pointer"
// pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> "pointer"
// pwszProxyServer : LPCWSTR optional -> "buffer"
// wProxyPort : WORD optional -> "u16"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SLActivateProduct(
void* hSLC,
void* pProductSkuId,
uint32_t cbAppSpecificData,
void* pvAppSpecificData,
void* pActivationInfo,
const uint16_t* pwszProxyServer,
uint16_t wProxyPort);
C, "slcext.dll");
// $ffi->SLActivateProduct(hSLC, pProductSkuId, cbAppSpecificData, pvAppSpecificData, pActivationInfo, pwszProxyServer, wProxyPort);
// hSLC : void*
// pProductSkuId : GUID*
// cbAppSpecificData : DWORD optional
// pvAppSpecificData : void* optional
// pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional
// pwszProxyServer : LPCWSTR optional
// wProxyPort : WORD optional
// 構造体/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 Slcext extends StdCallLibrary {
Slcext INSTANCE = Native.load("slcext", Slcext.class);
int SLActivateProduct(
Pointer hSLC, // void*
Pointer pProductSkuId, // GUID*
int cbAppSpecificData, // DWORD optional
Pointer pvAppSpecificData, // void* optional
Pointer pActivationInfo, // SL_ACTIVATION_INFO_HEADER* optional
WString pwszProxyServer, // LPCWSTR optional
short wProxyPort // WORD optional
);
}@[Link("slcext")]
lib Libslcext
fun SLActivateProduct = SLActivateProduct(
hSLC : Void*, # void*
pProductSkuId : GUID*, # GUID*
cbAppSpecificData : UInt32, # DWORD optional
pvAppSpecificData : Void*, # void* optional
pActivationInfo : SL_ACTIVATION_INFO_HEADER*, # SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer : UInt16*, # LPCWSTR optional
wProxyPort : UInt16 # WORD optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SLActivateProductNative = Int32 Function(Pointer<Void>, Pointer<Void>, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Uint16);
typedef SLActivateProductDart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Void>, Pointer<Void>, Pointer<Utf16>, int);
final SLActivateProduct = DynamicLibrary.open('slcext.dll')
.lookupFunction<SLActivateProductNative, SLActivateProductDart>('SLActivateProduct');
// hSLC : void* -> Pointer<Void>
// pProductSkuId : GUID* -> Pointer<Void>
// cbAppSpecificData : DWORD optional -> Uint32
// pvAppSpecificData : void* optional -> Pointer<Void>
// pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> Pointer<Void>
// pwszProxyServer : LPCWSTR optional -> Pointer<Utf16>
// wProxyPort : WORD optional -> Uint16
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SLActivateProduct(
hSLC: Pointer; // void*
pProductSkuId: PGUID; // GUID*
cbAppSpecificData: DWORD; // DWORD optional
pvAppSpecificData: Pointer; // void* optional
pActivationInfo: Pointer; // SL_ACTIVATION_INFO_HEADER* optional
pwszProxyServer: PWideChar; // LPCWSTR optional
wProxyPort: Word // WORD optional
): Integer; stdcall;
external 'slcext.dll' name 'SLActivateProduct';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SLActivateProduct"
c_SLActivateProduct :: Ptr () -> Ptr () -> Word32 -> Ptr () -> Ptr () -> CWString -> Word16 -> IO Int32
-- hSLC : void* -> Ptr ()
-- pProductSkuId : GUID* -> Ptr ()
-- cbAppSpecificData : DWORD optional -> Word32
-- pvAppSpecificData : void* optional -> Ptr ()
-- pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> Ptr ()
-- pwszProxyServer : LPCWSTR optional -> CWString
-- wProxyPort : WORD optional -> Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let slactivateproduct =
foreign "SLActivateProduct"
((ptr void) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> uint16_t @-> returning int32_t)
(* hSLC : void* -> (ptr void) *)
(* pProductSkuId : GUID* -> (ptr void) *)
(* cbAppSpecificData : DWORD optional -> uint32_t *)
(* pvAppSpecificData : void* optional -> (ptr void) *)
(* pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> (ptr void) *)
(* pwszProxyServer : LPCWSTR optional -> (ptr uint16_t) *)
(* wProxyPort : WORD optional -> uint16_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library slcext (t "slcext.dll"))
(cffi:use-foreign-library slcext)
(cffi:defcfun ("SLActivateProduct" slactivate-product :convention :stdcall) :int32
(h-slc :pointer) ; void*
(p-product-sku-id :pointer) ; GUID*
(cb-app-specific-data :uint32) ; DWORD optional
(pv-app-specific-data :pointer) ; void* optional
(p-activation-info :pointer) ; SL_ACTIVATION_INFO_HEADER* optional
(pwsz-proxy-server (:string :encoding :utf-16le)) ; LPCWSTR optional
(w-proxy-port :uint16)) ; WORD optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SLActivateProduct = Win32::API::More->new('slcext',
'int SLActivateProduct(LPVOID hSLC, LPVOID pProductSkuId, DWORD cbAppSpecificData, LPVOID pvAppSpecificData, LPVOID pActivationInfo, LPCWSTR pwszProxyServer, WORD wProxyPort)');
# my $ret = $SLActivateProduct->Call($hSLC, $pProductSkuId, $cbAppSpecificData, $pvAppSpecificData, $pActivationInfo, $pwszProxyServer, $wProxyPort);
# hSLC : void* -> LPVOID
# pProductSkuId : GUID* -> LPVOID
# cbAppSpecificData : DWORD optional -> DWORD
# pvAppSpecificData : void* optional -> LPVOID
# pActivationInfo : SL_ACTIVATION_INFO_HEADER* optional -> LPVOID
# pwszProxyServer : LPCWSTR optional -> LPCWSTR
# wProxyPort : WORD optional -> WORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。