To make a .NET structure works on 64-bit machine, a refence-type
field should has offset of multiples of 8 bytes ( as well as having 8 bytes'
length), but the structure BG_BASIC_CREDENTIALS looks
like:
[StructLayout(LayoutKind.Explicit, Size
= 8, Pack = 0)]
internal struct
BG_AUTH_CREDENTIALS_UNION
{
[FieldOffset(0)]
public BG_BASIC_CREDENTIALS Basic;
}
[StructLayout(LayoutKind.Explicit, Size = 8,
Pack = 0)]
internal struct BG_BASIC_CREDENTIALS
{
[FieldOffset(0)]
[MarshalAs(UnmanagedType.LPWStr)]
public string UserName;
[FieldOffset(4)]
[MarshalAs(UnmanagedType.LPWStr)]
public string Password;
}
That's why we
get that exception.
You may report a defect to the dll owner, or, if you can modify the
source code, just refine the BG_BASIC_CREDENTIALS struct
to:
[StructLayout(LayoutKind.Explicit, Size = 16,
Pack = 0)]
internal struct
BG_AUTH_CREDENTIALS_UNION
{
[FieldOffset(0)]
public BG_BASIC_CREDENTIALS Basic;
}
[StructLayout(LayoutKind.Explicit, Size = 16,
Pack = 0)]
internal struct BG_BASIC_CREDENTIALS
{
[FieldOffset(0)]
[MarshalAs(UnmanagedType.LPWStr)]
public string UserName;
[FieldOffset(8)]
[MarshalAs(UnmanagedType.LPWStr)]
public string Password;
}
참고 : http://msdn.microsoft.com/en-us/library/aa362789(VS.85).aspx
"LC.exe"이(가) -1 코드에서 끝났습니다 (0) | 2008.06.10 |
---|---|
HttpException (0x80004005): 최대 요청 길이를 초과했습니다 (0) | 2008.04.15 |