Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SLUninstallProofOfPurchase

SLUninstallProofOfPurchase

関数
インストール済みの購入証明をライセンスシステムから削除する。
DLLSLC.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT SLUninstallProofOfPurchase(
    void* hSLC,
    const GUID* pPKeyId
);

パラメーター

名前方向説明
hSLCvoid*inSLOpenで取得したSLCハンドル。
pPKeyIdGUID*inアンインストール対象のプロダクトキーを識別するGUIDへのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SLUninstallProofOfPurchase(
    void* hSLC,
    const GUID* pPKeyId
);
[DllImport("SLC.dll", ExactSpelling = true)]
static extern int SLUninstallProofOfPurchase(
    IntPtr hSLC,   // void*
    ref Guid pPKeyId   // GUID*
);
<DllImport("SLC.dll", ExactSpelling:=True)>
Public Shared Function SLUninstallProofOfPurchase(
    hSLC As IntPtr,   ' void*
    ByRef pPKeyId As Guid   ' GUID*
) As Integer
End Function
' hSLC : void*
' pPKeyId : GUID*
Declare PtrSafe Function SLUninstallProofOfPurchase Lib "slc" ( _
    ByVal hSLC As LongPtr, _
    ByVal pPKeyId As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SLUninstallProofOfPurchase = ctypes.windll.slc.SLUninstallProofOfPurchase
SLUninstallProofOfPurchase.restype = ctypes.c_int
SLUninstallProofOfPurchase.argtypes = [
    ctypes.POINTER(None),  # hSLC : void*
    ctypes.c_void_p,  # pPKeyId : GUID*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	slc = windows.NewLazySystemDLL("SLC.dll")
	procSLUninstallProofOfPurchase = slc.NewProc("SLUninstallProofOfPurchase")
)

// hSLC (void*), pPKeyId (GUID*)
r1, _, err := procSLUninstallProofOfPurchase.Call(
	uintptr(hSLC),
	uintptr(pPKeyId),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SLUninstallProofOfPurchase(
  hSLC: Pointer;   // void*
  pPKeyId: PGUID   // GUID*
): Integer; stdcall;
  external 'SLC.dll' name 'SLUninstallProofOfPurchase';
result := DllCall("SLC\SLUninstallProofOfPurchase"
    , "Ptr", hSLC   ; void*
    , "Ptr", pPKeyId   ; GUID*
    , "Int")   ; return: HRESULT
●SLUninstallProofOfPurchase(hSLC, pPKeyId) = DLL("SLC.dll", "int SLUninstallProofOfPurchase(void*, void*)")
# 呼び出し: SLUninstallProofOfPurchase(hSLC, pPKeyId)
# hSLC : void* -> "void*"
# pPKeyId : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef SLUninstallProofOfPurchaseNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef SLUninstallProofOfPurchaseDart = int Function(Pointer<Void>, Pointer<Void>);
final SLUninstallProofOfPurchase = DynamicLibrary.open('SLC.dll')
    .lookupFunction<SLUninstallProofOfPurchaseNative, SLUninstallProofOfPurchaseDart>('SLUninstallProofOfPurchase');
// hSLC : void* -> Pointer<Void>
// pPKeyId : GUID* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SLUninstallProofOfPurchase(
  hSLC: Pointer;   // void*
  pPKeyId: PGUID   // GUID*
): Integer; stdcall;
  external 'SLC.dll' name 'SLUninstallProofOfPurchase';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SLUninstallProofOfPurchase"
  c_SLUninstallProofOfPurchase :: Ptr () -> Ptr () -> IO Int32
-- hSLC : void* -> Ptr ()
-- pPKeyId : GUID* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let sluninstallproofofpurchase =
  foreign "SLUninstallProofOfPurchase"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* hSLC : void* -> (ptr void) *)
(* pPKeyId : GUID* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library slc (t "SLC.dll"))
(cffi:use-foreign-library slc)

(cffi:defcfun ("SLUninstallProofOfPurchase" sluninstall-proof-of-purchase :convention :stdcall) :int32
  (h-slc :pointer)   ; void*
  (p-pkey-id :pointer))   ; GUID*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SLUninstallProofOfPurchase = Win32::API::More->new('SLC',
    'int SLUninstallProofOfPurchase(LPVOID hSLC, LPVOID pPKeyId)');
# my $ret = $SLUninstallProofOfPurchase->Call($hSLC, $pPKeyId);
# hSLC : void* -> LPVOID
# pPKeyId : GUID* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。