ホーム › Networking.WinSock › NSP_ROUTINE
NSP_ROUTINE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| dwMajorVersion | DWORD | 4 | +4 | +4 | NSPルーチンのメジャーバージョンを示す。 |
| dwMinorVersion | DWORD | 4 | +8 | +8 | NSPルーチンのマイナーバージョンを示す。 |
| NSPCleanup | LPNSPCLEANUP | 8/4 | +16 | +12 | NSPCleanup関数へのポインタ。ネームスペース利用を終了する。 |
| NSPLookupServiceBegin | LPNSPLOOKUPSERVICEBEGIN | 8/4 | +24 | +16 | NSPLookupServiceBegin関数へのポインタ。サービス照会を開始する。 |
| NSPLookupServiceNext | LPNSPLOOKUPSERVICENEXT | 8/4 | +32 | +20 | NSPLookupServiceNext関数へのポインタ。次の照会結果を取得する。 |
| NSPLookupServiceEnd | LPNSPLOOKUPSERVICEEND | 8/4 | +40 | +24 | NSPLookupServiceEnd関数へのポインタ。照会を終了する。 |
| NSPSetService | LPNSPSETSERVICE | 8/4 | +48 | +28 | NSPSetService関数へのポインタ。サービスを登録/登録解除する。 |
| NSPInstallServiceClass | LPNSPINSTALLSERVICECLASS | 8/4 | +56 | +32 | NSPInstallServiceClass関数へのポインタ。サービスクラスを登録する。 |
| NSPRemoveServiceClass | LPNSPREMOVESERVICECLASS | 8/4 | +64 | +36 | NSPRemoveServiceClass関数へのポインタ。サービスクラスを削除する。 |
| NSPGetServiceClassInfo | LPNSPGETSERVICECLASSINFO | 8/4 | +72 | +40 | NSPGetServiceClassInfo関数へのポインタ。サービスクラス情報を取得する。 |
| NSPIoctl | LPNSPIOCTL | 8/4 | +80 | +44 | NSPIoctl関数へのポインタ。プロバイダ固有の制御操作を行う。 |
各言語での定義
#include <windows.h>
// NSP_ROUTINE (x64 88 / x86 48 バイト)
typedef struct NSP_ROUTINE {
DWORD cbSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
LPNSPCLEANUP NSPCleanup;
LPNSPLOOKUPSERVICEBEGIN NSPLookupServiceBegin;
LPNSPLOOKUPSERVICENEXT NSPLookupServiceNext;
LPNSPLOOKUPSERVICEEND NSPLookupServiceEnd;
LPNSPSETSERVICE NSPSetService;
LPNSPINSTALLSERVICECLASS NSPInstallServiceClass;
LPNSPREMOVESERVICECLASS NSPRemoveServiceClass;
LPNSPGETSERVICECLASSINFO NSPGetServiceClassInfo;
LPNSPIOCTL NSPIoctl;
} NSP_ROUTINE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NSP_ROUTINE
{
public uint cbSize;
public uint dwMajorVersion;
public uint dwMinorVersion;
public IntPtr NSPCleanup;
public IntPtr NSPLookupServiceBegin;
public IntPtr NSPLookupServiceNext;
public IntPtr NSPLookupServiceEnd;
public IntPtr NSPSetService;
public IntPtr NSPInstallServiceClass;
public IntPtr NSPRemoveServiceClass;
public IntPtr NSPGetServiceClassInfo;
public IntPtr NSPIoctl;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NSP_ROUTINE
Public cbSize As UInteger
Public dwMajorVersion As UInteger
Public dwMinorVersion As UInteger
Public NSPCleanup As IntPtr
Public NSPLookupServiceBegin As IntPtr
Public NSPLookupServiceNext As IntPtr
Public NSPLookupServiceEnd As IntPtr
Public NSPSetService As IntPtr
Public NSPInstallServiceClass As IntPtr
Public NSPRemoveServiceClass As IntPtr
Public NSPGetServiceClassInfo As IntPtr
Public NSPIoctl As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class NSP_ROUTINE(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwMajorVersion", wintypes.DWORD),
("dwMinorVersion", wintypes.DWORD),
("NSPCleanup", ctypes.c_void_p),
("NSPLookupServiceBegin", ctypes.c_void_p),
("NSPLookupServiceNext", ctypes.c_void_p),
("NSPLookupServiceEnd", ctypes.c_void_p),
("NSPSetService", ctypes.c_void_p),
("NSPInstallServiceClass", ctypes.c_void_p),
("NSPRemoveServiceClass", ctypes.c_void_p),
("NSPGetServiceClassInfo", ctypes.c_void_p),
("NSPIoctl", ctypes.c_void_p),
]#[repr(C)]
pub struct NSP_ROUTINE {
pub cbSize: u32,
pub dwMajorVersion: u32,
pub dwMinorVersion: u32,
pub NSPCleanup: *mut core::ffi::c_void,
pub NSPLookupServiceBegin: *mut core::ffi::c_void,
pub NSPLookupServiceNext: *mut core::ffi::c_void,
pub NSPLookupServiceEnd: *mut core::ffi::c_void,
pub NSPSetService: *mut core::ffi::c_void,
pub NSPInstallServiceClass: *mut core::ffi::c_void,
pub NSPRemoveServiceClass: *mut core::ffi::c_void,
pub NSPGetServiceClassInfo: *mut core::ffi::c_void,
pub NSPIoctl: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type NSP_ROUTINE struct {
cbSize uint32
dwMajorVersion uint32
dwMinorVersion uint32
NSPCleanup uintptr
NSPLookupServiceBegin uintptr
NSPLookupServiceNext uintptr
NSPLookupServiceEnd uintptr
NSPSetService uintptr
NSPInstallServiceClass uintptr
NSPRemoveServiceClass uintptr
NSPGetServiceClassInfo uintptr
NSPIoctl uintptr
}type
NSP_ROUTINE = record
cbSize: DWORD;
dwMajorVersion: DWORD;
dwMinorVersion: DWORD;
NSPCleanup: Pointer;
NSPLookupServiceBegin: Pointer;
NSPLookupServiceNext: Pointer;
NSPLookupServiceEnd: Pointer;
NSPSetService: Pointer;
NSPInstallServiceClass: Pointer;
NSPRemoveServiceClass: Pointer;
NSPGetServiceClassInfo: Pointer;
NSPIoctl: Pointer;
end;const NSP_ROUTINE = extern struct {
cbSize: u32,
dwMajorVersion: u32,
dwMinorVersion: u32,
NSPCleanup: ?*anyopaque,
NSPLookupServiceBegin: ?*anyopaque,
NSPLookupServiceNext: ?*anyopaque,
NSPLookupServiceEnd: ?*anyopaque,
NSPSetService: ?*anyopaque,
NSPInstallServiceClass: ?*anyopaque,
NSPRemoveServiceClass: ?*anyopaque,
NSPGetServiceClassInfo: ?*anyopaque,
NSPIoctl: ?*anyopaque,
};type
NSP_ROUTINE {.bycopy.} = object
cbSize: uint32
dwMajorVersion: uint32
dwMinorVersion: uint32
NSPCleanup: pointer
NSPLookupServiceBegin: pointer
NSPLookupServiceNext: pointer
NSPLookupServiceEnd: pointer
NSPSetService: pointer
NSPInstallServiceClass: pointer
NSPRemoveServiceClass: pointer
NSPGetServiceClassInfo: pointer
NSPIoctl: pointerstruct NSP_ROUTINE
{
uint cbSize;
uint dwMajorVersion;
uint dwMinorVersion;
void* NSPCleanup;
void* NSPLookupServiceBegin;
void* NSPLookupServiceNext;
void* NSPLookupServiceEnd;
void* NSPSetService;
void* NSPInstallServiceClass;
void* NSPRemoveServiceClass;
void* NSPGetServiceClassInfo;
void* NSPIoctl;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NSP_ROUTINE サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMajorVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwMinorVersion : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; NSPCleanup : LPNSPCLEANUP (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; NSPLookupServiceBegin : LPNSPLOOKUPSERVICEBEGIN (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; NSPLookupServiceNext : LPNSPLOOKUPSERVICENEXT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; NSPLookupServiceEnd : LPNSPLOOKUPSERVICEEND (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; NSPSetService : LPNSPSETSERVICE (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; NSPInstallServiceClass : LPNSPINSTALLSERVICECLASS (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; NSPRemoveServiceClass : LPNSPREMOVESERVICECLASS (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; NSPGetServiceClassInfo : LPNSPGETSERVICECLASSINFO (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; NSPIoctl : LPNSPIOCTL (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NSP_ROUTINE サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMajorVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwMinorVersion : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; NSPCleanup : LPNSPCLEANUP (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; NSPLookupServiceBegin : LPNSPLOOKUPSERVICEBEGIN (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; NSPLookupServiceNext : LPNSPLOOKUPSERVICENEXT (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; NSPLookupServiceEnd : LPNSPLOOKUPSERVICEEND (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; NSPSetService : LPNSPSETSERVICE (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; NSPInstallServiceClass : LPNSPINSTALLSERVICECLASS (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; NSPRemoveServiceClass : LPNSPREMOVESERVICECLASS (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; NSPGetServiceClassInfo : LPNSPGETSERVICECLASSINFO (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; NSPIoctl : LPNSPIOCTL (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NSP_ROUTINE
#field int cbSize
#field int dwMajorVersion
#field int dwMinorVersion
#field intptr NSPCleanup
#field intptr NSPLookupServiceBegin
#field intptr NSPLookupServiceNext
#field intptr NSPLookupServiceEnd
#field intptr NSPSetService
#field intptr NSPInstallServiceClass
#field intptr NSPRemoveServiceClass
#field intptr NSPGetServiceClassInfo
#field intptr NSPIoctl
#endstruct
stdim st, NSP_ROUTINE ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize