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

SERVICE_TYPE_INFO_ABSA

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

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

フィールド

フィールドサイズx64x86説明
lpTypeNameLPSTR8/4+0+0サービス型名を表すANSI文字列へのポインタ。
dwValueCountDWORD4+8+4Valuesに含まれる値の個数を示す。
ValuesSERVICE_TYPE_VALUE_ABSA32/20+16+8サービス型に属する値を保持するSERVICE_TYPE_VALUE_ABSA配列の先頭。

各言語での定義

#include <windows.h>

// SERVICE_TYPE_VALUE_ABSA  (x64 32 / x86 20 バイト)
typedef struct SERVICE_TYPE_VALUE_ABSA {
    DWORD dwNameSpace;
    DWORD dwValueType;
    DWORD dwValueSize;
    LPSTR lpValueName;
    void* lpValue;
} SERVICE_TYPE_VALUE_ABSA;

// SERVICE_TYPE_INFO_ABSA  (x64 48 / x86 28 バイト)
typedef struct SERVICE_TYPE_INFO_ABSA {
    LPSTR lpTypeName;
    DWORD dwValueCount;
    SERVICE_TYPE_VALUE_ABSA Values[1];
} SERVICE_TYPE_INFO_ABSA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SERVICE_TYPE_VALUE_ABSA
{
    public uint dwNameSpace;
    public uint dwValueType;
    public uint dwValueSize;
    public IntPtr lpValueName;
    public IntPtr lpValue;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SERVICE_TYPE_INFO_ABSA
{
    public IntPtr lpTypeName;
    public uint dwValueCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public SERVICE_TYPE_VALUE_ABSA[] Values;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SERVICE_TYPE_VALUE_ABSA
    Public dwNameSpace As UInteger
    Public dwValueType As UInteger
    Public dwValueSize As UInteger
    Public lpValueName As IntPtr
    Public lpValue As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SERVICE_TYPE_INFO_ABSA
    Public lpTypeName As IntPtr
    Public dwValueCount As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Values() As SERVICE_TYPE_VALUE_ABSA
End Structure
import ctypes
from ctypes import wintypes

class SERVICE_TYPE_VALUE_ABSA(ctypes.Structure):
    _fields_ = [
        ("dwNameSpace", wintypes.DWORD),
        ("dwValueType", wintypes.DWORD),
        ("dwValueSize", wintypes.DWORD),
        ("lpValueName", ctypes.c_void_p),
        ("lpValue", ctypes.c_void_p),
    ]

class SERVICE_TYPE_INFO_ABSA(ctypes.Structure):
    _fields_ = [
        ("lpTypeName", ctypes.c_void_p),
        ("dwValueCount", wintypes.DWORD),
        ("Values", SERVICE_TYPE_VALUE_ABSA * 1),
    ]
#[repr(C)]
pub struct SERVICE_TYPE_VALUE_ABSA {
    pub dwNameSpace: u32,
    pub dwValueType: u32,
    pub dwValueSize: u32,
    pub lpValueName: *mut core::ffi::c_void,
    pub lpValue: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct SERVICE_TYPE_INFO_ABSA {
    pub lpTypeName: *mut core::ffi::c_void,
    pub dwValueCount: u32,
    pub Values: [SERVICE_TYPE_VALUE_ABSA; 1],
}
import "golang.org/x/sys/windows"

type SERVICE_TYPE_VALUE_ABSA struct {
	dwNameSpace uint32
	dwValueType uint32
	dwValueSize uint32
	lpValueName uintptr
	lpValue uintptr
}

type SERVICE_TYPE_INFO_ABSA struct {
	lpTypeName uintptr
	dwValueCount uint32
	Values [1]SERVICE_TYPE_VALUE_ABSA
}
type
  SERVICE_TYPE_VALUE_ABSA = record
    dwNameSpace: DWORD;
    dwValueType: DWORD;
    dwValueSize: DWORD;
    lpValueName: Pointer;
    lpValue: Pointer;
  end;

  SERVICE_TYPE_INFO_ABSA = record
    lpTypeName: Pointer;
    dwValueCount: DWORD;
    Values: array[0..0] of SERVICE_TYPE_VALUE_ABSA;
  end;
const SERVICE_TYPE_VALUE_ABSA = extern struct {
    dwNameSpace: u32,
    dwValueType: u32,
    dwValueSize: u32,
    lpValueName: ?*anyopaque,
    lpValue: ?*anyopaque,
};

const SERVICE_TYPE_INFO_ABSA = extern struct {
    lpTypeName: ?*anyopaque,
    dwValueCount: u32,
    Values: [1]SERVICE_TYPE_VALUE_ABSA,
};
type
  SERVICE_TYPE_VALUE_ABSA {.bycopy.} = object
    dwNameSpace: uint32
    dwValueType: uint32
    dwValueSize: uint32
    lpValueName: pointer
    lpValue: pointer

  SERVICE_TYPE_INFO_ABSA {.bycopy.} = object
    lpTypeName: pointer
    dwValueCount: uint32
    Values: array[1, SERVICE_TYPE_VALUE_ABSA]
struct SERVICE_TYPE_VALUE_ABSA
{
    uint dwNameSpace;
    uint dwValueType;
    uint dwValueSize;
    void* lpValueName;
    void* lpValue;
}

struct SERVICE_TYPE_INFO_ABSA
{
    void* lpTypeName;
    uint dwValueCount;
    SERVICE_TYPE_VALUE_ABSA[1] Values;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SERVICE_TYPE_INFO_ABSA サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; lpTypeName : LPSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwValueCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Values : SERVICE_TYPE_VALUE_ABSA (+8, 20byte)  varptr(st)+8 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SERVICE_TYPE_INFO_ABSA サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; lpTypeName : LPSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; dwValueCount : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Values : SERVICE_TYPE_VALUE_ABSA (+16, 32byte)  varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SERVICE_TYPE_VALUE_ABSA
    #field int dwNameSpace
    #field int dwValueType
    #field int dwValueSize
    #field intptr lpValueName
    #field intptr lpValue
#endstruct

#defstruct global SERVICE_TYPE_INFO_ABSA
    #field intptr lpTypeName
    #field int dwValueCount
    #field SERVICE_TYPE_VALUE_ABSA Values 1
#endstruct

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