﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
517	WinAPI UDF - bad error checking after DllCall()	Zedna	Gary	"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.
"	Bug	closed	3.2.13.8	Standard UDFs	3.2.12.1	None	Fixed		
