Win32 API 日本語リファレンス
ホームNetworkManagement.Dns › DNS_LOC_DATA

DNS_LOC_DATA

構造体
サイズx64: 20 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
wVersionWORD2+0+0LOCレコードのバージョン番号を示す。現状は0。
wSizeWORD2+2+2地点を覆う球体の直径(精度)を符号化した値を保持する。
wHorPrecWORD2+4+4水平方向の精度を符号化した値を保持する。
wVerPrecWORD2+6+6垂直方向の精度を符号化した値を保持する。
dwLatitudeDWORD4+8+8緯度を1/1000秒単位で赤道基準にオフセット符号化した値を保持する。
dwLongitudeDWORD4+12+12経度を1/1000秒単位で本初子午線基準にオフセット符号化した値を保持する。
dwAltitudeDWORD4+16+16高度を基準値からのオフセットとしてセンチメートル単位で保持する。

各言語での定義

#include <windows.h>

// DNS_LOC_DATA  (x64 20 / x86 20 バイト)
typedef struct DNS_LOC_DATA {
    WORD wVersion;
    WORD wSize;
    WORD wHorPrec;
    WORD wVerPrec;
    DWORD dwLatitude;
    DWORD dwLongitude;
    DWORD dwAltitude;
} DNS_LOC_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_LOC_DATA
{
    public ushort wVersion;
    public ushort wSize;
    public ushort wHorPrec;
    public ushort wVerPrec;
    public uint dwLatitude;
    public uint dwLongitude;
    public uint dwAltitude;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_LOC_DATA
    Public wVersion As UShort
    Public wSize As UShort
    Public wHorPrec As UShort
    Public wVerPrec As UShort
    Public dwLatitude As UInteger
    Public dwLongitude As UInteger
    Public dwAltitude As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DNS_LOC_DATA(ctypes.Structure):
    _fields_ = [
        ("wVersion", ctypes.c_ushort),
        ("wSize", ctypes.c_ushort),
        ("wHorPrec", ctypes.c_ushort),
        ("wVerPrec", ctypes.c_ushort),
        ("dwLatitude", wintypes.DWORD),
        ("dwLongitude", wintypes.DWORD),
        ("dwAltitude", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DNS_LOC_DATA {
    pub wVersion: u16,
    pub wSize: u16,
    pub wHorPrec: u16,
    pub wVerPrec: u16,
    pub dwLatitude: u32,
    pub dwLongitude: u32,
    pub dwAltitude: u32,
}
import "golang.org/x/sys/windows"

type DNS_LOC_DATA struct {
	wVersion uint16
	wSize uint16
	wHorPrec uint16
	wVerPrec uint16
	dwLatitude uint32
	dwLongitude uint32
	dwAltitude uint32
}
type
  DNS_LOC_DATA = record
    wVersion: Word;
    wSize: Word;
    wHorPrec: Word;
    wVerPrec: Word;
    dwLatitude: DWORD;
    dwLongitude: DWORD;
    dwAltitude: DWORD;
  end;
const DNS_LOC_DATA = extern struct {
    wVersion: u16,
    wSize: u16,
    wHorPrec: u16,
    wVerPrec: u16,
    dwLatitude: u32,
    dwLongitude: u32,
    dwAltitude: u32,
};
type
  DNS_LOC_DATA {.bycopy.} = object
    wVersion: uint16
    wSize: uint16
    wHorPrec: uint16
    wVerPrec: uint16
    dwLatitude: uint32
    dwLongitude: uint32
    dwAltitude: uint32
struct DNS_LOC_DATA
{
    ushort wVersion;
    ushort wSize;
    ushort wHorPrec;
    ushort wVerPrec;
    uint dwLatitude;
    uint dwLongitude;
    uint dwAltitude;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_LOC_DATA サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; wVersion : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wSize : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; wHorPrec : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; wVerPrec : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; dwLatitude : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwLongitude : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwAltitude : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_LOC_DATA
    #field short wVersion
    #field short wSize
    #field short wHorPrec
    #field short wVerPrec
    #field int dwLatitude
    #field int dwLongitude
    #field int dwAltitude
#endstruct

stdim st, DNS_LOC_DATA        ; NSTRUCT 変数を確保
st->wVersion = 100
mes "wVersion=" + st->wVersion