-
Notifications
You must be signed in to change notification settings - Fork 144
Description
I was ivestigating the underlying issue for microsoft/CsWin32#1617 (comment). It turned out metadata defines 2 nearly identical RASDIALPARAMSW structs which differs only in supported architecture and pack size:
.class public sequential ansi sealed beforefieldinit Windows.Win32.NetworkManagement.Rras.RASDIALPARAMSW
extends [netstandard]System.ValueType
{
.custom instance void [Windows.Win32.winmd]Windows.Win32.Foundation.Metadata.UnicodeAttribute::.ctor() = (
01 00 00 00
)
.custom instance void [Windows.Win32.winmd]Windows.Win32.Foundation.Metadata.SupportedArchitectureAttribute::.ctor(valuetype [Windows.Win32.winmd]Windows.Win32.Foundation.Metadata.Architecture) = (
+ 01 00 06 00 00 00 00 00 // X64 | Arm64
- 01 00 01 00 00 00 00 00 // X86
)
+ .pack 4
+ .size 0
// Fields
.field public uint32 dwSize
.field public char[0...256] szEntryName
.field public char[0...128] szPhoneNumber
.field public char[0...128] szCallbackNumber
.field public char[0...256] szUserName
.field public char[0...256] szPassword
.field public char[0...15] szDomain
.field public uint32 dwSubEntry
.field public native uint dwCallbackId
.field public uint32 dwIfIndex
.field public valuetype [Windows.Win32.winmd]Windows.Win32.Foundation.PWSTR szEncPassword
} // end of class Windows.Win32.NetworkManagement.Rras.RASDIALPARAMSWThis seems suspicious. The struct has nothing to do with memory or any other hardware access, so it seems wrong that it is emitted as architecture-specific. I am not an expert in such low-level stuff as memory alignment on different architectures, but I have a suspicion that on x86 .pack 4 is a default value, so it isn't emitted explicitly and that makes the wrong split later on. If true, both definitions can be collapsed into a single one without need for architecture-specific structs. I would like to either confirm or deny my suspicion