Skip to content

GlobalUnlock return Err with value of 0x00000000 #3580

Closed
@Will2003debug

Description

@Will2003debug

Summary

when Globalunlock is used to unlock memory allocated with globalalloc an err is returned with a value of 0x00000000 whcih means it succeeded despite returning err rather than ok

Crate manifest

windows = { version = "0.61.1", features = ["Win32_System_DataExchange", "Win32_System_Memory"] }

Crate code

let mem = GlobalAlloc(GMEM_MOVEABLE, len)?;
        let handle = GlobalLock(mem) as *mut u8;
        copy_nonoverlapping(data.as_ptr(), handle, len);
        let unlock = GlobalUnlock(mem);
        if let Err(e) = unlock {
            eprintln!("failed to unlock memory");
            return Err(Box::new(io::Error::new(ErrorKind::Other, "failed to unlock mem")))
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions