ホーム › Networking.WindowsWebServices › WS_DURATION_DESCRIPTION
WS_DURATION_DESCRIPTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| minValue | WS_DURATION | 36 | +0 | +0 | 許容する期間の最小値(WS_DURATION)。 |
| maxValue | WS_DURATION | 36 | +36 | +36 | 許容する期間の最大値(WS_DURATION)。 |
| comparer | WS_DURATION_COMPARISON_CALLBACK | 8/4 | +72 | +72 | 期間値を比較するためのコールバック関数。 |
各言語での定義
#include <windows.h>
// WS_DURATION (x64 36 / x86 36 バイト)
typedef struct WS_DURATION {
BOOL negative;
DWORD years;
DWORD months;
DWORD days;
DWORD hours;
DWORD minutes;
DWORD seconds;
DWORD milliseconds;
DWORD ticks;
} WS_DURATION;
// WS_DURATION_DESCRIPTION (x64 80 / x86 76 バイト)
typedef struct WS_DURATION_DESCRIPTION {
WS_DURATION minValue;
WS_DURATION maxValue;
WS_DURATION_COMPARISON_CALLBACK comparer;
} WS_DURATION_DESCRIPTION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_DURATION
{
[MarshalAs(UnmanagedType.Bool)] public bool negative;
public uint years;
public uint months;
public uint days;
public uint hours;
public uint minutes;
public uint seconds;
public uint milliseconds;
public uint ticks;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_DURATION_DESCRIPTION
{
public WS_DURATION minValue;
public WS_DURATION maxValue;
public IntPtr comparer;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_DURATION
<MarshalAs(UnmanagedType.Bool)> Public negative As Boolean
Public years As UInteger
Public months As UInteger
Public days As UInteger
Public hours As UInteger
Public minutes As UInteger
Public seconds As UInteger
Public milliseconds As UInteger
Public ticks As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_DURATION_DESCRIPTION
Public minValue As WS_DURATION
Public maxValue As WS_DURATION
Public comparer As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class WS_DURATION(ctypes.Structure):
_fields_ = [
("negative", wintypes.BOOL),
("years", wintypes.DWORD),
("months", wintypes.DWORD),
("days", wintypes.DWORD),
("hours", wintypes.DWORD),
("minutes", wintypes.DWORD),
("seconds", wintypes.DWORD),
("milliseconds", wintypes.DWORD),
("ticks", wintypes.DWORD),
]
class WS_DURATION_DESCRIPTION(ctypes.Structure):
_fields_ = [
("minValue", WS_DURATION),
("maxValue", WS_DURATION),
("comparer", ctypes.c_void_p),
]#[repr(C)]
pub struct WS_DURATION {
pub negative: i32,
pub years: u32,
pub months: u32,
pub days: u32,
pub hours: u32,
pub minutes: u32,
pub seconds: u32,
pub milliseconds: u32,
pub ticks: u32,
}
#[repr(C)]
pub struct WS_DURATION_DESCRIPTION {
pub minValue: WS_DURATION,
pub maxValue: WS_DURATION,
pub comparer: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type WS_DURATION struct {
negative int32
years uint32
months uint32
days uint32
hours uint32
minutes uint32
seconds uint32
milliseconds uint32
ticks uint32
}
type WS_DURATION_DESCRIPTION struct {
minValue WS_DURATION
maxValue WS_DURATION
comparer uintptr
}type
WS_DURATION = record
negative: BOOL;
years: DWORD;
months: DWORD;
days: DWORD;
hours: DWORD;
minutes: DWORD;
seconds: DWORD;
milliseconds: DWORD;
ticks: DWORD;
end;
WS_DURATION_DESCRIPTION = record
minValue: WS_DURATION;
maxValue: WS_DURATION;
comparer: Pointer;
end;const WS_DURATION = extern struct {
negative: i32,
years: u32,
months: u32,
days: u32,
hours: u32,
minutes: u32,
seconds: u32,
milliseconds: u32,
ticks: u32,
};
const WS_DURATION_DESCRIPTION = extern struct {
minValue: WS_DURATION,
maxValue: WS_DURATION,
comparer: ?*anyopaque,
};type
WS_DURATION {.bycopy.} = object
negative: int32
years: uint32
months: uint32
days: uint32
hours: uint32
minutes: uint32
seconds: uint32
milliseconds: uint32
ticks: uint32
WS_DURATION_DESCRIPTION {.bycopy.} = object
minValue: WS_DURATION
maxValue: WS_DURATION
comparer: pointerstruct WS_DURATION
{
int negative;
uint years;
uint months;
uint days;
uint hours;
uint minutes;
uint seconds;
uint milliseconds;
uint ticks;
}
struct WS_DURATION_DESCRIPTION
{
WS_DURATION minValue;
WS_DURATION maxValue;
void* comparer;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_DURATION_DESCRIPTION サイズ: 76 バイト(x86)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; minValue : WS_DURATION (+0, 36byte) varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; maxValue : WS_DURATION (+36, 36byte) varptr(st)+36 を基点に操作(36byte:入れ子/配列)
; comparer : WS_DURATION_COMPARISON_CALLBACK (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_DURATION_DESCRIPTION サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; minValue : WS_DURATION (+0, 36byte) varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; maxValue : WS_DURATION (+36, 36byte) varptr(st)+36 を基点に操作(36byte:入れ子/配列)
; comparer : WS_DURATION_COMPARISON_CALLBACK (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WS_DURATION
#field bool negative
#field int years
#field int months
#field int days
#field int hours
#field int minutes
#field int seconds
#field int milliseconds
#field int ticks
#endstruct
#defstruct global WS_DURATION_DESCRIPTION
#field WS_DURATION minValue
#field WS_DURATION maxValue
#field intptr comparer
#endstruct
stdim st, WS_DURATION_DESCRIPTION ; NSTRUCT 変数を確保