Modify ↓
Opened 15 years ago
Closed 15 years ago
#1756 closed Bug (Fixed)
Flaw in _GDIPlus_Startup on error
| Reported by: | ProgAndy | Owned by: | Jpm |
|---|---|---|---|
| Milestone: | 3.3.7.0 | Component: | Standard UDFs |
| Version: | 3.3.6.0 | Severity: | None |
| Keywords: | Cc: |
Description
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
Attachments (0)
Change History (1)
comment:1 Changed 15 years ago by Jpm
- Milestone set to 3.3.7.0
- Owner changed from Gary to Jpm
- 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 by revision [5956] in version: 3.3.7.0