twain / twain-cs

A C# interface for TWAIN
168 stars 67 forks source link

DsmMemAlloc passed in parameters in reversed order in Windows #35

Open ericshung opened 5 years ago

ericshung commented 5 years ago
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);