﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1756	Flaw in _GDIPlus_Startup on error	ProgAndy	Jpm	"When _GDIPlus_Startup cannot open the DLL, the reference count is still increased. This results in _GDIPlus_Startup returning true in subsequent calls.
Fix:
{{{
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_Startup
; Description ...: Initialize Microsoft Windows GDI+
; Syntax.........: _GDIPlus_Startup()
; Parameters ....:
; Return values .: Success      - True
;                  Failure      - False
; Author ........: Paul Campbell (PaulIA)
; Modified.......: Gary Frost
; Remarks .......: Call _GDIPlus_Startup before you create any GDI+ objects.  GDI+ requires a redistributable for applications  that
;                  run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems.
; Related .......: _GDIPlus_Shutdown
; Link ..........: @@MsdnLink@@ GdiplusStartup
; Example .......: Yes
; ===============================================================================================================================
Func _GDIPlus_Startup()
	$giGDIPRef += 1
	If $giGDIPRef > 1 Then Return True

	$ghGDIPDll = DllOpen(""GDIPlus.dll"")
	If $ghGDIPDll = -1 Then 
		$giGDIPRef = 0 ; <--- this is needed
		Return SetError(1, 2, False)
	EndIf
	Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
	Local $pInput = DllStructGetPtr($tInput)
	Local $tToken = DllStructCreate(""ulong_ptr Data"")
	Local $pToken = DllStructGetPtr($tToken)
	DllStructSetData($tInput, ""Version"", 1)
	Local $aResult = DllCall($ghGDIPDll, ""int"", ""GdiplusStartup"", ""ptr"", $pToken, ""ptr"", $pInput, ""ptr"", 0)
	If @error Then Return SetError(@error, @extended, False)
	$giGDIPToken = DllStructGetData($tToken, ""Data"")
	Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_Startup
}}}"	Bug	closed	3.3.7.0	Standard UDFs	3.3.6.0	None	Fixed		
