ホーム › Storage.FileSystem › SHARE_INFO_2
SHARE_INFO_2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| shi2_netname | LPWSTR | 8/4 | +0 | +0 | リソースの共有名を指定する Unicode 文字列へのポインターです。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。 | ||||||||||||||||
| shi2_type | SHARE_TYPE | 4 | +8 | +4 | 共有リソースの種類を指定する値の組み合わせです。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。 次の値のいずれかを指定できます。これらの値は STYPE_MASK 値を使用して分離できます。
さらに、次の値の一方または両方を指定できます。
| ||||||||||||||||
| shi2_remark | LPWSTR | 8/4 | +16 | +8 | 共有リソースに関する省略可能なコメントを含む Unicode 文字列へのポインターです。 | ||||||||||||||||
| shi2_permissions | SHARE_INFO_PERMISSIONS | 4 | +24 | +12 | 共有レベルのセキュリティで実行されているサーバーにおける、共有リソースのアクセス許可を示す DWORD 値を指定します。ユーザーレベルのセキュリティで実行されているサーバーは、このメンバーを無視します。このメンバーには、次の値の 1 つ以上を指定できます。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。 Windows は共有レベルのセキュリティをサポートしていないことに注意してください。 | ||||||||||||||||
| shi2_max_uses | DWORD | 4 | +28 | +16 | 共有リソースが受け入れ可能な同時接続の最大数を示す DWORD 値を指定します。このメンバーに指定された値が –1 の場合、接続数は無制限です。 | ||||||||||||||||
| shi2_current_uses | DWORD | 4 | +32 | +20 | リソースへの現在の接続数を示す DWORD 値を指定します。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。 | ||||||||||||||||
| shi2_path | LPWSTR | 8/4 | +40 | +24 | 共有リソースのローカルパスを指定する Unicode 文字列へのポインターです。ディスクの場合、shi2_path は共有されるパスです。印刷キューの場合、shi2_path は共有される印刷キューの名前です。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。 | ||||||||||||||||
| shi2_passwd | LPWSTR | 8/4 | +48 | +28 | サーバーが共有レベルのセキュリティで実行されている場合に、共有のパスワードを指定する Unicode 文字列へのポインターです。サーバーがユーザーレベルのセキュリティで実行されている場合、このメンバーは無視されます。shi2_passwd メンバーの長さは、SHPWLEN+1 バイト (終端の null 文字を含む) を超えることはできません。 NetShareSetInfo 関数の呼び出しでは、このメンバーは無視されます。Windows は共有レベルのセキュリティをサポートしていないことに注意してください。 |
公式ドキュメント
共有リソースに関する情報 (リソース名、種類とアクセス許可、現在の接続数など) を格納します。セキュリティ保護可能なオブジェクトへのアクセス制御の詳細については、アクセス制御、特権、セキュリティ保護可能なオブジェクトを参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// SHARE_INFO_2 (x64 56 / x86 32 バイト)
typedef struct SHARE_INFO_2 {
LPWSTR shi2_netname;
SHARE_TYPE shi2_type;
LPWSTR shi2_remark;
SHARE_INFO_PERMISSIONS shi2_permissions;
DWORD shi2_max_uses;
DWORD shi2_current_uses;
LPWSTR shi2_path;
LPWSTR shi2_passwd;
} SHARE_INFO_2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHARE_INFO_2
{
public IntPtr shi2_netname;
public uint shi2_type;
public IntPtr shi2_remark;
public uint shi2_permissions;
public uint shi2_max_uses;
public uint shi2_current_uses;
public IntPtr shi2_path;
public IntPtr shi2_passwd;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SHARE_INFO_2
Public shi2_netname As IntPtr
Public shi2_type As UInteger
Public shi2_remark As IntPtr
Public shi2_permissions As UInteger
Public shi2_max_uses As UInteger
Public shi2_current_uses As UInteger
Public shi2_path As IntPtr
Public shi2_passwd As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class SHARE_INFO_2(ctypes.Structure):
_fields_ = [
("shi2_netname", ctypes.c_void_p),
("shi2_type", wintypes.DWORD),
("shi2_remark", ctypes.c_void_p),
("shi2_permissions", wintypes.DWORD),
("shi2_max_uses", wintypes.DWORD),
("shi2_current_uses", wintypes.DWORD),
("shi2_path", ctypes.c_void_p),
("shi2_passwd", ctypes.c_void_p),
]#[repr(C)]
pub struct SHARE_INFO_2 {
pub shi2_netname: *mut core::ffi::c_void,
pub shi2_type: u32,
pub shi2_remark: *mut core::ffi::c_void,
pub shi2_permissions: u32,
pub shi2_max_uses: u32,
pub shi2_current_uses: u32,
pub shi2_path: *mut core::ffi::c_void,
pub shi2_passwd: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type SHARE_INFO_2 struct {
shi2_netname uintptr
shi2_type uint32
shi2_remark uintptr
shi2_permissions uint32
shi2_max_uses uint32
shi2_current_uses uint32
shi2_path uintptr
shi2_passwd uintptr
}type
SHARE_INFO_2 = record
shi2_netname: Pointer;
shi2_type: DWORD;
shi2_remark: Pointer;
shi2_permissions: DWORD;
shi2_max_uses: DWORD;
shi2_current_uses: DWORD;
shi2_path: Pointer;
shi2_passwd: Pointer;
end;const SHARE_INFO_2 = extern struct {
shi2_netname: ?*anyopaque,
shi2_type: u32,
shi2_remark: ?*anyopaque,
shi2_permissions: u32,
shi2_max_uses: u32,
shi2_current_uses: u32,
shi2_path: ?*anyopaque,
shi2_passwd: ?*anyopaque,
};type
SHARE_INFO_2 {.bycopy.} = object
shi2_netname: pointer
shi2_type: uint32
shi2_remark: pointer
shi2_permissions: uint32
shi2_max_uses: uint32
shi2_current_uses: uint32
shi2_path: pointer
shi2_passwd: pointerstruct SHARE_INFO_2
{
void* shi2_netname;
uint shi2_type;
void* shi2_remark;
uint shi2_permissions;
uint shi2_max_uses;
uint shi2_current_uses;
void* shi2_path;
void* shi2_passwd;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SHARE_INFO_2 サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; shi2_netname : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; shi2_type : SHARE_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; shi2_remark : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; shi2_permissions : SHARE_INFO_PERMISSIONS (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; shi2_max_uses : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; shi2_current_uses : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; shi2_path : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; shi2_passwd : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHARE_INFO_2 サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; shi2_netname : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; shi2_type : SHARE_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; shi2_remark : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; shi2_permissions : SHARE_INFO_PERMISSIONS (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; shi2_max_uses : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; shi2_current_uses : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; shi2_path : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; shi2_passwd : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SHARE_INFO_2
#field intptr shi2_netname
#field int shi2_type
#field intptr shi2_remark
#field int shi2_permissions
#field int shi2_max_uses
#field int shi2_current_uses
#field intptr shi2_path
#field intptr shi2_passwd
#endstruct
stdim st, SHARE_INFO_2 ; NSTRUCT 変数を確保
st->shi2_type = 100
mes "shi2_type=" + st->shi2_type