Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SOURCE_MEDIA_W

SOURCE_MEDIA_W

構造体
サイズx64: 44 バイト / x86: 24 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
ReservedLPWSTR8/4+0+0予約フィールド(Unicode)。通常はNULL。
TagfileLPWSTR8/4+8+4メディアを識別するタグファイル名(Unicode)。NULL可。
DescriptionLPWSTR8/4+16+8メディアの説明文字列(Unicode)。プロンプト表示等に用いる。
SourcePathLPWSTR8/4+24+12コピー元メディアのパス(Unicode)。
SourceFileLPWSTR8/4+32+16コピー元ファイル名(Unicode)。
FlagsDWORD4+40+20メディア処理動作を制御するフラグ群(SP_COPY_*)。

各言語での定義

#include <windows.h>

// SOURCE_MEDIA_W  (x64 44 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct SOURCE_MEDIA_W {
    LPWSTR Reserved;
    LPWSTR Tagfile;
    LPWSTR Description;
    LPWSTR SourcePath;
    LPWSTR SourceFile;
    DWORD Flags;
} SOURCE_MEDIA_W;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SOURCE_MEDIA_W
{
    public IntPtr Reserved;
    public IntPtr Tagfile;
    public IntPtr Description;
    public IntPtr SourcePath;
    public IntPtr SourceFile;
    public uint Flags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SOURCE_MEDIA_W
    Public Reserved As IntPtr
    Public Tagfile As IntPtr
    Public Description As IntPtr
    Public SourcePath As IntPtr
    Public SourceFile As IntPtr
    Public Flags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SOURCE_MEDIA_W(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Reserved", ctypes.c_void_p),
        ("Tagfile", ctypes.c_void_p),
        ("Description", ctypes.c_void_p),
        ("SourcePath", ctypes.c_void_p),
        ("SourceFile", ctypes.c_void_p),
        ("Flags", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct SOURCE_MEDIA_W {
    pub Reserved: *mut core::ffi::c_void,
    pub Tagfile: *mut core::ffi::c_void,
    pub Description: *mut core::ffi::c_void,
    pub SourcePath: *mut core::ffi::c_void,
    pub SourceFile: *mut core::ffi::c_void,
    pub Flags: u32,
}
import "golang.org/x/sys/windows"

type SOURCE_MEDIA_W struct {
	Reserved uintptr
	Tagfile uintptr
	Description uintptr
	SourcePath uintptr
	SourceFile uintptr
	Flags uint32
}
type
  SOURCE_MEDIA_W = packed record
    Reserved: Pointer;
    Tagfile: Pointer;
    Description: Pointer;
    SourcePath: Pointer;
    SourceFile: Pointer;
    Flags: DWORD;
  end;
const SOURCE_MEDIA_W = extern struct {
    Reserved: ?*anyopaque,
    Tagfile: ?*anyopaque,
    Description: ?*anyopaque,
    SourcePath: ?*anyopaque,
    SourceFile: ?*anyopaque,
    Flags: u32,
};
type
  SOURCE_MEDIA_W {.packed.} = object
    Reserved: pointer
    Tagfile: pointer
    Description: pointer
    SourcePath: pointer
    SourceFile: pointer
    Flags: uint32
align(1)
struct SOURCE_MEDIA_W
{
    void* Reserved;
    void* Tagfile;
    void* Description;
    void* SourcePath;
    void* SourceFile;
    uint Flags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SOURCE_MEDIA_W サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Reserved : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Tagfile : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Description : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SourcePath : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SourceFile : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Flags : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SOURCE_MEDIA_W サイズ: 44 バイト(x64)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Reserved : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Tagfile : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Description : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; SourcePath : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SourceFile : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Flags : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SOURCE_MEDIA_W, pack=1
    #field intptr Reserved
    #field intptr Tagfile
    #field intptr Description
    #field intptr SourcePath
    #field intptr SourceFile
    #field int Flags
#endstruct

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