Microsoft KB Archive/28958

Return Value of LocalUnlock Windows Function

PSS ID Number: Q28958 Article last modified on 11-05-1993

2.03 3.00 MS-DOS

= PROBLEM =

In the retail version of Windows, the LocalUnlock function always returns 0. With the debugging version, it returns 0 if the lock count after the call is greater than or equal to 1. It returns nonzero if the lock count is 0 after the call. The two versions should be consistent in their return and consistent with the documentation, which does not agree with either case.

= RESPONSE =

The only reliable way to know if the memory is locked before calling LocalUnlock is to call LocalFlags and use the LMEM_LOCKCOUNT mask on the return.

Additional reference words: 2.03 3.00 KBCategory: KBSubcategory: KrMmLocalmem Copyright Microsoft Corporation 1993.