ホーム › System.SystemInformation › GetSystemLeapSecondInformation
GetSystemLeapSecondInformation
関数うるう秒の有効状態と関連フラグを取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL GetSystemLeapSecondInformation(
BOOL* Enabled,
DWORD* Flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Enabled | BOOL* | out |
| Flags | DWORD* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL GetSystemLeapSecondInformation(
BOOL* Enabled,
DWORD* Flags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool GetSystemLeapSecondInformation(
out int Enabled, // BOOL* out
out uint Flags // DWORD* out
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetSystemLeapSecondInformation(
<Out> ByRef Enabled As Integer, ' BOOL* out
<Out> ByRef Flags As UInteger ' DWORD* out
) As Boolean
End Function' Enabled : BOOL* out
' Flags : DWORD* out
Declare PtrSafe Function GetSystemLeapSecondInformation Lib "kernel32" ( _
ByRef Enabled As Long, _
ByRef Flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetSystemLeapSecondInformation = ctypes.windll.kernel32.GetSystemLeapSecondInformation
GetSystemLeapSecondInformation.restype = wintypes.BOOL
GetSystemLeapSecondInformation.argtypes = [
ctypes.c_void_p, # Enabled : BOOL* out
ctypes.POINTER(wintypes.DWORD), # Flags : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetSystemLeapSecondInformation = Fiddle::Function.new(
lib['GetSystemLeapSecondInformation'],
[
Fiddle::TYPE_VOIDP, # Enabled : BOOL* out
Fiddle::TYPE_VOIDP, # Flags : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetSystemLeapSecondInformation(
Enabled: *mut i32, // BOOL* out
Flags: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool GetSystemLeapSecondInformation(out int Enabled, out uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetSystemLeapSecondInformation' -Namespace Win32 -PassThru
# $api::GetSystemLeapSecondInformation(Enabled, Flags)#uselib "KERNEL32.dll"
#func global GetSystemLeapSecondInformation "GetSystemLeapSecondInformation" sptr, sptr
; GetSystemLeapSecondInformation Enabled, varptr(Flags) ; 戻り値は stat
; Enabled : BOOL* out -> "sptr"
; Flags : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global GetSystemLeapSecondInformation "GetSystemLeapSecondInformation" int, var ; res = GetSystemLeapSecondInformation(Enabled, Flags) ; Enabled : BOOL* out -> "int" ; Flags : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global GetSystemLeapSecondInformation "GetSystemLeapSecondInformation" int, sptr ; res = GetSystemLeapSecondInformation(Enabled, varptr(Flags)) ; Enabled : BOOL* out -> "int" ; Flags : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetSystemLeapSecondInformation(BOOL* Enabled, DWORD* Flags) #uselib "KERNEL32.dll" #cfunc global GetSystemLeapSecondInformation "GetSystemLeapSecondInformation" int, var ; res = GetSystemLeapSecondInformation(Enabled, Flags) ; Enabled : BOOL* out -> "int" ; Flags : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetSystemLeapSecondInformation(BOOL* Enabled, DWORD* Flags) #uselib "KERNEL32.dll" #cfunc global GetSystemLeapSecondInformation "GetSystemLeapSecondInformation" int, intptr ; res = GetSystemLeapSecondInformation(Enabled, varptr(Flags)) ; Enabled : BOOL* out -> "int" ; Flags : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetSystemLeapSecondInformation = kernel32.NewProc("GetSystemLeapSecondInformation")
)
// Enabled (BOOL* out), Flags (DWORD* out)
r1, _, err := procGetSystemLeapSecondInformation.Call(
uintptr(Enabled),
uintptr(Flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetSystemLeapSecondInformation(
Enabled: Pointer; // BOOL* out
Flags: Pointer // DWORD* out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'GetSystemLeapSecondInformation';result := DllCall("KERNEL32\GetSystemLeapSecondInformation"
, "Ptr", Enabled ; BOOL* out
, "Ptr", Flags ; DWORD* out
, "Int") ; return: BOOL●GetSystemLeapSecondInformation(Enabled, Flags) = DLL("KERNEL32.dll", "bool GetSystemLeapSecondInformation(void*, void*)")
# 呼び出し: GetSystemLeapSecondInformation(Enabled, Flags)
# Enabled : BOOL* out -> "void*"
# Flags : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。