Win32 API 日本語リファレンス
ホームSystem.DeveloperLicensing › CheckDeveloperLicense

CheckDeveloperLicense

関数
開発者ライセンスの有効性と有効期限を確認する。
DLLWSClient.dll呼出規約winapi

シグネチャ

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

HRESULT CheckDeveloperLicense(
    FILETIME* pExpiration
);

パラメーター

名前方向説明
pExpirationFILETIME*out有効な開発者ライセンスの有効期限を受け取るFILETIMEポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CheckDeveloperLicense(
    FILETIME* pExpiration
);
[DllImport("WSClient.dll", ExactSpelling = true)]
static extern int CheckDeveloperLicense(
    IntPtr pExpiration   // FILETIME* out
);
<DllImport("WSClient.dll", ExactSpelling:=True)>
Public Shared Function CheckDeveloperLicense(
    pExpiration As IntPtr   ' FILETIME* out
) As Integer
End Function
' pExpiration : FILETIME* out
Declare PtrSafe Function CheckDeveloperLicense Lib "wsclient" ( _
    ByVal pExpiration As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CheckDeveloperLicense = ctypes.windll.wsclient.CheckDeveloperLicense
CheckDeveloperLicense.restype = ctypes.c_int
CheckDeveloperLicense.argtypes = [
    ctypes.c_void_p,  # pExpiration : FILETIME* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wsclient = windows.NewLazySystemDLL("WSClient.dll")
	procCheckDeveloperLicense = wsclient.NewProc("CheckDeveloperLicense")
)

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

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

typedef CheckDeveloperLicenseNative = Int32 Function(Pointer<Void>);
typedef CheckDeveloperLicenseDart = int Function(Pointer<Void>);
final CheckDeveloperLicense = DynamicLibrary.open('WSClient.dll')
    .lookupFunction<CheckDeveloperLicenseNative, CheckDeveloperLicenseDart>('CheckDeveloperLicense');
// pExpiration : FILETIME* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CheckDeveloperLicense(
  pExpiration: Pointer   // FILETIME* out
): Integer; stdcall;
  external 'WSClient.dll' name 'CheckDeveloperLicense';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CheckDeveloperLicense"
  c_CheckDeveloperLicense :: Ptr () -> IO Int32
-- pExpiration : FILETIME* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let checkdeveloperlicense =
  foreign "CheckDeveloperLicense"
    ((ptr void) @-> returning int32_t)
(* pExpiration : FILETIME* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wsclient (t "WSClient.dll"))
(cffi:use-foreign-library wsclient)

(cffi:defcfun ("CheckDeveloperLicense" check-developer-license :convention :stdcall) :int32
  (p-expiration :pointer))   ; FILETIME* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CheckDeveloperLicense = Win32::API::More->new('WSClient',
    'int CheckDeveloperLicense(LPVOID pExpiration)');
# my $ret = $CheckDeveloperLicense->Call($pExpiration);
# pExpiration : FILETIME* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型