Modify ↓
Opened 17 years ago
Closed 17 years ago
#517 closed Bug (Fixed)
WinAPI UDF - bad error checking after DllCall()
| Reported by: | Zedna | Owned by: | Gary |
|---|---|---|---|
| Milestone: | 3.2.13.8 | Component: | Standard UDFs |
| Version: | 3.2.12.1 | Severity: | None |
| Keywords: | Cc: |
Description
This line is missing in many functions after DllCall:
If @error Then Return SetError(@error, 0, 0)
Original:
Func _WinAPI_LoadLibrary($sFileName)
Local $aResult
$aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $sFileName)
Return $aResult[0]
EndFunc ;==>_WinAPI_LoadLibrary
Correct way:
Func _WinAPI_LoadLibrary($sFileName)
Local $aResult
$aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $sFileName)
If @error Then Return SetError(@error, 0, 0)
Return $aResult[0]
EndFunc ;==>_WinAPI_LoadLibrary
Mainly it should be corrected in these functions (but this is missing in many others):
_WinAPI_LoadImage
_WinAPI_LoadLibrary
_WinAPI_LoadLibraryEx
_WinAPI_FreeLibrary
I need to have a chance to check if @error occured when calling these functions:
$hInstance = _WinAPI_LoadLibrary("some.dll")
If @error Then ...
Note: If error occurs during DllCall() then accesing $aResult[0] will hard crash my script.
Attachments (0)
Change History (1)
comment:1 Changed 17 years ago by Gary
- Milestone set to 3.2.13.8
- Resolution set to Fixed
- Status changed from new to closed
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.
Note: See
TracTickets for help on using
tickets.

Fixed in version: 3.2.13.8