ホーム › System.Time › EnumDynamicTimeZoneInformation
EnumDynamicTimeZoneInformation
関数レジストリ登録の動的タイムゾーン情報を順に列挙する。
シグネチャ
// ADVAPI32.dll
#include <windows.h>
DWORD EnumDynamicTimeZoneInformation(
DWORD dwIndex,
DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwIndex | DWORD | in | 列挙するタイムゾーンの0始まりインデックス。順次インクリメントして反復する。 |
| lpTimeZoneInformation | DYNAMIC_TIME_ZONE_INFORMATION* | out | 列挙されたタイムゾーン情報を受け取るDYNAMIC_TIME_ZONE_INFORMATION構造体へのポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// ADVAPI32.dll
#include <windows.h>
DWORD EnumDynamicTimeZoneInformation(
DWORD dwIndex,
DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation
);[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern uint EnumDynamicTimeZoneInformation(
uint dwIndex, // DWORD
IntPtr lpTimeZoneInformation // DYNAMIC_TIME_ZONE_INFORMATION* out
);<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Function EnumDynamicTimeZoneInformation(
dwIndex As UInteger, ' DWORD
lpTimeZoneInformation As IntPtr ' DYNAMIC_TIME_ZONE_INFORMATION* out
) As UInteger
End Function' dwIndex : DWORD
' lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out
Declare PtrSafe Function EnumDynamicTimeZoneInformation Lib "advapi32" ( _
ByVal dwIndex As Long, _
ByVal lpTimeZoneInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnumDynamicTimeZoneInformation = ctypes.windll.advapi32.EnumDynamicTimeZoneInformation
EnumDynamicTimeZoneInformation.restype = wintypes.DWORD
EnumDynamicTimeZoneInformation.argtypes = [
wintypes.DWORD, # dwIndex : DWORD
ctypes.c_void_p, # lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
EnumDynamicTimeZoneInformation = Fiddle::Function.new(
lib['EnumDynamicTimeZoneInformation'],
[
-Fiddle::TYPE_INT, # dwIndex : DWORD
Fiddle::TYPE_VOIDP, # lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out
],
-Fiddle::TYPE_INT)#[link(name = "advapi32")]
extern "system" {
fn EnumDynamicTimeZoneInformation(
dwIndex: u32, // DWORD
lpTimeZoneInformation: *mut DYNAMIC_TIME_ZONE_INFORMATION // DYNAMIC_TIME_ZONE_INFORMATION* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern uint EnumDynamicTimeZoneInformation(uint dwIndex, IntPtr lpTimeZoneInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_EnumDynamicTimeZoneInformation' -Namespace Win32 -PassThru
# $api::EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation)#uselib "ADVAPI32.dll"
#func global EnumDynamicTimeZoneInformation "EnumDynamicTimeZoneInformation" sptr, sptr
; EnumDynamicTimeZoneInformation dwIndex, varptr(lpTimeZoneInformation) ; 戻り値は stat
; dwIndex : DWORD -> "sptr"
; lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ADVAPI32.dll" #cfunc global EnumDynamicTimeZoneInformation "EnumDynamicTimeZoneInformation" int, var ; res = EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation) ; dwIndex : DWORD -> "int" ; lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #cfunc global EnumDynamicTimeZoneInformation "EnumDynamicTimeZoneInformation" int, sptr ; res = EnumDynamicTimeZoneInformation(dwIndex, varptr(lpTimeZoneInformation)) ; dwIndex : DWORD -> "int" ; lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD EnumDynamicTimeZoneInformation(DWORD dwIndex, DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation) #uselib "ADVAPI32.dll" #cfunc global EnumDynamicTimeZoneInformation "EnumDynamicTimeZoneInformation" int, var ; res = EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation) ; dwIndex : DWORD -> "int" ; lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD EnumDynamicTimeZoneInformation(DWORD dwIndex, DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation) #uselib "ADVAPI32.dll" #cfunc global EnumDynamicTimeZoneInformation "EnumDynamicTimeZoneInformation" int, intptr ; res = EnumDynamicTimeZoneInformation(dwIndex, varptr(lpTimeZoneInformation)) ; dwIndex : DWORD -> "int" ; lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procEnumDynamicTimeZoneInformation = advapi32.NewProc("EnumDynamicTimeZoneInformation")
)
// dwIndex (DWORD), lpTimeZoneInformation (DYNAMIC_TIME_ZONE_INFORMATION* out)
r1, _, err := procEnumDynamicTimeZoneInformation.Call(
uintptr(dwIndex),
uintptr(lpTimeZoneInformation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction EnumDynamicTimeZoneInformation(
dwIndex: DWORD; // DWORD
lpTimeZoneInformation: Pointer // DYNAMIC_TIME_ZONE_INFORMATION* out
): DWORD; stdcall;
external 'ADVAPI32.dll' name 'EnumDynamicTimeZoneInformation';result := DllCall("ADVAPI32\EnumDynamicTimeZoneInformation"
, "UInt", dwIndex ; DWORD
, "Ptr", lpTimeZoneInformation ; DYNAMIC_TIME_ZONE_INFORMATION* out
, "UInt") ; return: DWORD●EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation) = DLL("ADVAPI32.dll", "dword EnumDynamicTimeZoneInformation(dword, void*)")
# 呼び出し: EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation)
# dwIndex : DWORD -> "dword"
# lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "advapi32" fn EnumDynamicTimeZoneInformation(
dwIndex: u32, // DWORD
lpTimeZoneInformation: [*c]DYNAMIC_TIME_ZONE_INFORMATION // DYNAMIC_TIME_ZONE_INFORMATION* out
) callconv(std.os.windows.WINAPI) u32;proc EnumDynamicTimeZoneInformation(
dwIndex: uint32, # DWORD
lpTimeZoneInformation: ptr DYNAMIC_TIME_ZONE_INFORMATION # DYNAMIC_TIME_ZONE_INFORMATION* out
): uint32 {.importc: "EnumDynamicTimeZoneInformation", stdcall, dynlib: "ADVAPI32.dll".}pragma(lib, "advapi32");
extern(Windows)
uint EnumDynamicTimeZoneInformation(
uint dwIndex, // DWORD
DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation // DYNAMIC_TIME_ZONE_INFORMATION* out
);ccall((:EnumDynamicTimeZoneInformation, "ADVAPI32.dll"), stdcall, UInt32,
(UInt32, Ptr{DYNAMIC_TIME_ZONE_INFORMATION}),
dwIndex, lpTimeZoneInformation)
# dwIndex : DWORD -> UInt32
# lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> Ptr{DYNAMIC_TIME_ZONE_INFORMATION}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t EnumDynamicTimeZoneInformation(
uint32_t dwIndex,
void* lpTimeZoneInformation);
]]
local advapi32 = ffi.load("advapi32")
-- advapi32.EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation)
-- dwIndex : DWORD
-- lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ADVAPI32.dll');
const EnumDynamicTimeZoneInformation = lib.func('__stdcall', 'EnumDynamicTimeZoneInformation', 'uint32_t', ['uint32_t', 'void *']);
// EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation)
// dwIndex : DWORD -> 'uint32_t'
// lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ADVAPI32.dll", {
EnumDynamicTimeZoneInformation: { parameters: ["u32", "pointer"], result: "u32" },
});
// lib.symbols.EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation)
// dwIndex : DWORD -> "u32"
// lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t EnumDynamicTimeZoneInformation(
uint32_t dwIndex,
void* lpTimeZoneInformation);
C, "ADVAPI32.dll");
// $ffi->EnumDynamicTimeZoneInformation(dwIndex, lpTimeZoneInformation);
// dwIndex : DWORD
// lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* 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 Advapi32 extends StdCallLibrary {
Advapi32 INSTANCE = Native.load("advapi32", Advapi32.class);
int EnumDynamicTimeZoneInformation(
int dwIndex, // DWORD
Pointer lpTimeZoneInformation // DYNAMIC_TIME_ZONE_INFORMATION* out
);
}@[Link("advapi32")]
lib LibADVAPI32
fun EnumDynamicTimeZoneInformation = EnumDynamicTimeZoneInformation(
dwIndex : UInt32, # DWORD
lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* # DYNAMIC_TIME_ZONE_INFORMATION* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef EnumDynamicTimeZoneInformationNative = Uint32 Function(Uint32, Pointer<Void>);
typedef EnumDynamicTimeZoneInformationDart = int Function(int, Pointer<Void>);
final EnumDynamicTimeZoneInformation = DynamicLibrary.open('ADVAPI32.dll')
.lookupFunction<EnumDynamicTimeZoneInformationNative, EnumDynamicTimeZoneInformationDart>('EnumDynamicTimeZoneInformation');
// dwIndex : DWORD -> Uint32
// lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function EnumDynamicTimeZoneInformation(
dwIndex: DWORD; // DWORD
lpTimeZoneInformation: Pointer // DYNAMIC_TIME_ZONE_INFORMATION* out
): DWORD; stdcall;
external 'ADVAPI32.dll' name 'EnumDynamicTimeZoneInformation';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "EnumDynamicTimeZoneInformation"
c_EnumDynamicTimeZoneInformation :: Word32 -> Ptr () -> IO Word32
-- dwIndex : DWORD -> Word32
-- lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let enumdynamictimezoneinformation =
foreign "EnumDynamicTimeZoneInformation"
(uint32_t @-> (ptr void) @-> returning uint32_t)
(* dwIndex : DWORD -> uint32_t *)
(* lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library advapi32 (t "ADVAPI32.dll"))
(cffi:use-foreign-library advapi32)
(cffi:defcfun ("EnumDynamicTimeZoneInformation" enum-dynamic-time-zone-information :convention :stdcall) :uint32
(dw-index :uint32) ; DWORD
(lp-time-zone-information :pointer)) ; DYNAMIC_TIME_ZONE_INFORMATION* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $EnumDynamicTimeZoneInformation = Win32::API::More->new('ADVAPI32',
'DWORD EnumDynamicTimeZoneInformation(DWORD dwIndex, LPVOID lpTimeZoneInformation)');
# my $ret = $EnumDynamicTimeZoneInformation->Call($dwIndex, $lpTimeZoneInformation);
# dwIndex : DWORD -> DWORD
# lpTimeZoneInformation : DYNAMIC_TIME_ZONE_INFORMATION* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。