Jump to content



_GDIPlus_Startup() crashes on missing GDI+


  • Please log in to reply
2 replies to this topic

#1 Guest_christian_*

Guest_christian_*
  • Guests

Posted 29 November 2007 - 04:30 PM

Hi developers!

When initializing GDIPlus with the function: _GDIPlus_Startup()
I get an error on Win2000 (no GDI installed):

AVector: []: Out of bounds.

Bug occured on: Win2000 SP4 DE, compiled AutoIT-Script 3.2.10.0
(Compiled on: WinXP SP2 DE; AutoIT 3.2.10.0)

I tried to track down the problem and noticed, that $ghGDIPDll is -1 (means, no handle to the GDIPlus.dll available).

The _WinAPI_Check() after DLLOpen doesn't seem to make the job.
Maybe a additional condition 'If $ghGDIPDll = -1 Then return False' would prevent the crash.

Maybe there is also a 'bug' in the DllCall function, I think it shouldn't 'crash' if a invalid handle is passed.

Kind regards,
Christian

PS: AutoIt is great, I love it.

Plain Text         
; #FUNCTION# ==================================================================================================== ================ ; Name...........: _GDIPlus_Startup ; Description ...: Initialize Microsoft Windows GDI+ ; Syntax.........: _GDIPlus_Startup() ; Parameters ....: ; Return values .: Success    - True ;                 Failure     - False ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; 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()     Local $pInput, $tInput, $pToken, $tToken, $aResult     $giGDIPRef += 1     If $giGDIPRef > 1 Then Return True     $ghGDIPDll = DllOpen("GDIPlus.dll")     _WinAPI_Check("_GDIPlus_Startup (GDIPlus.dll not found)", @error, -1)                ;ADD:                 If $ghGDIPDll = -1 Then Return False     $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)     $pInput = DllStructGetPtr($tInput)     $tToken = DllStructCreate("int Data")     $pToken = DllStructGetPtr($tToken)     DllStructSetData($tInput, "Version", 1)     $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)         $giGDIPToken = DllStructGetData($tToken, "Data")     Return $aResult[0] <> 0 EndFunc  ;==>_GDIPlus_Startup






#2 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 29 November 2007 - 04:43 PM

http://www.autoitscript.com/forum/index.php?showtopic=57972

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#3 Guest_christian_*

Guest_christian_*
  • Guests

Posted 29 November 2007 - 05:23 PM

Thanks, that's exactly the problem.

I must have overseen it while searching the bugreport forum.

Kind regards,
Christian




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users