Modify

#3619 closed Bug (Fixed)

Return value of _WinAPI_LocalFree() is not consistent with what the documentation says

Reported by: tukangusil7@… Owned by: Jpm
Milestone: 3.3.15.1 Component: Standard UDFs
Version: 3.3.14.5 Severity: None
Keywords: LocalFree _WinAPI_LocalFree Cc:

Description

Return Value according to the documentation
Success: True
Failure: False, call _WinAPI_GetLastError() to ...

In WinAPIMem.au3

Func _WinAPI_LocalFree($hMemory)
  Local $aResult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hMemory)
  If @error Then Return SetError(@error, @extended, False)

  Return $aResult[0]
EndFunc   ;==>_WinAPI_LocalFree

If the error is caused by the DllCall(), the documentation is correct.

However, the return value of LocalFree() itself according to MSDN is:

  • If the function succeeds, the return value is NULL.
  • If the function fails, the return value is equal to a handle to the local memory object. To get extended error information, call GetLastError().

Thus, if LocalFree() returns 0 (which means successful), _WinAPI_LocalFree() returns False (which means failed).

Attachments (0)

Change History (2)

comment:1 Changed 21 months ago by Jpm

You right, doc will be fixed next release

comment:2 Changed 21 months ago by Jpm

  • Milestone set to 3.3.15.1
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [12082] in version: 3.3.15.1

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.