twain-cs icon indicating copy to clipboard operation
twain-cs copied to clipboard

DsmMemAlloc passed in parameters in reversed order in Windows

Open ericshung opened this issue 5 years ago • 0 comments

public IntPtr DsmMemAlloc(uint a_u32Size)
{
	IntPtr intptr;

	// Use the DSM...
	...

	// Do it ourselves, Windows...
	if (ms_platform == Platform.WINDOWS)
	{
		intptr = (IntPtr)NativeMethods.GlobalAlloc((uint)a_u32Size, (UIntPtr)0x0042 /* GHND */);

The first parameter should be the flag, as defined below

[DllImport("kernel32.dll")]
internal static extern IntPtr GlobalAlloc(uint uFlags, UIntPtr dwBytes);

ericshung avatar Jun 28 '19 19:06 ericshung