test
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
Add-Type -TypeDefinition @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class MI {
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MOUSEINPUT {
|
||||
public int dx;
|
||||
public int dy;
|
||||
public uint mouseData;
|
||||
public uint dwFlags;
|
||||
public uint time;
|
||||
public IntPtr dwExtraInfo;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct INPUT {
|
||||
public uint type;
|
||||
public MOUSEINPUT mi;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
$type = [MI+INPUT]
|
||||
Write-Host "Type: $($type.FullName)"
|
||||
Write-Host "IsValueType: $($type.IsValueType)"
|
||||
|
||||
try {
|
||||
$s = [Runtime.InteropServices.Marshal]::SizeOf($type)
|
||||
Write-Host "SizeOf(type): $s"
|
||||
} catch {
|
||||
Write-Host "SizeOf(type) failed: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
$inst = [Activator]::CreateInstance($type)
|
||||
try {
|
||||
$s2 = [Runtime.InteropServices.Marshal]::SizeOf($inst)
|
||||
Write-Host "SizeOf(inst): $s2"
|
||||
} catch {
|
||||
Write-Host "SizeOf(inst) failed: $($_.Exception.Message)"
|
||||
}
|
||||
Reference in New Issue
Block a user