Re: 2 bugs report of dashboard
Posted: Thu Oct 31, 2019 3:04 am
Hi buddy:
About: The data area passed to the system call is too small. (exception from HResult: 0x8007007a)
There are some sugesstion for you refrernce:
The error prompt is at: marshal.structuretoptr (structobj, structptr, true); method
Error checking:
I found some materials on the Internet and found that there are some similar situations. There is a situation: when converting English, there will be no errors, but when converting Chinese, there will be errors.
I tested it. It's true. Because the program needs to use Chinese name, but when using English, there is no error prompt.
Error reason:
When the structure is laid out, no Unicode code mode is specified, so there is an error when transferring the structure to the structtoptr() method.
terms of settlement:
Use the structlayout feature to define the structure, and make it encoded in Unicode (by setting charset property)
The modified structure is defined as follows:
Before:
struct usrInfo
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public char[] name;
public int ID;
}
Affter:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
struct usrInfo
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public char[] name;
public int ID;
}
About: The data area passed to the system call is too small. (exception from HResult: 0x8007007a)
There are some sugesstion for you refrernce:
The error prompt is at: marshal.structuretoptr (structobj, structptr, true); method
Error checking:
I found some materials on the Internet and found that there are some similar situations. There is a situation: when converting English, there will be no errors, but when converting Chinese, there will be errors.
I tested it. It's true. Because the program needs to use Chinese name, but when using English, there is no error prompt.
Error reason:
When the structure is laid out, no Unicode code mode is specified, so there is an error when transferring the structure to the structtoptr() method.
terms of settlement:
Use the structlayout feature to define the structure, and make it encoded in Unicode (by setting charset property)
The modified structure is defined as follows:
Before:
struct usrInfo
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public char[] name;
public int ID;
}
Affter:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
struct usrInfo
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public char[] name;
public int ID;
}