Win32 API 日本語リファレンス
ホームNetworking.WinInet › GOPHER_FIND_DATAW

GOPHER_FIND_DATAW

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

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

フィールド

フィールドサイズx64x86説明
DisplayStringWCHAR258+0+0Gopher項目の表示名文字列(Unicode、固定長配列の先頭)。
GopherTypeGOPHER_TYPE4+260+260Gopher項目の種別を示す列挙値(ファイル・ディレクトリ等)。
SizeLowDWORD4+264+264項目サイズの下位32ビット(バイト)。
SizeHighDWORD4+268+268項目サイズの上位32ビット(バイト)。
LastModificationTimeFILETIME8+272+272項目の最終更新日時(FILETIME)。
LocatorWCHAR1308+280+280項目を取得するためのGopherロケーター文字列(Unicode、固定長配列の先頭)。

各言語での定義

#include <windows.h>

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// GOPHER_FIND_DATAW  (x64 1588 / x86 1588 バイト)
typedef struct GOPHER_FIND_DATAW {
    WCHAR DisplayString[129];
    GOPHER_TYPE GopherType;
    DWORD SizeLow;
    DWORD SizeHigh;
    FILETIME LastModificationTime;
    WCHAR Locator[654];
} GOPHER_FIND_DATAW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
    public uint dwLowDateTime;
    public uint dwHighDateTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GOPHER_FIND_DATAW
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] public string DisplayString;
    public uint GopherType;
    public uint SizeLow;
    public uint SizeHigh;
    public FILETIME LastModificationTime;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 654)] public string Locator;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
    Public dwLowDateTime As UInteger
    Public dwHighDateTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GOPHER_FIND_DATAW
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=129)> Public DisplayString As String
    Public GopherType As UInteger
    Public SizeLow As UInteger
    Public SizeHigh As UInteger
    Public LastModificationTime As FILETIME
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=654)> Public Locator As String
End Structure
import ctypes
from ctypes import wintypes

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class GOPHER_FIND_DATAW(ctypes.Structure):
    _fields_ = [
        ("DisplayString", ctypes.c_wchar * 129),
        ("GopherType", wintypes.DWORD),
        ("SizeLow", wintypes.DWORD),
        ("SizeHigh", wintypes.DWORD),
        ("LastModificationTime", FILETIME),
        ("Locator", ctypes.c_wchar * 654),
    ]
#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct GOPHER_FIND_DATAW {
    pub DisplayString: [u16; 129],
    pub GopherType: u32,
    pub SizeLow: u32,
    pub SizeHigh: u32,
    pub LastModificationTime: FILETIME,
    pub Locator: [u16; 654],
}
import "golang.org/x/sys/windows"

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type GOPHER_FIND_DATAW struct {
	DisplayString [129]uint16
	GopherType uint32
	SizeLow uint32
	SizeHigh uint32
	LastModificationTime FILETIME
	Locator [654]uint16
}
type
  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  GOPHER_FIND_DATAW = record
    DisplayString: array[0..128] of WideChar;
    GopherType: DWORD;
    SizeLow: DWORD;
    SizeHigh: DWORD;
    LastModificationTime: FILETIME;
    Locator: array[0..653] of WideChar;
  end;
const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const GOPHER_FIND_DATAW = extern struct {
    DisplayString: [129]u16,
    GopherType: u32,
    SizeLow: u32,
    SizeHigh: u32,
    LastModificationTime: FILETIME,
    Locator: [654]u16,
};
type
  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  GOPHER_FIND_DATAW {.bycopy.} = object
    DisplayString: array[129, uint16]
    GopherType: uint32
    SizeLow: uint32
    SizeHigh: uint32
    LastModificationTime: FILETIME
    Locator: array[654, uint16]
struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct GOPHER_FIND_DATAW
{
    wchar[129] DisplayString;
    uint GopherType;
    uint SizeLow;
    uint SizeHigh;
    FILETIME LastModificationTime;
    wchar[654] Locator;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GOPHER_FIND_DATAW サイズ: 1588 バイト(x64)
dim st, 397    ; 4byte整数×397(構造体サイズ 1588 / 4 切り上げ)
; DisplayString : WCHAR (+0, 258byte)  varptr(st)+0 を基点に操作(258byte:入れ子/配列)
; GopherType : GOPHER_TYPE (+260, 4byte)  st.65 = 値  /  値 = st.65   (lpoke/lpeek も可)
; SizeLow : DWORD (+264, 4byte)  st.66 = 値  /  値 = st.66   (lpoke/lpeek も可)
; SizeHigh : DWORD (+268, 4byte)  st.67 = 値  /  値 = st.67   (lpoke/lpeek も可)
; LastModificationTime : FILETIME (+272, 8byte)  varptr(st)+272 を基点に操作(8byte:入れ子/配列)
; Locator : WCHAR (+280, 1308byte)  varptr(st)+280 を基点に操作(1308byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global GOPHER_FIND_DATAW
    #field wchar DisplayString 129
    #field int GopherType
    #field int SizeLow
    #field int SizeHigh
    #field FILETIME LastModificationTime
    #field wchar Locator 654
#endstruct

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