Search the Community
Showing results for tags 'Dll'.
-
_GDIPlus_BitmapApplyFilter v0.9.8 build 2024-04-17 beta
UEZ posted a topic in AutoIt Example Scripts
Since I disovered FreeBasic I decided to create a DLL to implement much faster image processing functionality to AutoIt. Following functions are implemented yet: _GDIPlus_BitmapApplyFilter_BWJJNDithering _GDIPlus_BitmapApplyFilter_BWBayerOrderedDithering _GDIPlus_BitmapApplyFilter_Cartoon1 _GDIPlus_BitmapApplyFilter_ColorAccent _GDIPlus_BitmapApplyFilter_Convolution_AnotherBlur _GDIPlus_BitmapApplyFilter_Convolution_BoxBlur _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection1 _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection2 _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection3 _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection4 _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection5 _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection6 _GDIPlus_BitmapApplyFilter_Convolution_Emboss1 _GDIPlus_BitmapApplyFilter_Convolution_Emboss45Degree _GDIPlus_BitmapApplyFilter_Convolution_EmbossTopLeftBottomRight _GDIPlus_BitmapApplyFilter_Convolution_Gaussian3x3 _GDIPlus_BitmapApplyFilter_Convolution_Gaussian5x5_1 _GDIPlus_BitmapApplyFilter_Convolution_Gaussian5x5_2 _GDIPlus_BitmapApplyFilter_Convolution_GaussianBlur _GDIPlus_BitmapApplyFilter_Convolution_IntenseEmboss _GDIPlus_BitmapApplyFilter_Convolution_Kirsch _GDIPlus_BitmapApplyFilter_Convolution_Laplace1 _GDIPlus_BitmapApplyFilter_Convolution_Laplace2 _GDIPlus_BitmapApplyFilter_Convolution_Laplace3 _GDIPlus_BitmapApplyFilter_Convolution_LaplacianOfGaussian _GDIPlus_BitmapApplyFilter_Convolution_ManualMatrix _GDIPlus_BitmapApplyFilter_Convolution_MotionBlur _GDIPlus_BitmapApplyFilter_Convolution_Outline3x3 _GDIPlus_BitmapApplyFilter_Convolution_Prewitt _GDIPlus_BitmapApplyFilter_Convolution_Sharpen1 _GDIPlus_BitmapApplyFilter_Convolution_Sharpen2 _GDIPlus_BitmapApplyFilter_Convolution_Sobel _GDIPlus_BitmapApplyFilter_Convolution_SovelVsPrewitt _GDIPlus_BitmapApplyFilter_Convolution_TriangleBlur _GDIPlus_BitmapApplyFilter_Convolution_Unsharp _GDIPlus_BitmapApplyFilter_Convolution_Unsharp5x5 _GDIPlus_BitmapApplyFilter_Delaunay _GDIPlus_BitmapApplyFilter_Dilatation _GDIPlus_BitmapApplyFilter_DistortionBlur _GDIPlus_BitmapApplyFilter_Edges _GDIPlus_BitmapApplyFilter_Erosion _GDIPlus_BitmapApplyFilter_FakeGreyscale _GDIPlus_BitmapApplyFilter_FishEye _GDIPlus_BitmapApplyFilter_Indexed _GDIPlus_BitmapApplyFilter_Jitter _GDIPlus_BitmapApplyFilter_Kuwahara _GDIPlus_BitmapApplyFilter_Linellism _GDIPlus_BitmapApplyFilter_Median _GDIPlus_BitmapApplyFilter_Median2 _GDIPlus_BitmapApplyFilter_Mosaic _GDIPlus_BitmapApplyFilter_OilPainting _GDIPlus_BitmapApplyFilter_Open _GDIPlus_BitmapApplyFilter_PenSketch _GDIPlus_BitmapApplyFilter_PenSketch2 _GDIPlus_BitmapApplyFilter_Pixelate _GDIPlus_BitmapApplyFilter_Pointillism _GDIPlus_BitmapApplyFilter_RadialBlur _GDIPlus_BitmapApplyFilter_Raster _GDIPlus_BitmapApplyFilter_Spiral _GDIPlus_BitmapApplyFilter_Swirl _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour _GDIPlus_BitmapApplyFilter_TiltShift _GDIPlus_BitmapApplyFilter_TimeWarp _GDIPlus_BitmapApplyFilter_Ver _GDIPlus_BitmapApplyFilter_Wave _GDIPlus_BitmapApplyFilter_XRay Since I am absolutely a newbie in FreeBasic, the DLL may contain errors. Please report any bug. FreeBasic source code can be found here: https://pastebin.com/Lugp6rCR To do: add function headers with descriptions speed-up FB code -> partly done add more filters -> ongoing Credits to: Jakub Szymanowski rdc Dewald Esterhuizen Santhosh G_ Christian Graus www.gutgames.com Have fun. You can compare the speed with AutoIt version: #AutoIt3Wrapper_Version=b #include <Array.au3> #include <GDIPlus.au3> Global $sFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.gif;*.bmp)") If @error Then Exit _GDIPlus_Startup() Global Const $STM_SETIMAGE = 0x0172 Global Const $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Global Const $hGUI = GUICreate("GDI+ Image Filters", $iW * 2, $iH) Global $fProg = 0, $iEnd = $iW * $iH - 1 AdlibRegister("Progress", 490) Global $t = TimerInit() Global Const $hGDIBitmap = _GDIPlus_BitmapApplyFilter_Median($hImage, 4) ConsoleWrite(Round(TimerDiff($t) / 1000, 2) & " s / " & Round(TimerDiff($t) / 60000, 2) & " min" & @CRLF) Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW - 1, $iH - 1) Global Const $iPic_o = GUICtrlCreatePic("", $iW, 0, $iW - 1, $iH - 1) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hGDIBitmap)) Global Const $hGDIBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_o, $STM_SETIMAGE, $IMAGE_BITMAP, $hGDIBitmap2)) GUISetState() AdlibUnRegister("Progress") ToolTip("") Do Until GUIGetMsg() = -3 _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hGDIBitmap) _WinAPI_DeleteObject($hGDIBitmap2) _GDIPlus_Shutdown() Exit Func Progress() ToolTip(Int($fProg / $iEnd * 100) & " % / " & Round(TimerDiff($t) / 60000, 2) & " min", MouseGetPos(0) + 30, MouseGetPos(1) + 30) EndFunc #Region Symmetric Nearest Neighbour Func _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour($hImage, $fRadius = 2, $bGDI = True) ;no alpha channel implemented yet Local Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Local Const $hBitmap_Dest = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $tBitmapData_Dest = _GDIPlus_BitmapLockBits($hBitmap_Dest, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) Local Const $iScan0_Dest = DllStructGetData($tBitmapData_Dest, "Scan0") Local Const $tPixel_Dest = DllStructCreate("int[" & $iW * $iH & "];", $iScan0_Dest) Local Const $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local Const $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local Const $tPixel = DllStructCreate("int[" & $iW * $iH & "];", $iScan0) Local $iRowOffset, $iX, $iY, $c, $k, $sumR, $sumG, $sumB, $iCount, $xx, $yy, $iR, $iG, $iB, $iR1, $iG1, $iB1, $iR2, $iG2, $iB2, $x, $y For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW For $iX = 0 To $iW - 1 $sumR = 0 $sumG = 0 $sumB = 0 $iCount = 0 $c = DllStructGetData($tPixel, 1, $iRowOffset + $iX) $iR = BitShift(BitAND(0x00FF0000, $c), 16) $iG = BitShift(BitAND(0x0000FF00, $c), 8) $iB = BitAND(0x000000FF, $c) For $yy = -$fRadius To $fRadius For $xx = -$fRadius To $fRadius $k = $iX + $xx $x = $k < 0 ? 0 : $k > $iW - 1 ? $iW - 1 : $k $k = $iY + $yy $y = $k < 0 ? 0 : $k > $iH - 1 ? $iH - 1 : $k $c = DllStructGetData($tPixel, 1, $y * $iW + $x) $iR1 = BitShift(BitAND(0x00FF0000, $c), 16) $iG1 = BitShift(BitAND(0x0000FF00, $c), 8) $iB1 = BitAND(0x000000FF, $c) $k = $iX - $xx $x = $k < 0 ? 0 : $k > $iW - 1 ? $iW - 1 : $k $k = ($iY - $yy) $y = $k < 0 ? 0 : $k > $iH - 1 ? $iH - 1 : $k $c = DllStructGetData($tPixel, 1, $y * $iW + $x) $iR2 = BitShift(BitAND(0x00FF0000, $c), 16) $iG2 = BitShift(BitAND(0x0000FF00, $c), 8) $iB2 = BitAND(0x000000FF, $c) If __DeltaE($iR, $iG, $iB, $iR1, $iG1, $iB1) < __DeltaE($iR, $iG, $iB, $iR2, $iG2, $iB2) Then $sumR += $iR1 $sumG += $iG1 $sumB += $iB1 Else $sumR += $iR2 $sumG += $iG2 $sumB += $iB2 EndIf $iCount += 1 Next Next DllStructSetData($tPixel_Dest, 1, 0xFF000000 + Int($sumR / $iCount) * 0x10000 + Int($sumG / $iCount) * 0x100 + Int($sumB / $iCount), $iRowOffset + $iX) $fProg += 1 Next Next _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) _GDIPlus_BitmapUnlockBits($hBitmap_Dest, $tBitmapData_Dest) _GDIPlus_ImageSaveToFile($hBitmap_Dest, @ScriptDir & "\Filter_SNN" & $fRadius & "_" & @YEAR & @MON & @MDAY & @MIN & @SEC & ".png") If $bGDI Then Local $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Dest) _GDIPlus_BitmapDispose($hBitmap_Dest) Return $hGDIBitmap EndIf Return $hBitmap_Dest EndFunc Func __DeltaE($iR1, $iG1, $iB1, $iR2, $iG2, $iB2) Return Sqrt(($iR1 - $iR2) * ($iR1 - $iR2) + ($iG1 - $iG2) * ($iG1 - $iG2) + ($iB1 - $iB2) * ($iB1 - $iB2)) EndFunc #EndRegion #Region Jitter Func _GDIPlus_BitmapApplyFilter_Jitter($hImage, $iAmount = 20, $bGDI = True) Local Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Local Const $hBitmap_Dest = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $tBitmapData_Dest = _GDIPlus_BitmapLockBits($hBitmap_Dest, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) Local Const $iScan0_Dest = DllStructGetData($tBitmapData_Dest, "Scan0") Local Const $tPixel_Dest = DllStructCreate("int[" & $iW * $iH & "];", $iScan0_Dest) Local Const $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local Const $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local Const $tPixel = DllStructCreate("int[" & $iW * $iH & "];", $iScan0) Local $iX, $iY, $iRowOffset, $fNX, $fNY For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW + 1 For $iX = 0 To $iW - 1 $fNX = $iX + Int((Random() - 0.5) * $iAmount) $fNX = $fNX < 1 ? 1 : $fNX > $iW - 1 ? $iW - 1 : $fNX $fNY = ($iY + Int((Random() - 0.5) * $iAmount)) $fNY = $fNY < 1 ? 1 : $fNY > $iH - 1 ? $iH - 1 : $fNY $fNY *= $iW DllStructSetData($tPixel_Dest, 1, DllStructGetData($tPixel, 1, $fNY + $fNX), $iRowOffset + $iX) $fProg += 1 Next Next _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) _GDIPlus_BitmapUnlockBits($hBitmap_Dest, $tBitmapData_Dest) _GDIPlus_ImageSaveToFile($hBitmap_Dest, @ScriptDir & "\Filter_Jitter" & $iAmount & "_" & @YEAR & @MON & @MDAY & @MIN & @SEC & ".png") If $bGDI Then Local $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Dest) _GDIPlus_BitmapDispose($hBitmap_Dest) Return $hGDIBitmap EndIf Return $hBitmap_Dest EndFunc #EndRegion #Region Median Func _GDIPlus_BitmapApplyFilter_Median($hImage, $fRadius = 3, $bGDI = True) Local Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Local Const $hBitmap_Dest = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $tBitmapData_Dest = _GDIPlus_BitmapLockBits($hBitmap_Dest, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) Local Const $iScan0_Dest = DllStructGetData($tBitmapData_Dest, "Scan0") Local Const $tPixel_Dest = DllStructCreate("int[" & $iW * $iH & "];", $iScan0_Dest) Local Const $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW - 1, $iH - 1, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local Const $iScan0 = DllStructGetData($tBitmapData, "Scan0") Local Const $tPixel = DllStructCreate("int[" & $iW * $iH & "];", $iScan0) Local $iX, $iY, $iRowOffset For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW + 1 For $iX = 0 To $iW - 1 DllStructSetData($tPixel_Dest, 1, __Median_Value($iX, $iY, $fRadius, $tPixel, $iW, $iH), $iRowOffset + $iX) $fProg += 1 Next Next _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData) _GDIPlus_BitmapUnlockBits($hBitmap_Dest, $tBitmapData_Dest) _GDIPlus_ImageSaveToFile($hBitmap_Dest, @ScriptDir & "\Filter_Median" & $fRadius & "_" & @YEAR & @MON & @MDAY & @MIN & @SEC & ".png") If $bGDI Then Local $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_Dest) _GDIPlus_BitmapDispose($hBitmap_Dest) Return $hGDIBitmap EndIf Return $hBitmap_Dest EndFunc Func __Median_Value($iPosX, $iPosY, $fRadius, $tPixel, $iW, $iH) Local $iX, $iY, $aColors[1000], $iColors = 0, $iSize = $iW * $iH - 1, $iOff, $e For $iX = $iPosX - $fRadius To $iPosX + $fRadius For $iY = $iPosY - $fRadius To $iPosY + $fRadius $iOff = 1 + $iY * $iW + $iX $aColors[$iColors] = DllStructGetData($tPixel, 1, $iOff < 1 ? 1 : $iOff > $iSize ? $iSize : $iOff) $iColors += 1 Next Next ReDim $aColors[$iColors] ;~ _ArraySort($aColors, 0) $e = $iColors - 1 __ArrayQuickSort1D($aColors, 0, $e) Local $iMid = Floor($iColors / 2), $iMedian If BitAND($iColors, 1) Then $iMedian = Int($aColors[$iMid + 1]) Else $iMedian = Int(($aColors[$iMid] + $aColors[$iMid + 1]) / 2) EndIf Return $iMedian EndFunc #EndRegion _GDIPlus_BitmapApplyFilter v0.9.8 build 2024-04-17 beta.7z -
I ported half of the Cairo functions to Autoit. You can read more about the functions here: https://www.cairographics.org/documentation/ The probability is high that errors have crept in and I have only tested a fraction of the functions. Anyone who wants to can contribute examples. All needed files (DLLs, UDF and examples) can be download from my OneDrive: Cairo for Autoit If you find a mistake, I am sure you will, then please report it.
-
As discussed here: I created a DLL (x86 and x64) to do a file compare like the FC.exe does (only binary comparison!) but filling up the memory which can be read out by Autoit. UDF _WinAPI_FileCompare.au3: ;Version v0.70 build 2024-03-23 beta #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinaryString ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinaryString($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains hex string values (offset, file1, file2) from the differences between the two files. ; Large memory consumption for files > 80 MB as everything is kept in memory! ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinaryString($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinaryString", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinaryString ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileCompareBinary ; Description ...: Reads two files into the memory and compares them byte by byte. Result is saved in the memory. ; Syntax ........: _WinAPI_FileCompareBinary($sFile1, $sFile2, Byref $tMemArray) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $tMemArray - a ptr dll struct which holds a ptr entry which is filled by the DLL. ; Return values .: Number of unequal bytes found in both files otherwise negative value on error. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The memory pointer $tMemArray must be released using _MemGlobalFree() which holds the pointer to the result. ; The result contains integer values (offset, file1, file2) from the differences between the two files. ; Large memory consumption as everything is kept in memory but 1/3 less than _WinAPI_FileCompareBinaryString. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileCompareBinary($sFile1, $sFile2, ByRef $tMemArray) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) If Not IsDllStruct($tMemArray) Then Return SetError(-50, 0, 0) Local $aReturn = DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "int64", "_WinAPI_FileCompareBinary", "str", $sFile1, "str", $sFile2, "struct*", $tMemArray) If @error Then Return SetError(-60, 0, 0) If $aReturn[0] < 0 Then SetError($aReturn[0], 0, 0) Return $aReturn[0] EndFunc ;==>_WinAPI_FileCompareBinary ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_FileComparePrint ; Description ...: Reads two files into the memory and compares them byte by byte. Result will be printed to the console only. ; Syntax ........: _WinAPI_FileComparePrint($sFile1, $sFile2[, $bUnbuffered = False]) ; Parameters ....: $sFile1 - first file to read. ; $sFile2 - second file to read. ; $bUnbuffered - [optional] a boolean value. Default is False. If $bUnbuffered then file will be read ; byte by byte and result will be displayed, otherwise both files will be read into the ; memory and then compared. ; Return values .: 1 if successfull, otherwise 0. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Use #AutoIt3Wrapper_Change2CUI=y when compiling to display result in console. ; Related .......: ; Link ..........: https://www.autoitscript.com/forum/index.php?showtopic=211619 ; Example .......: No ; =============================================================================================================================== Func _WinAPI_FileComparePrint($sFile1, $sFile2, $bUnbuffered = False) If Not FileExists($sFile1) Then Return SetError(-10, 0, 0) If Not FileExists($sFile2) Then Return SetError(-20, 0, 0) If Not FileGetSize($sFile1) Then Return SetError(-30, 0, 0) If Not FileGetSize($sFile2) Then Return SetError(-40, 0, 0) DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "_WinAPI_FileComparePrint", "str", $sFile1, "str", $sFile2, "bool", $bUnbuffered) If @error Then Return SetError(-60, 0, 0) Return 1 EndFunc ;==>_WinAPI_FileComparePrint Func _WinAPI_FileCompareAbout() DllCall(@AutoItX64 ? "_WinAPI_FileCompare_x64.dll" : "_WinAPI_FileCompare.dll", "none", "About") EndFunc ;==>_WinAPI_FileCompareAbout Example1: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinaryString("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 $t = DllStructCreate("char string[15]", Ptr($tMemArray.addr + $i * 15 + ($j = 0 ? $j : 6 + $j * 3))) ConsoleWrite($t.string & ($j = 0 ? ":" : "") & @TAB) Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example2: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=y #include <WinAPIFiles.au3> #include <Memory.au3> #include "_WinAPI_FileCompare.au3" Global $tMemArray = DllStructCreate("ptr addr") Global $fTimer = TimerInit() Global $iReturn = _WinAPI_FileCompareBinary("img1.bmp", "img2.bmp", $tMemArray) ConsoleWrite("Dll runtime: " & TimerDiff($fTimer) & " ms" & @CRLF) If $iReturn Then If _WinAPI_IsBadReadPtr($tMemArray.addr, $iReturn) <> 1 Then ConsoleWrite(@CRLF) ConsoleWrite("Displaying result..." & @CRLF) ConsoleWrite("Offset" & @TAB & @TAB & "File1" & @TAB & "File2" & @CRLF) Global $i, $j, $t, $c = 0 For $i = 0 To $iReturn For $j = 0 To 2 Switch $j Case 0 $t = DllStructCreate("ulong offset", Ptr($tMemArray.addr + $i * 8)) ConsoleWrite(Hex($t.offset, 8) & ":" & @TAB) Case 1 $t = DllStructCreate("ubyte hex1", Ptr($tMemArray.addr + $i * 8 + 4)) ConsoleWrite(Hex($t.hex1, 2) & @TAB) Case 2 $t = DllStructCreate("ubyte hex2", Ptr($tMemArray.addr + $i * 8 + 5)) ConsoleWrite(Hex($t.hex2, 2) & @TAB) EndSwitch Next $c += 1 ConsoleWrite(@CRLF) Next ConsoleWrite(@CRLF) ConsoleWrite("Found " & $c & " differences!" & @CRLF) ConsoleWrite(@CRLF) If $tMemArray.addr Then _MemGlobalFree($tMemArray.addr) Else ConsoleWrite("Access violation to memory address" & @CRLF) EndIf Else ConsoleWrite("Files are equal!" & @CRLF) EndIf Example3: ;Coded by UEZ build 2024-03-22 beta #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include "_WinAPI_FileCompare.au3" _WinAPI_FileComparePrint("img1.bmp", "img2.bmp") I used the two images from here: Examples output should look like this here (always hex values): Dll runtime: 5.6315 ms Displaying result... Offset File1 File2 0009AB99: F0 C7 0009AB9A: EF CB 0009AB9B: 81 34 0009C795: 23 00 0009C796: 7C 80 0009C797: F5 FF Found 6 differences! You can read out the result and put it to an array... With this version you should be able to use multi-threading / multi-calls of the DLL as the memory is now allocated with each call. For x86 it may fail when the memory cannot be allocated (2GB limit) and the dll will return 0. I may add another feature to the DLL to get around the x86 limitation at the expense of speed by using chunked memory allocation if it makes sense... All files can be found also in the 7-Zip archive. _WinAPI_FileCompare DLL v0.70 build 2024-03-22.7z
-
Hello. I'm trying to call function "LeCreateProcess" in LoaderDLL.dll but having issues getting any results back. I barely understand C++. I got most values from here https://github.com/xupefei/Locale-Emulator within the https://github.com/xupefei/Locale-Emulator/blob/aa99dec3b25708e676c90acf5fed9beaac319160/LEProc/LoaderWrapper.cs I'm attaching also LocaleEmulator.dll but according to Dependency Walker the function is located in LoaderDLL.dll The goal is to run an application, in this instance, with a Japanese locale. Program itself works fine but in Windows 11 there's no easy way of adding custom options into Context menu where this program would be located if clicked on exe. #include <Date.au3> Local $sProgramPath = "PATH TO ANY EXE FILE" Local $hDLL = DllOpen("PATH TO LOADER.DLL") If @error Then MsgBox(0, "Error", "Failed to open dll") DllClose($hDLL) Exit EndIf Local $SHIFT_JIS = 932 Local $LANG_JAPANESE = 0x411 Local $SHIFTJIS_CHARSET = 128 Local $LEB = DllStructCreate("struct; UINT AnsiCodePage; UINT OemCodePage; UINT LocaleID; UINT DefaultCharset; UINT HookUiLanguageApi; WCHAR DefaultFaceName[64]; PTR Timezone; endstruct") ;Unsure about last two values DllStructSetData($LEB, "AnsiCodePage", $SHIFT_JIS) DllStructSetData($LEB, "OemCodePage", $SHIFT_JIS) DllStructSetData($LEB, "LocaleID", $LANG_JAPANESE) DllStructSetData($LEB, "DefaultCharset", $SHIFTJIS_CHARSET) DllStructSetData($LEB, "HookUiLanguageApi", 0) DllStructSetData($LEB, "DefaultFaceName", "") ;I'm not sure about this part DllStructSetData($LEB, "Timezone", _Date_Time_GetTimeZoneInformation()) ;This seems correct but I don't know if that information is formatted correctly Local $tProcessInfo = DllStructCreate($tagPROCESS_INFORMATION) ;From help file. I don't know if this is enough Local $aResult = DllCall($hDLL, "none", "LeCreateProcess", "struct*", $LEB, "wstr", $sProgramPath, "ptr", Null, "wstr", @WorkingDir, "ptr", Null, "ptr", Null, "struct*", $tProcessInfo, "ptr", Null, "ptr", Null, "ptr", Null, "ptr", Null) If @error Then MsgBox(0, "Error", "Error - " & @Extended) DllClose($hDLL) Exit EndIf DllClose($hDLL) Any help is appreciated! LoaderDll.dll LocaleEmulator.dll
-
Hi, I am having a problem invoking the "IdnToAscii" (documentation) function to convert an IDN hostname into its "Punycode" form. Description: I'm encountering a problem with the "IdnToAscii" function, when trying to convert an Internationalized Domain Name (IDN) to its ASCII equivalent using the "normaliz.dll" library. While the function call itself doesn't result in an error (returns 0), the output buffer doesn't contain the expected ASCII representation of the IDN. Details: I've confirmed that the "normaliz.dll" library is loaded correctly. The parameters passed to the "IdnToAscii" function, including the Unicode string and buffer sizes, appear to be correct. I'm using the following flags: 0x01 for IDN_ALLOW_UNASSIGNED. Issue: Despite these preparations, the function doesn't return the expected ASCII representation of the IDN in the output buffer. I've checked the function's return value, and it doesn't indicate an error. I'm try to understand why the "IdnToAscii" function isn't providing the correct result. Any insights, suggestions, or guidance would be greatly appreciated. Thank you in advance for your help! Code: #include <WinAPI.au3> #include <Array.au3> Local $dll = DllOpen(@SystemDir & "\normaliz.dll") Local $unicodeDomain = "bücher.example.com" Local $unicodeDomainPtr = DllStructCreate("wchar[" & StringLen($unicodeDomain) + 1 & "]") DllStructSetData($unicodeDomainPtr, 1, $unicodeDomain) Local $bufferSize = 255 ;Note that IDN names have a maximum length. Local $output = DllStructCreate("wchar[" & $bufferSize & "]") Local $returnValue = DllCall($dll, "wstr", "IdnToAscii", _ "dword", 0x01, _ "wstr", DllStructGetPtr($unicodeDomainPtr), _ "int", StringLen($unicodeDomain), _ "ptr", DllStructGetPtr($output), _ "int", $bufferSize) If @error Or Not IsArray($returnValue) Then MsgBox(16, "Error converting to Punycode", @error) Else _ArrayDisplay($returnValue) MsgBox(64, "Punycode value", DllStructGetData($output, 1, 0)) _WinAPI_GetLastErrorMessage() ConsoleWrite( @error & @CRLF) EndIf DllClose($dll)
-
MySQL UDFs using libmysql.dll functions: most functions from MySQL API all are prefixed with an underscore: _MySql... e.g.: _MySQL_Real_Query( sometimes parameters are chaged - read function descriptions in include file MySQL.au3 If you do not need the power of these UDFs and you simple want to use basic SQL commands, then have a look at not included: MySQL_Connect - This function is deprecated. Use _MySQL_Real_Connect instead. MySQL_Create_DB - This function is deprecated. Use mysql_query() to issue an SQL CREATE DATABASE statement instead. MySQL_Drop_DB - This function is deprecated. Use mysql_query() to issue an SQL DROP DATABASE statement instead. MySQL_Escape_String - You should use _mysql_real_escape_string() instead! MySQL_Kill - This function is deprecated. Use mysql_real_query() to issue an SQL KILL statement instead mysql_library_end - Called by _MySQL_EndLibrary. mysql_library_init - Called by _MySQL_InitLibrary. I included a fallback-libmysql.dll: yoou can include libMySQLDLL.au3 and set $Use_EmbeddedDLL=True when calling _MySQL_InitLibrary an example for XAMPP / cdcol is also included in ZIP. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.1 (beta) Author: Prog@ndy Script Function: MySQL-Plugin Demo Script #ce ---------------------------------------------------------------------------- #include <array.au3> #include "mysql.au3" ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen. _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "could nit init MySQL") MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() ;Fehler Demo: MsgBox(0,"Error-demo","Error-Demo") $connected = _MySQL_Real_Connect($MysqlConn,"localhostdfdf","droot","","cdcol") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif ; XAMPP cdcol MsgBox(0, "XAMPP-Cdcol-demo", "XAMPP-Cdcol-demo") $connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "", "cdcol") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM cds" $mysql_bool = _MySQL_Real_Query($MysqlConn, $query) If $mysql_bool = $MYSQL_SUCCESS Then MsgBox(0, '', "Query OK") Else $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) EndIf $res = _MySQL_Store_Result($MysqlConn) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) MsgBox(0, "", $rows & "-" & $fields) ; Access2 1 MsgBox(0, '', "Access method 1- manual") Dim $array[$rows][$fields] For $k = 1 To $rows $mysqlrow = _MySQL_Fetch_Row($res,$fields) $lenthsStruct = _MySQL_Fetch_Lengths($res) For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) $array[$k - 1][$i - 1] = $data Next Next _ArrayDisplay($array) ; Access 2 MsgBox(0, '', "Access method 2 - row for row") _MySQL_Data_Seek($res, 0) ; just reset the pointer to the beginning of the result set Do $row1 = _MySQL_Fetch_Row_StringArray($res) If @error Then ExitLoop _ArrayDisplay($row1) Until @error ; Access 3 MsgBox(0, '', "Access method 3 - read whole result in 2D-Array") $array = _MySQL_Fetch_Result_StringArray($res) _ArrayDisplay($array) ; fieldinfomation MsgBox(0, '', "Access fieldinformation") Dim $arFields[$fields][3] For $i = 0 To $fields - 1 $field = _MySQL_Fetch_Field_Direct($res, $i) $arFields[$i][0] = _MySQL_Field_ReadValue($field, "name") $arFields[$i][1] = _MySQL_Field_ReadValue($field, "table") $arFields[$i][2] = _MySQL_Field_ReadValue($field, "db") Next _ArrayDisplay($arFields) ; free result _MySQL_Free_Result($res) ; Close connection _MySQL_Close($MysqlConn) ; exit MYSQL _MySQL_EndLibrary() MySQL UDf Downloads: (including x86 and x64)</array.au3>
-
I updated the UDF by Patric Pendelin to use the MemoryDLL UDF. There are only two new functions: _SevenZip_Load & _SevenZip_Free The first function must be called before using any other functions included in the UDF and the other should be called to free memory when the UDF is no longer needed! The size of binary from the module was excessive so I used the ZLMA UDF to compress it. It will be decompressed at run time before its loaded into memory. The only advantage of using this UDF is that it removes the need to included any DLLs in your script. A lot of functions haven't been added yet! For those that dare: The API for the 7-Zip32.dll module is included in the attachment. These functions work in the same way you would you use the standalone 7za.exe executable so the Help.chm file applies to these functions aswell. Thats it, Enjoy! The code below is a sneak peak at the actually UDF, meaning it dosen't work without the other includes and the embed binary. - Download the attachment. #include-once #include "MemoryDLL.au3" #include "LZMA.au3" Global $__7ZIPDLL = Default, $__7ZIPINIT = False #cs =============================================================================== Name: 7-Zip.au3 Version: 1.0 Datum: 08.07.2008 Author: Patric Pendelin eMail: <patric.pendelin (a) gmx.de> Modified By: Decipher Script Function: _SevenZip_Load() _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) Extracts files from an archive _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) Add files to an archive _SevenZip_GetVersion() Get 7_zip32.dll Version _SevenZip_GetRunning() _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) _SevenZip_GetArchiveType($s_Archive) _SevenZip_GetFileCount($s_Archive) _SevenZip_GetUDFVersion() Returns UDF version number _SevenZip_Free() #ce =============================================================================== Func _SevenZip_Load() If Not $__7ZIPINIT Then $__7ZIPDLL = MemoryDllOpen(__7ZIPBIN()) $__7ZIPINIT = True EndIf EndFunc Func _SevenZip_Free() If $__7ZIPINIT Then MemoryDllClose($__7ZIPDLL) $__7ZIPINIT = False $__7ZIPDLL = Default EndIf EndFunc ;=============================================================================== ; Function Name: _SevenZip_Extract ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $s_Overwrite: Specifies the overwrite mode during extraction, to overwrite files already present on disk. (Def. "") ; -1: Overwrite All existing files without prompt. ; -2: Skip extracting of existing files. ; -3: aUto rename extracting file (for example, name.txt will be renamed to name_1.txt). ; -4: auto rename existing file (for example, name.txt will be renamed to name_1.txt). ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Extract($s_Archive, $s_Out = "", $s_Pass = "", $szCmdLine = "", $s_Overwrite = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Set Output directory If $s_Out = "" Then Local $as_Res = StringSplit($s_Archive, "\") For $i = 1 To $as_Res[0] - 1 $s_Out &= $as_Res[$i] & "\" Next EndIf ; (Overwrite mode) switch: If $s_Overwrite = 1 Then $s_Overwrite = "-aoa"; Overwrite All existing files without prompt. ElseIf $s_Overwrite = 2 Then $s_Overwrite = "-aos"; Skip extracting of existing files. ElseIf $s_Overwrite = 3 Then $s_Overwrite = "-aou"; Auto rename extracting file (for example, name.txt will be renamed to name_1.txt). ElseIf $s_Overwrite = 4 Then $s_Overwrite = "-aot"; Auto rename existing file (for example, name.txt will be renamed to name_1.txt). EndIf If $szCmdLine = "" Then $szCmdLine = ' x "' & $s_Archive & '" ' & $s_Overwrite & ' -o"' & $s_Out & '" -p"' & $s_Pass & '"' Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Extract ;=============================================================================== ; Function Name: _SevenZip_Add ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Typ: Specifies the type of archive. ; $i_Comp: Sets level of compression. [0 | 1 | 3 | 5 | 7 | 9 ] ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) If $szCmdLine = "" Then If $s_Pass = "" Then $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -mx=' & $i_Comp Else $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -p"' & $s_Pass & '" -mhe=on -mx=' & $i_Comp EndIf EndIf Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Add ;=============================================================================== ; Function Name: _SevenZip_GetVersion ; Description: The version of 7-zip32.dll is returned. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetVersion() ; Return Value(s): On Success -Return File Version ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetVersion() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetVersion") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetVersion ;=============================================================================== ; Function Name: _SevenZip_GetRunning ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; Application side before executing API which by all means accompanies file access such as compressing/thawing, ; it is necessary to check whether because of this feasibility. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetRunning() ; Return Value(s): On Success -Return 1(It is in the midst of executing.) ; Return 0(Is not in the midst of executing, (feasibility).) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetRunning() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetRunning") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetRunning ;=============================================================================== ; Function Name: _SevenZip_CheckArchive ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; As the archive file which the designated file supports ; It returns whether or not it is correct. ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_CheckArchive($s_Archive) ; Return Value(s): On Success -Return 1 (At the time of correct archive file.) ; Return 0 (When the file is illegitimate.) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipCheckArchive", "str", $s_Archive, "int", $i_iMode) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_CheckArchive ;=============================================================================== ; Function Name: _SevenZip_GetArchiveType ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_GetArchiveType($s_Archive) ; Return Value(s): On Success -Return 1 (ZIP type) ; Return 2 (7z32 type) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetArchiveType($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetArchiveType", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetArchiveType ;=============================================================================== ; Function Name: _SevenZip_GetFileCount ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: The number of files in the Archive file. ; ; Syntax: _SevenZip_GetFileCount($s_Archive) ; Return Value(s): On Success -Return Numer of files ; On Failure -@error 1: Can´t opens a DLL file for use in MemoryDllCall. ; @error 2: Error in MemoryDllCall ; ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetFileCount($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetFileCount", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetFileCount #region ### BINARY ### Func __7ZIPBIN() #cs Name: 7-ZIP32 BINARY Version 9.20.00.02 Requirements: Windows9x/Me/NT/200x/XP/Vista/7 Author: Akita Minoru ( Http://Akky.Xrea.Jp/support.Html ) Download the Library: 7-Zip-Library.7z Basic Usage: #include "7-Zip.au3" _SevenZip_Load() Dim $sCommandLine = "Accepts Switches and etc" _SevenZip_Exec($sCommandLine) ; See the included 7-Zip.chm documentation _SevenZip_Free() Exit
-
welcome I need help dealing with a C++ DLL Specify that I need help with how to use this function struct libusb_device; typedef struct libusb_context libusb_context; ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,libusb_device ***list); My problem is how to deal with "libusb_device ***list" my code $libusb_device = DllStructCreate("PTR") Func libusb_init() $Var = DllCall($libusb0, "ptr", "libusb_init",'ptr',$_libusb_device_handle_Ptr) If @error Then Return False Return $Var[1] EndFunc Func libusb_get_device_list() MsgBox(0,VarGetType($_libusb_device_handle_Ptr),$_libusb_device_handle_Ptr) $Var = DllCall($libusb0, "int", "libusb_get_device_list","ptr",$_libusb_device_handle_Ptr,"ptr*",POINTER(POINTER($libusb_device))) $Error = @error If $Error Then Return False MsgBox(0,VarGetType($Var),$Error&@CRLF&$Var) _ArrayDisplay($Var) Return $Var[1] EndFunc Thank you iLibUSB.dll iLibUSB_32.dll libusb.h
-
Here is a UDF geared at making libcurl more accessible to AutoIt users. Homepage of curl and libcurl: http://curl.haxx.se Technical overview: libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more! (from http://curl.haxx.se/libcurl/) Features: This UDF wraps the "easy" interface of libcurl. Below is a complete list of the functions currently available in this library: ; #CURRENT# ===================================================================================================================== ;_curl_easy_escape ;_curl_easy_init ;_curl_easy_cleanup ;_curl_easy_duphandle ;_curl_easy_getinfo ;_curl_easy_pause ;_curl_easy_perform ;_curl_easy_recv ;_curl_easy_reset ;_curl_easy_send ;_curl_easy_setopt ;_curl_easy_strerror ;_curl_easy_unescape ;_curl_formadd ;_curl_formfree ;_curl_free ;_curl_getdate ;_curl_global_cleanup ;_curl_global_init ;_curl_global_init_mem ;_curl_slist_append ;_curl_slist_free_all ;_curl_version ;_curl_version_info ; =============================================================================================================================== Code: libcURLConstants.au3 #include-once ; libcURLConstants.au3, generated from curl.h of libcurl 7.25.0 on 04/06/2012 05:11:23 GMT for use with "libcURL.au3", the libcurl wrapper UDF by smartee. ; possible error codes from all sorts of curl functions Global Const $CURLE_OK = 0 Global Const $CURLE_UNSUPPORTED_PROTOCOL = 1 Global Const $CURLE_FAILED_INIT = 2 Global Const $CURLE_URL_MALFORMAT = 3 Global Const $CURLE_NOT_BUILT_IN = 4 Global Const $CURLE_COULDNT_RESOLVE_PROXY = 5 Global Const $CURLE_COULDNT_RESOLVE_HOST = 6 Global Const $CURLE_COULDNT_CONNECT = 7 Global Const $CURLE_FTP_WEIRD_SERVER_REPLY = 8 Global Const $CURLE_REMOTE_ACCESS_DENIED = 9 Global Const $CURLE_FTP_ACCEPT_FAILED = 10 Global Const $CURLE_FTP_WEIRD_PASS_REPLY = 11 Global Const $CURLE_FTP_ACCEPT_TIMEOUT = 12 Global Const $CURLE_FTP_WEIRD_PASV_REPLY = 13 Global Const $CURLE_FTP_WEIRD_227_FORMAT = 14 Global Const $CURLE_FTP_CANT_GET_HOST = 15 Global Const $CURLE_OBSOLETE16 = 16 Global Const $CURLE_FTP_COULDNT_SET_TYPE = 17 Global Const $CURLE_PARTIAL_FILE = 18 Global Const $CURLE_FTP_COULDNT_RETR_FILE = 19 Global Const $CURLE_OBSOLETE20 = 20 Global Const $CURLE_QUOTE_ERROR = 21 Global Const $CURLE_HTTP_RETURNED_ERROR = 22 Global Const $CURLE_WRITE_ERROR = 23 Global Const $CURLE_OBSOLETE24 = 24 Global Const $CURLE_UPLOAD_FAILED = 25 Global Const $CURLE_READ_ERROR = 26 Global Const $CURLE_OUT_OF_MEMORY = 27 Global Const $CURLE_OPERATION_TIMEDOUT = 28 Global Const $CURLE_OBSOLETE29 = 29 Global Const $CURLE_FTP_PORT_FAILED = 30 Global Const $CURLE_FTP_COULDNT_USE_REST = 31 Global Const $CURLE_OBSOLETE32 = 32 Global Const $CURLE_RANGE_ERROR = 33 Global Const $CURLE_HTTP_POST_ERROR = 34 Global Const $CURLE_SSL_CONNECT_ERROR = 35 Global Const $CURLE_BAD_DOWNLOAD_RESUME = 36 Global Const $CURLE_FILE_COULDNT_READ_FILE = 37 Global Const $CURLE_LDAP_CANNOT_BIND = 38 Global Const $CURLE_LDAP_SEARCH_FAILED = 39 Global Const $CURLE_OBSOLETE40 = 40 Global Const $CURLE_FUNCTION_NOT_FOUND = 41 Global Const $CURLE_ABORTED_BY_CALLBACK = 42 Global Const $CURLE_BAD_FUNCTION_ARGUMENT = 43 Global Const $CURLE_OBSOLETE44 = 44 Global Const $CURLE_INTERFACE_FAILED = 45 Global Const $CURLE_OBSOLETE46 = 46 Global Const $CURLE_TOO_MANY_REDIRECTS = 47 Global Const $CURLE_UNKNOWN_OPTION = 48 Global Const $CURLE_TELNET_OPTION_SYNTAX = 49 Global Const $CURLE_OBSOLETE50 = 50 Global Const $CURLE_PEER_FAILED_VERIFICATION = 51 Global Const $CURLE_GOT_NOTHING = 52 Global Const $CURLE_SSL_ENGINE_NOTFOUND = 53 Global Const $CURLE_SSL_ENGINE_SETFAILED = 54 Global Const $CURLE_SEND_ERROR = 55 Global Const $CURLE_RECV_ERROR = 56 Global Const $CURLE_OBSOLETE57 = 57 Global Const $CURLE_SSL_CERTPROBLEM = 58 Global Const $CURLE_SSL_CIPHER = 59 Global Const $CURLE_SSL_CACERT = 60 Global Const $CURLE_BAD_CONTENT_ENCODING = 61 Global Const $CURLE_LDAP_INVALID_URL = 62 Global Const $CURLE_FILESIZE_EXCEEDED = 63 Global Const $CURLE_USE_SSL_FAILED = 64 Global Const $CURLE_SEND_FAIL_REWIND = 65 Global Const $CURLE_SSL_ENGINE_INITFAILED = 66 Global Const $CURLE_LOGIN_DENIED = 67 Global Const $CURLE_TFTP_NOTFOUND = 68 Global Const $CURLE_TFTP_PERM = 69 Global Const $CURLE_REMOTE_DISK_FULL = 70 Global Const $CURLE_TFTP_ILLEGAL = 71 Global Const $CURLE_TFTP_UNKNOWNID = 72 Global Const $CURLE_REMOTE_FILE_EXISTS = 73 Global Const $CURLE_TFTP_NOSUCHUSER = 74 Global Const $CURLE_CONV_FAILED = 75 Global Const $CURLE_CONV_REQD = 76 Global Const $CURLE_SSL_CACERT_BADFILE = 77 Global Const $CURLE_REMOTE_FILE_NOT_FOUND = 78 Global Const $CURLE_SSH = 79 Global Const $CURLE_SSL_SHUTDOWN_FAILED = 80 Global Const $CURLE_AGAIN = 81 Global Const $CURLE_SSL_CRL_BADFILE = 82 Global Const $CURLE_SSL_ISSUER_ERROR = 83 Global Const $CURLE_FTP_PRET_FAILED = 84 Global Const $CURLE_RTSP_CSEQ_ERROR = 85 Global Const $CURLE_RTSP_SESSION_ERROR = 86 Global Const $CURLE_FTP_BAD_FILE_LIST = 87 Global Const $CURLE_CHUNK_FAILED = 88 ; minimum size of error buffer to be used with $CURLOPT_ERRORBUFFER Global Const $CURL_ERROR_SIZE = 256 ; $CURLPROTO_ constants are for the $CURLOPT_*PROTOCOLS options Global Const $CURLPROTO_HTTP = BitShift(1, 0) Global Const $CURLPROTO_HTTPS = BitShift(1, -1) Global Const $CURLPROTO_FTP = BitShift(1, -2) Global Const $CURLPROTO_FTPS = BitShift(1, -3) Global Const $CURLPROTO_SCP = BitShift(1, -4) Global Const $CURLPROTO_SFTP = BitShift(1, -5) Global Const $CURLPROTO_TELNET = BitShift(1, -6) Global Const $CURLPROTO_LDAP = BitShift(1, -7) Global Const $CURLPROTO_LDAPS = BitShift(1, -8) Global Const $CURLPROTO_DICT = BitShift(1, -9) Global Const $CURLPROTO_FILE = BitShift(1, -10) Global Const $CURLPROTO_TFTP = BitShift(1, -11) Global Const $CURLPROTO_IMAP = BitShift(1, -12) Global Const $CURLPROTO_IMAPS = BitShift(1, -13) Global Const $CURLPROTO_POP3 = BitShift(1, -14) Global Const $CURLPROTO_POP3S = BitShift(1, -15) Global Const $CURLPROTO_SMTP = BitShift(1, -16) Global Const $CURLPROTO_SMTPS = BitShift(1, -17) Global Const $CURLPROTO_RTSP = BitShift(1, -18) Global Const $CURLPROTO_RTMP = BitShift(1, -19) Global Const $CURLPROTO_RTMPT = BitShift(1, -20) Global Const $CURLPROTO_RTMPE = BitShift(1, -21) Global Const $CURLPROTO_RTMPTE = BitShift(1, -22) Global Const $CURLPROTO_RTMPS = BitShift(1, -23) Global Const $CURLPROTO_RTMPTS = BitShift(1, -24) Global Const $CURLPROTO_GOPHER = BitShift(1, -25) Global Const $CURLPROTO_ALL = BitNOT(0) ; $CURLOPTTYPE_[what] constants Global Const $CURLOPTTYPE_LONG = 0 Global Const $CURLOPTTYPE_OBJECTPOINT = 10000 Global Const $CURLOPTTYPE_FUNCTIONPOINT = 20000 Global Const $CURLOPTTYPE_OFF_T = 30000 ; $CURLOPT_[what] constants, to be used with _curl_easy_setopt() Global Const $CURLOPT_FILE = $CURLOPTTYPE_OBJECTPOINT + 1 Global Const $CURLOPT_URL = $CURLOPTTYPE_OBJECTPOINT + 2 Global Const $CURLOPT_PORT = $CURLOPTTYPE_LONG + 3 Global Const $CURLOPT_PROXY = $CURLOPTTYPE_OBJECTPOINT + 4 Global Const $CURLOPT_USERPWD = $CURLOPTTYPE_OBJECTPOINT + 5 Global Const $CURLOPT_PROXYUSERPWD = $CURLOPTTYPE_OBJECTPOINT + 6 Global Const $CURLOPT_RANGE = $CURLOPTTYPE_OBJECTPOINT + 7 Global Const $CURLOPT_INFILE = $CURLOPTTYPE_OBJECTPOINT + 9 Global Const $CURLOPT_ERRORBUFFER = $CURLOPTTYPE_OBJECTPOINT + 10 Global Const $CURLOPT_WRITEFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 11 Global Const $CURLOPT_READFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 12 Global Const $CURLOPT_TIMEOUT = $CURLOPTTYPE_LONG + 13 Global Const $CURLOPT_INFILESIZE = $CURLOPTTYPE_LONG + 14 Global Const $CURLOPT_POSTFIELDS = $CURLOPTTYPE_OBJECTPOINT + 15 Global Const $CURLOPT_REFERER = $CURLOPTTYPE_OBJECTPOINT + 16 Global Const $CURLOPT_FTPPORT = $CURLOPTTYPE_OBJECTPOINT + 17 Global Const $CURLOPT_USERAGENT = $CURLOPTTYPE_OBJECTPOINT + 18 Global Const $CURLOPT_LOW_SPEED_LIMIT = $CURLOPTTYPE_LONG + 19 Global Const $CURLOPT_LOW_SPEED_TIME = $CURLOPTTYPE_LONG + 20 Global Const $CURLOPT_RESUME_FROM = $CURLOPTTYPE_LONG + 21 Global Const $CURLOPT_COOKIE = $CURLOPTTYPE_OBJECTPOINT + 22 Global Const $CURLOPT_HTTPHEADER = $CURLOPTTYPE_OBJECTPOINT + 23 Global Const $CURLOPT_HTTPPOST = $CURLOPTTYPE_OBJECTPOINT + 24 Global Const $CURLOPT_SSLCERT = $CURLOPTTYPE_OBJECTPOINT + 25 Global Const $CURLOPT_KEYPASSWD = $CURLOPTTYPE_OBJECTPOINT + 26 Global Const $CURLOPT_CRLF = $CURLOPTTYPE_LONG + 27 Global Const $CURLOPT_QUOTE = $CURLOPTTYPE_OBJECTPOINT + 28 Global Const $CURLOPT_WRITEHEADER = $CURLOPTTYPE_OBJECTPOINT + 29 Global Const $CURLOPT_COOKIEFILE = $CURLOPTTYPE_OBJECTPOINT + 31 Global Const $CURLOPT_SSLVERSION = $CURLOPTTYPE_LONG + 32 Global Const $CURLOPT_TIMECONDITION = $CURLOPTTYPE_LONG + 33 Global Const $CURLOPT_TIMEVALUE = $CURLOPTTYPE_LONG + 34 Global Const $CURLOPT_CUSTOMREQUEST = $CURLOPTTYPE_OBJECTPOINT + 36 Global Const $CURLOPT_STDERR = $CURLOPTTYPE_OBJECTPOINT + 37 Global Const $CURLOPT_POSTQUOTE = $CURLOPTTYPE_OBJECTPOINT + 39 Global Const $CURLOPT_WRITEINFO = $CURLOPTTYPE_OBJECTPOINT + 40 Global Const $CURLOPT_VERBOSE = $CURLOPTTYPE_LONG + 41 Global Const $CURLOPT_HEADER = $CURLOPTTYPE_LONG + 42 Global Const $CURLOPT_NOPROGRESS = $CURLOPTTYPE_LONG + 43 Global Const $CURLOPT_NOBODY = $CURLOPTTYPE_LONG + 44 Global Const $CURLOPT_FAILONERROR = $CURLOPTTYPE_LONG + 45 Global Const $CURLOPT_UPLOAD = $CURLOPTTYPE_LONG + 46 Global Const $CURLOPT_POST = $CURLOPTTYPE_LONG + 47 Global Const $CURLOPT_DIRLISTONLY = $CURLOPTTYPE_LONG + 48 Global Const $CURLOPT_APPEND = $CURLOPTTYPE_LONG + 50 Global Const $CURLOPT_NETRC = $CURLOPTTYPE_LONG + 51 Global Const $CURLOPT_FOLLOWLOCATION = $CURLOPTTYPE_LONG + 52 Global Const $CURLOPT_TRANSFERTEXT = $CURLOPTTYPE_LONG + 53 Global Const $CURLOPT_PUT = $CURLOPTTYPE_LONG + 54 Global Const $CURLOPT_PROGRESSFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 56 Global Const $CURLOPT_PROGRESSDATA = $CURLOPTTYPE_OBJECTPOINT + 57 Global Const $CURLOPT_AUTOREFERER = $CURLOPTTYPE_LONG + 58 Global Const $CURLOPT_PROXYPORT = $CURLOPTTYPE_LONG + 59 Global Const $CURLOPT_POSTFIELDSIZE = $CURLOPTTYPE_LONG + 60 Global Const $CURLOPT_HTTPPROXYTUNNEL = $CURLOPTTYPE_LONG + 61 Global Const $CURLOPT_INTERFACE = $CURLOPTTYPE_OBJECTPOINT + 62 Global Const $CURLOPT_KRBLEVEL = $CURLOPTTYPE_OBJECTPOINT + 63 Global Const $CURLOPT_SSL_VERIFYPEER = $CURLOPTTYPE_LONG + 64 Global Const $CURLOPT_CAINFO = $CURLOPTTYPE_OBJECTPOINT + 65 Global Const $CURLOPT_MAXREDIRS = $CURLOPTTYPE_LONG + 68 Global Const $CURLOPT_FILETIME = $CURLOPTTYPE_LONG + 69 Global Const $CURLOPT_TELNETOPTIONS = $CURLOPTTYPE_OBJECTPOINT + 70 Global Const $CURLOPT_MAXCONNECTS = $CURLOPTTYPE_LONG + 71 Global Const $CURLOPT_CLOSEPOLICY = $CURLOPTTYPE_LONG + 72 Global Const $CURLOPT_FRESH_CONNECT = $CURLOPTTYPE_LONG + 74 Global Const $CURLOPT_FORBID_REUSE = $CURLOPTTYPE_LONG + 75 Global Const $CURLOPT_RANDOM_FILE = $CURLOPTTYPE_OBJECTPOINT + 76 Global Const $CURLOPT_EGDSOCKET = $CURLOPTTYPE_OBJECTPOINT + 77 Global Const $CURLOPT_CONNECTTIMEOUT = $CURLOPTTYPE_LONG + 78 Global Const $CURLOPT_HEADERFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 79 Global Const $CURLOPT_HTTPGET = $CURLOPTTYPE_LONG + 80 Global Const $CURLOPT_SSL_VERIFYHOST = $CURLOPTTYPE_LONG + 81 Global Const $CURLOPT_COOKIEJAR = $CURLOPTTYPE_OBJECTPOINT + 82 Global Const $CURLOPT_SSL_CIPHER_LIST = $CURLOPTTYPE_OBJECTPOINT + 83 Global Const $CURLOPT_HTTP_VERSION = $CURLOPTTYPE_LONG + 84 Global Const $CURLOPT_FTP_USE_EPSV = $CURLOPTTYPE_LONG + 85 Global Const $CURLOPT_SSLCERTTYPE = $CURLOPTTYPE_OBJECTPOINT + 86 Global Const $CURLOPT_SSLKEY = $CURLOPTTYPE_OBJECTPOINT + 87 Global Const $CURLOPT_SSLKEYTYPE = $CURLOPTTYPE_OBJECTPOINT + 88 Global Const $CURLOPT_SSLENGINE = $CURLOPTTYPE_OBJECTPOINT + 89 Global Const $CURLOPT_SSLENGINE_DEFAULT = $CURLOPTTYPE_LONG + 90 Global Const $CURLOPT_DNS_USE_GLOBAL_CACHE = $CURLOPTTYPE_LONG + 91 Global Const $CURLOPT_DNS_CACHE_TIMEOUT = $CURLOPTTYPE_LONG + 92 Global Const $CURLOPT_PREQUOTE = $CURLOPTTYPE_OBJECTPOINT + 93 Global Const $CURLOPT_DEBUGFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 94 Global Const $CURLOPT_DEBUGDATA = $CURLOPTTYPE_OBJECTPOINT + 95 Global Const $CURLOPT_COOKIESESSION = $CURLOPTTYPE_LONG + 96 Global Const $CURLOPT_CAPATH = $CURLOPTTYPE_OBJECTPOINT + 97 Global Const $CURLOPT_BUFFERSIZE = $CURLOPTTYPE_LONG + 98 Global Const $CURLOPT_NOSIGNAL = $CURLOPTTYPE_LONG + 99 Global Const $CURLOPT_SHARE = $CURLOPTTYPE_OBJECTPOINT + 100 Global Const $CURLOPT_PROXYTYPE = $CURLOPTTYPE_LONG + 101 Global Const $CURLOPT_ACCEPT_ENCODING = $CURLOPTTYPE_OBJECTPOINT + 102 Global Const $CURLOPT_PRIVATE = $CURLOPTTYPE_OBJECTPOINT + 103 Global Const $CURLOPT_HTTP200ALIASES = $CURLOPTTYPE_OBJECTPOINT + 104 Global Const $CURLOPT_UNRESTRICTED_AUTH = $CURLOPTTYPE_LONG + 105 Global Const $CURLOPT_FTP_USE_EPRT = $CURLOPTTYPE_LONG + 106 Global Const $CURLOPT_HTTPAUTH = $CURLOPTTYPE_LONG + 107 Global Const $CURLOPT_SSL_CTX_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 108 Global Const $CURLOPT_SSL_CTX_DATA = $CURLOPTTYPE_OBJECTPOINT + 109 Global Const $CURLOPT_FTP_CREATE_MISSING_DIRS = $CURLOPTTYPE_LONG + 110 Global Const $CURLOPT_PROXYAUTH = $CURLOPTTYPE_LONG + 111 Global Const $CURLOPT_FTP_RESPONSE_TIMEOUT = $CURLOPTTYPE_LONG + 112 Global Const $CURLOPT_IPRESOLVE = $CURLOPTTYPE_LONG + 113 Global Const $CURLOPT_MAXFILESIZE = $CURLOPTTYPE_LONG + 114 Global Const $CURLOPT_INFILESIZE_LARGE = $CURLOPTTYPE_OFF_T + 115 Global Const $CURLOPT_RESUME_FROM_LARGE = $CURLOPTTYPE_OFF_T + 116 Global Const $CURLOPT_MAXFILESIZE_LARGE = $CURLOPTTYPE_OFF_T + 117 Global Const $CURLOPT_NETRC_FILE = $CURLOPTTYPE_OBJECTPOINT + 118 Global Const $CURLOPT_USE_SSL = $CURLOPTTYPE_LONG + 119 Global Const $CURLOPT_POSTFIELDSIZE_LARGE = $CURLOPTTYPE_OFF_T + 120 Global Const $CURLOPT_TCP_NODELAY = $CURLOPTTYPE_LONG + 121 Global Const $CURLOPT_FTPSSLAUTH = $CURLOPTTYPE_LONG + 129 Global Const $CURLOPT_IOCTLFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 130 Global Const $CURLOPT_IOCTLDATA = $CURLOPTTYPE_OBJECTPOINT + 131 Global Const $CURLOPT_FTP_ACCOUNT = $CURLOPTTYPE_OBJECTPOINT + 134 Global Const $CURLOPT_COOKIELIST = $CURLOPTTYPE_OBJECTPOINT + 135 Global Const $CURLOPT_IGNORE_CONTENT_LENGTH = $CURLOPTTYPE_LONG + 136 Global Const $CURLOPT_FTP_SKIP_PASV_IP = $CURLOPTTYPE_LONG + 137 Global Const $CURLOPT_FTP_FILEMETHOD = $CURLOPTTYPE_LONG + 138 Global Const $CURLOPT_LOCALPORT = $CURLOPTTYPE_LONG + 139 Global Const $CURLOPT_LOCALPORTRANGE = $CURLOPTTYPE_LONG + 140 Global Const $CURLOPT_CONNECT_ONLY = $CURLOPTTYPE_LONG + 141 Global Const $CURLOPT_CONV_FROM_NETWORK_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 142 Global Const $CURLOPT_CONV_TO_NETWORK_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 143 Global Const $CURLOPT_CONV_FROM_UTF8_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 144 Global Const $CURLOPT_MAX_SEND_SPEED_LARGE = $CURLOPTTYPE_OFF_T + 145 Global Const $CURLOPT_MAX_RECV_SPEED_LARGE = $CURLOPTTYPE_OFF_T + 146 Global Const $CURLOPT_FTP_ALTERNATIVE_TO_USER = $CURLOPTTYPE_OBJECTPOINT + 147 Global Const $CURLOPT_SOCKOPTFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 148 Global Const $CURLOPT_SOCKOPTDATA = $CURLOPTTYPE_OBJECTPOINT + 149 Global Const $CURLOPT_SSL_SESSIONID_CACHE = $CURLOPTTYPE_LONG + 150 Global Const $CURLOPT_SSH_AUTH_TYPES = $CURLOPTTYPE_LONG + 151 Global Const $CURLOPT_SSH_PUBLIC_KEYFILE = $CURLOPTTYPE_OBJECTPOINT + 152 Global Const $CURLOPT_SSH_PRIVATE_KEYFILE = $CURLOPTTYPE_OBJECTPOINT + 153 Global Const $CURLOPT_FTP_SSL_CCC = $CURLOPTTYPE_LONG + 154 Global Const $CURLOPT_TIMEOUT_MS = $CURLOPTTYPE_LONG + 155 Global Const $CURLOPT_CONNECTTIMEOUT_MS = $CURLOPTTYPE_LONG + 156 Global Const $CURLOPT_HTTP_TRANSFER_DECODING = $CURLOPTTYPE_LONG + 157 Global Const $CURLOPT_HTTP_CONTENT_DECODING = $CURLOPTTYPE_LONG + 158 Global Const $CURLOPT_NEW_FILE_PERMS = $CURLOPTTYPE_LONG + 159 Global Const $CURLOPT_NEW_DIRECTORY_PERMS = $CURLOPTTYPE_LONG + 160 Global Const $CURLOPT_POSTREDIR = $CURLOPTTYPE_LONG + 161 Global Const $CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 = $CURLOPTTYPE_OBJECTPOINT + 162 Global Const $CURLOPT_OPENSOCKETFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 163 Global Const $CURLOPT_OPENSOCKETDATA = $CURLOPTTYPE_OBJECTPOINT + 164 Global Const $CURLOPT_COPYPOSTFIELDS = $CURLOPTTYPE_OBJECTPOINT + 165 Global Const $CURLOPT_PROXY_TRANSFER_MODE = $CURLOPTTYPE_LONG + 166 Global Const $CURLOPT_SEEKFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 167 Global Const $CURLOPT_SEEKDATA = $CURLOPTTYPE_OBJECTPOINT + 168 Global Const $CURLOPT_CRLFILE = $CURLOPTTYPE_OBJECTPOINT + 169 Global Const $CURLOPT_ISSUERCERT = $CURLOPTTYPE_OBJECTPOINT + 170 Global Const $CURLOPT_ADDRESS_SCOPE = $CURLOPTTYPE_LONG + 171 Global Const $CURLOPT_CERTINFO = $CURLOPTTYPE_LONG + 172 Global Const $CURLOPT_USERNAME = $CURLOPTTYPE_OBJECTPOINT + 173 Global Const $CURLOPT_PASSWORD = $CURLOPTTYPE_OBJECTPOINT + 174 Global Const $CURLOPT_PROXYUSERNAME = $CURLOPTTYPE_OBJECTPOINT + 175 Global Const $CURLOPT_PROXYPASSWORD = $CURLOPTTYPE_OBJECTPOINT + 176 Global Const $CURLOPT_NOPROXY = $CURLOPTTYPE_OBJECTPOINT + 177 Global Const $CURLOPT_TFTP_BLKSIZE = $CURLOPTTYPE_LONG + 178 Global Const $CURLOPT_SOCKS5_GSSAPI_SERVICE = $CURLOPTTYPE_OBJECTPOINT + 179 Global Const $CURLOPT_SOCKS5_GSSAPI_NEC = $CURLOPTTYPE_LONG + 180 Global Const $CURLOPT_PROTOCOLS = $CURLOPTTYPE_LONG + 181 Global Const $CURLOPT_REDIR_PROTOCOLS = $CURLOPTTYPE_LONG + 182 Global Const $CURLOPT_SSH_KNOWNHOSTS = $CURLOPTTYPE_OBJECTPOINT + 183 Global Const $CURLOPT_SSH_KEYFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 184 Global Const $CURLOPT_SSH_KEYDATA = $CURLOPTTYPE_OBJECTPOINT + 185 Global Const $CURLOPT_MAIL_FROM = $CURLOPTTYPE_OBJECTPOINT + 186 Global Const $CURLOPT_MAIL_RCPT = $CURLOPTTYPE_OBJECTPOINT + 187 Global Const $CURLOPT_FTP_USE_PRET = $CURLOPTTYPE_LONG + 188 Global Const $CURLOPT_RTSP_REQUEST = $CURLOPTTYPE_LONG + 189 Global Const $CURLOPT_RTSP_SESSION_ID = $CURLOPTTYPE_OBJECTPOINT + 190 Global Const $CURLOPT_RTSP_STREAM_URI = $CURLOPTTYPE_OBJECTPOINT + 191 Global Const $CURLOPT_RTSP_TRANSPORT = $CURLOPTTYPE_OBJECTPOINT + 192 Global Const $CURLOPT_RTSP_CLIENT_CSEQ = $CURLOPTTYPE_LONG + 193 Global Const $CURLOPT_RTSP_SERVER_CSEQ = $CURLOPTTYPE_LONG + 194 Global Const $CURLOPT_INTERLEAVEDATA = $CURLOPTTYPE_OBJECTPOINT + 195 Global Const $CURLOPT_INTERLEAVEFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 196 Global Const $CURLOPT_WILDCARDMATCH = $CURLOPTTYPE_LONG + 197 Global Const $CURLOPT_CHUNK_BGN_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 198 Global Const $CURLOPT_CHUNK_END_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 199 Global Const $CURLOPT_FNMATCH_FUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 200 Global Const $CURLOPT_CHUNK_DATA = $CURLOPTTYPE_OBJECTPOINT + 201 Global Const $CURLOPT_FNMATCH_DATA = $CURLOPTTYPE_OBJECTPOINT + 202 Global Const $CURLOPT_RESOLVE = $CURLOPTTYPE_OBJECTPOINT + 203 Global Const $CURLOPT_TLSAUTH_USERNAME = $CURLOPTTYPE_OBJECTPOINT + 204 Global Const $CURLOPT_TLSAUTH_PASSWORD = $CURLOPTTYPE_OBJECTPOINT + 205 Global Const $CURLOPT_TLSAUTH_TYPE = $CURLOPTTYPE_OBJECTPOINT + 206 Global Const $CURLOPT_TRANSFER_ENCODING = $CURLOPTTYPE_LONG + 207 Global Const $CURLOPT_CLOSESOCKETFUNCTION = $CURLOPTTYPE_FUNCTIONPOINT + 208 Global Const $CURLOPT_CLOSESOCKETDATA = $CURLOPTTYPE_OBJECTPOINT + 209 Global Const $CURLOPT_GSSAPI_DELEGATION = $CURLOPTTYPE_LONG + 210 Global Const $CURLOPT_DNS_SERVERS = $CURLOPTTYPE_OBJECTPOINT + 211 Global Const $CURLOPT_ACCEPTTIMEOUT_MS = $CURLOPTTYPE_LONG + 212 Global Const $CURLOPT_TCP_KEEPALIVE = $CURLOPTTYPE_LONG + 213 Global Const $CURLOPT_TCP_KEEPIDLE = $CURLOPTTYPE_LONG + 214 Global Const $CURLOPT_TCP_KEEPINTVL = $CURLOPTTYPE_LONG + 215 Global Const $CURLOPT_SSL_OPTIONS = $CURLOPTTYPE_LONG + 216 Global Const $CURLOPT_MAIL_AUTH = $CURLOPTTYPE_OBJECTPOINT + 217 ; some convenient "aliases" that follow the name scheme better Global Const $CURLOPT_WRITEDATA = $CURLOPT_FILE Global Const $CURLOPT_READDATA = $CURLOPT_INFILE Global Const $CURLOPT_HEADERDATA = $CURLOPT_WRITEHEADER Global Const $CURLOPT_RTSPHEADER = $CURLOPT_HTTPHEADER ; for use with _curl_global_init() Global Const $CURL_GLOBAL_SSL = BitShift(1, 0) Global Const $CURL_GLOBAL_WIN32 = BitShift(1, -1) Global Const $CURL_GLOBAL_ALL = BitOR($CURL_GLOBAL_SSL, $CURL_GLOBAL_WIN32) Global Const $CURL_GLOBAL_NOTHING = 0 Global Const $CURL_GLOBAL_DEFAULT = $CURL_GLOBAL_ALL Global Const $CURLINFO_STRING = 0x100000 Global Const $CURLINFO_LONG = 0x200000 Global Const $CURLINFO_DOUBLE = 0x300000 Global Const $CURLINFO_SLIST = 0x400000 Global Const $CURLINFO_MASK = 0x0fffff Global Const $CURLINFO_TYPEMASK = 0xf00000 Global Const $CURLINFO_EFFECTIVE_URL = $CURLINFO_STRING + 1 Global Const $CURLINFO_RESPONSE_CODE = $CURLINFO_LONG + 2 Global Const $CURLINFO_TOTAL_TIME = $CURLINFO_DOUBLE + 3 Global Const $CURLINFO_NAMELOOKUP_TIME = $CURLINFO_DOUBLE + 4 Global Const $CURLINFO_CONNECT_TIME = $CURLINFO_DOUBLE + 5 Global Const $CURLINFO_PRETRANSFER_TIME = $CURLINFO_DOUBLE + 6 Global Const $CURLINFO_SIZE_UPLOAD = $CURLINFO_DOUBLE + 7 Global Const $CURLINFO_SIZE_DOWNLOAD = $CURLINFO_DOUBLE + 8 Global Const $CURLINFO_SPEED_DOWNLOAD = $CURLINFO_DOUBLE + 9 Global Const $CURLINFO_SPEED_UPLOAD = $CURLINFO_DOUBLE + 10 Global Const $CURLINFO_HEADER_SIZE = $CURLINFO_LONG + 11 Global Const $CURLINFO_REQUEST_SIZE = $CURLINFO_LONG + 12 Global Const $CURLINFO_SSL_VERIFYRESULT = $CURLINFO_LONG + 13 Global Const $CURLINFO_FILETIME = $CURLINFO_LONG + 14 Global Const $CURLINFO_CONTENT_LENGTH_DOWNLOAD = $CURLINFO_DOUBLE + 15 Global Const $CURLINFO_CONTENT_LENGTH_UPLOAD = $CURLINFO_DOUBLE + 16 Global Const $CURLINFO_STARTTRANSFER_TIME = $CURLINFO_DOUBLE + 17 Global Const $CURLINFO_CONTENT_TYPE = $CURLINFO_STRING + 18 Global Const $CURLINFO_REDIRECT_TIME = $CURLINFO_DOUBLE + 19 Global Const $CURLINFO_REDIRECT_COUNT = $CURLINFO_LONG + 20 Global Const $CURLINFO_PRIVATE = $CURLINFO_STRING + 21 Global Const $CURLINFO_HTTP_CONNECTCODE = $CURLINFO_LONG + 22 Global Const $CURLINFO_HTTPAUTH_AVAIL = $CURLINFO_LONG + 23 Global Const $CURLINFO_PROXYAUTH_AVAIL = $CURLINFO_LONG + 24 Global Const $CURLINFO_OS_ERRNO = $CURLINFO_LONG + 25 Global Const $CURLINFO_NUM_CONNECTS = $CURLINFO_LONG + 26 Global Const $CURLINFO_SSL_ENGINES = $CURLINFO_SLIST + 27 Global Const $CURLINFO_COOKIELIST = $CURLINFO_SLIST + 28 Global Const $CURLINFO_LASTSOCKET = $CURLINFO_LONG + 29 Global Const $CURLINFO_FTP_ENTRY_PATH = $CURLINFO_STRING + 30 Global Const $CURLINFO_REDIRECT_URL = $CURLINFO_STRING + 31 Global Const $CURLINFO_PRIMARY_IP = $CURLINFO_STRING + 32 Global Const $CURLINFO_APPCONNECT_TIME = $CURLINFO_DOUBLE + 33 Global Const $CURLINFO_CERTINFO = $CURLINFO_SLIST + 34 Global Const $CURLINFO_CONDITION_UNMET = $CURLINFO_LONG + 35 Global Const $CURLINFO_RTSP_SESSION_ID = $CURLINFO_STRING + 36 Global Const $CURLINFO_RTSP_CLIENT_CSEQ = $CURLINFO_LONG + 37 Global Const $CURLINFO_RTSP_SERVER_CSEQ = $CURLINFO_LONG + 38 Global Const $CURLINFO_RTSP_CSEQ_RECV = $CURLINFO_LONG + 39 Global Const $CURLINFO_PRIMARY_PORT = $CURLINFO_LONG + 40 Global Const $CURLINFO_LOCAL_IP = $CURLINFO_STRING + 41 Global Const $CURLINFO_LOCAL_PORT = $CURLINFO_LONG + 42 Global Const $CURLINFO_HTTP_CODE = $CURLINFO_RESPONSE_CODE ; The _curl_easy_pause function pauses or unpauses transfers. Select the new state by setting the bitmask, use the convenience defines below. Global Const $CURLPAUSE_RECV = BitShift(1, 0) Global Const $CURLPAUSE_RECV_CONT = 0 Global Const $CURLPAUSE_SEND = BitShift(1, -2) Global Const $CURLPAUSE_SEND_CONT = 0 Global Const $CURLPAUSE_ALL = BitOR($CURLPAUSE_RECV, $CURLPAUSE_SEND) Global Const $CURLPAUSE_CONT = BitOR($CURLPAUSE_RECV_CONT, $CURLPAUSE_SEND_CONT) Global Const $CURL_WRITEFUNC_PAUSE = 0x10000001 Global Const $CURL_READFUNC_ABORT = 0x10000000 Global Const $CURL_READFUNC_PAUSE = 0x10000001 ; $CURLFORM_[what] constants, to be used with _curl_formadd() Global Const $CURLFORM_COPYNAME = 1 Global Const $CURLFORM_PTRNAME = 2 Global Const $CURLFORM_NAMELENGTH = 3 Global Const $CURLFORM_COPYCONTENTS = 4 Global Const $CURLFORM_PTRCONTENTS = 5 Global Const $CURLFORM_CONTENTSLENGTH = 6 Global Const $CURLFORM_FILECONTENT = 7 Global Const $CURLFORM_ARRAY = 8 Global Const $CURLFORM_OBSOLETE = 9 Global Const $CURLFORM_FILE = 10 Global Const $CURLFORM_BUFFER = 11 Global Const $CURLFORM_BUFFERPTR = 12 Global Const $CURLFORM_BUFFERLENGTH = 13 Global Const $CURLFORM_CONTENTTYPE = 14 Global Const $CURLFORM_CONTENTHEADER = 15 Global Const $CURLFORM_FILENAME = 16 Global Const $CURLFORM_END = 17 Global Const $CURLFORM_OBSOLETE2 = 18 Global Const $CURLFORM_STREAM = 19 ; return codes for _curl_formadd() Global Const $CURL_FORMADD_OK = 0 Global Const $CURL_FORMADD_MEMORY = 1 Global Const $CURL_FORMADD_OPTION_TWICE = 2 Global Const $CURL_FORMADD_NULL = 3 Global Const $CURL_FORMADD_UNKNOWN_OPTION = 4 Global Const $CURL_FORMADD_INCOMPLETE = 5 Global Const $CURL_FORMADD_ILLEGAL_ARRAY = 6 Global Const $CURL_FORMADD_DISABLED = 7 ; CURLversion Global Const $CURLVERSION_FIRST = 0 Global Const $CURLVERSION_SECOND = 1 Global Const $CURLVERSION_THIRD = 2 Global Const $CURLVERSION_FOURTH = 3 Global Const $CURLVERSION_NOW = $CURLVERSION_FOURTH Global Const $CURL_VERSION_IPV6 = BitShift(1, 0) Global Const $CURL_VERSION_KERBEROS4 = BitShift(1, -1) Global Const $CURL_VERSION_SSL = BitShift(1, -2) Global Const $CURL_VERSION_LIBZ = BitShift(1, -3) Global Const $CURL_VERSION_NTLM = BitShift(1, -4) Global Const $CURL_VERSION_GSSNEGOTIATE = BitShift(1, -5) Global Const $CURL_VERSION_DEBUG = BitShift(1, -6) Global Const $CURL_VERSION_ASYNCHDNS = BitShift(1, -7) Global Const $CURL_VERSION_SPNEGO = BitShift(1, -8) Global Const $CURL_VERSION_LARGEFILE = BitShift(1, -9) Global Const $CURL_VERSION_IDN = BitShift(1, -10) Global Const $CURL_VERSION_SSPI = BitShift(1, -11) Global Const $CURL_VERSION_CONV = BitShift(1, -12) Global Const $CURL_VERSION_CURLDEBUG = BitShift(1, -13) Global Const $CURL_VERSION_TLSAUTH_SRP = BitShift(1, -14) Global Const $CURL_VERSION_NTLM_WB = BitShift(1, -15) libcURL.au3 #include-once #include <libcURLConstants.au3> ; #INDEX# ======================================================================================================================= ; Title .........: libcURL UDF version 1.0 ; AutoIt Version : 3.3.6.1 + ; Language ......: English ; Description ...: URL transfer functions etc., built on 04/06/2012 05:11:23 GMT, uses libcurl, v7.25.0+, the multiprotocol file transfer library ; Author(s) .....: smartee ; Dll ...........: libcurl.dll ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== Global $g_hDll_libcurl = -1 ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_curl_easy_escape ;_curl_easy_init ;_curl_easy_cleanup ;_curl_easy_duphandle ;_curl_easy_getinfo ;_curl_easy_pause ;_curl_easy_perform ;_curl_easy_recv ;_curl_easy_reset ;_curl_easy_send ;_curl_easy_setopt ;_curl_easy_strerror ;_curl_easy_unescape ;_curl_formadd ;_curl_formfree ;_curl_free ;_curl_getdate ;_curl_global_cleanup ;_curl_global_init ;_curl_global_init_mem ;_curl_slist_append ;_curl_slist_free_all ;_curl_version ;_curl_version_info ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;__cURL_DllOpen ;__cURL_DllClose ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _curl_easy_escape ; Description ...: URL encodes the given string ; Syntax.........: _curl_easy_escape($curl, $url, $length) ; Parameters ....: $curl - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $url - String to be URL encoded. ; $length - Length of the string. If the length argument is set to 0 (zero), _curl_easy_escape() uses strlen() on the input url to find out the size. ; |0 - Calculate length. ; Return values .: Success - The URL encoded string. ; Failure - An empty string, "" ; Author ........: smartee ; Modified.......: ; Remarks .......: ; Related .......: None. ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_escape.html">http://curl.haxx.se/libcurl/c/curl_easy_escape.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_escape($curl, $url, $length) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, "") Local $aRes = DllCall($g_hDll_libcurl, "str:cdecl", "curl_easy_escape", "ptr", $curl, "str", $url, "int", $length) If @error Then Return SetError(2, @extended, "") Return $aRes[0] EndFunc ;==>_curl_easy_escape ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_init ; Description ...: Start a libcurl easy session ; Syntax ........: _curl_easy_init() ; Parameters ....: None. ; Return values .: Success - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_cleanup, _curl_global_init, _curl_easy_reset ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_init.html">http://curl.haxx.se/libcurl/c/curl_easy_init.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_init() If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "ptr:cdecl", "curl_easy_init") If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_init ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_cleanup ; Description ...: End a libcurl easy session ; Syntax ........: _curl_easy_cleanup($handle) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_init ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html">http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_cleanup($handle) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_easy_cleanup", "ptr", $handle) If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_easy_cleanup ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_duphandle ; Description ...: Clone a libcurl session handle ; Syntax ........: _curl_easy_duphandle($handle) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; Return values .: Success - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_init, _curl_easy_cleanup, _curl_global_init ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html">http://curl.haxx.se/libcurl/c/curl_easy_duphandle.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_easy_duphandle($handle) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "ptr:cdecl", "curl_easy_duphandle", "ptr", $handle) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_duphandle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_getinfo ; Description ...: Extract information from a curl handle ; Syntax ........: _curl_easy_getinfo($handle, $option, Byref $parameter) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $option - A $CURLINFO_* value. ; $parameter - A variable to be filled in accordingly that can be relied upon only if the function returns $CURLE_OK. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_setopt ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html">http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_getinfo($handle, $option, ByRef $parameter) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $asTypes[4] = ["ptr", "long", "double", "ptr"] Local $iParamType = Int($option / 0x100000) - 1 Local $tCURLSTRUCT_INFO = DllStructCreate($asTypes[$iParamType]) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_getinfo", "ptr", $handle, "int", $option, "ptr", DllStructGetPtr($tCURLSTRUCT_INFO)) If @error Then Return SetError(2, @extended, -1) Switch $iParamType Case 0 Local $tCURLSTRUCT_INFOBUFFER = DllStructCreate("char[256]", DllStructGetData($tCURLSTRUCT_INFO, 1)) $parameter = DllStructGetData($tCURLSTRUCT_INFOBUFFER, 1) Case Else $parameter = DllStructGetData($tCURLSTRUCT_INFO, 1) EndSwitch Return $aRes[0] EndFunc ;==>_curl_easy_getinfo ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_pause ; Description ...: Pause and unpause a connection ; Syntax ........: _curl_easy_pause($handle, $bitmask) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $bitmask - A $CURLPAUSE_* value that sets the new state of the connection. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_cleanup, _curl_easy_reset ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_pause.html">http://curl.haxx.se/libcurl/c/curl_easy_pause.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_easy_pause($handle, $bitmask) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_pause", "ptr", $handle, "int", $bitmask) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_pause ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_perform ; Description ...: Perform a file transfer ; Syntax ........: _curl_easy_perform($handle) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_init, _curl_easy_setopt ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_perform.html">http://curl.haxx.se/libcurl/c/curl_easy_perform.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_perform($handle) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_perform", "ptr", $handle) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_perform ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_recv ; Description ...: Receives raw data on an "easy" connection ; Syntax ........: _curl_easy_recv($handle, $buffer, $buflen, $n) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $buffer - A pointer to your buffer that will get the received data. ; $buflen - The maximum amount of data you can get in that buffer. ; $n - A pointer to a variable that will receive the number of received bytes. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_setopt, _curl_easy_perform ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_recv.html">http://curl.haxx.se/libcurl/c/curl_easy_recv.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_easy_recv($handle, $buffer, $buflen, $n) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_recv", "ptr", $handle, "ptr", $buffer, "uint", $buflen, "ptr", $n) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_recv ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_reset ; Description ...: Reset all options of a libcurl session handle ; Syntax ........: _curl_easy_reset($handle) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_init, _curl_easy_cleanup, _curl_easy_setopt ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_reset.html">http://curl.haxx.se/libcurl/c/curl_easy_reset.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_easy_reset($handle) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_easy_reset", "ptr", $handle) If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_easy_reset ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_send ; Description ...: Sends raw data over an "easy" connection ; Syntax ........: _curl_easy_send($handle, $buffer, $buflen, $n) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $buffer - A pointer to your buffer with data to be sent. ; $buflen - Length of buffer. ; $n - A pointer to a variable that will receive the number of sent bytes. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_setopt, _curl_easy_perform, _curl_easy_getinfo ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_send.html">http://curl.haxx.se/libcurl/c/curl_easy_send.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_easy_send($handle, $buffer, $buflen, $n) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_send", "ptr", $handle, "ptr", $buffer, "uint", $buflen, "ptr", $n) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_send ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_setopt ; Description ...: Set options for a curl easy handle ; Syntax ........: _curl_easy_setopt($handle, $option, $parameter) ; Parameters ....: $handle - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $option - A $CURLOPT_* value. ; $parameter - A long, a function pointer, an object pointer or a large integer, depending on what the specific option expects. ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_init, _curl_easy_cleanup, _curl_easy_reset ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_setopt.html">http://curl.haxx.se/libcurl/c/curl_easy_setopt.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_setopt($handle, $option, $parameter) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $asTypes[4] = ["long", "ptr", "ptr", "int64"] Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_easy_setopt", "ptr", $handle, "int", $option, $asTypes[Int($option / 10000)], $parameter) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_easy_setopt ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_strerror ; Description ...: Return string describing error code ; Syntax ........: _curl_easy_strerror($errnum) ; Parameters ....: $errnum - A $CURLE_* error code. ; Return values .: Success - A string describing the error code passed in the argument $errornum. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: None. ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_strerror.html">http://curl.haxx.se/libcurl/c/curl_easy_strerror.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_strerror($errnum) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, "") Local $aRes = DllCall($g_hDll_libcurl, "str:cdecl", "curl_easy_strerror", "int", $errnum) If @error Then Return SetError(2, @extended, "") Return $aRes[0] EndFunc ;==>_curl_easy_strerror ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_easy_unescape ; Description ...: URL decodes the given string ; Syntax ........: _curl_easy_unescape($curl, $url, $inlength, $outlength) ; Parameters ....: $curl - A handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use _curl_easy_init() to get the handle. ; $url - String to be decoded. ; $inlength - Length of string, if set to 0 (zero), _curl_easy_unescape() will use strlen() on the input url string to find out the size. ; $outlength - If outlength is non-NULL, the function will write the length of the returned string in the integer it points to. This allows an escaped string containing %00 to still get used properly after unescaping. ; Return values .: Success - A pointer to a zero terminated string or NULL. ; Failure - An empty string, "", Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_escape, _curl_free ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_easy_unescape.html">http://curl.haxx.se/libcurl/c/curl_easy_unescape.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_easy_unescape($curl, $url, $inlength, $outlength) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, "") Local $aRes = DllCall($g_hDll_libcurl, "str:cdecl", "curl_easy_unescape", "ptr", $curl, "str", $url, "int", $inlength, "ptr", $outlength) If @error Then Return SetError(2, @extended, "") Return $aRes[0] EndFunc ;==>_curl_easy_unescape ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_formadd ; Description ...: Add a section to a multipart/formdata HTTP POST ; Syntax ........: _curl_formadd($firstitem, $lastitem, $option, $parameter, $option2, $parameter2[, $option3 = $CURLFORM_END]) ; Parameters ....: $firstitem - A pointer to the firstitem. ; $lastitem - A pointer to the lastitem. ; $option - A $CURLFORM_* value. ; $parameter - A string value depending on $option. ; $option2 - A $CURLFORM_* value. ; $parameter2 - A string value depending on $option. ; $option3 - [optional] A $CURLFORM_* value. Default is $CURLFORM_END. ; Return values .: Success - $CURL_FORMADD_OK or a $CURL_FORMADD_* code. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_easy_setopt, _curl_formfree ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_formadd.html">http://curl.haxx.se/libcurl/c/curl_formadd.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_formadd($firstitem, $lastitem, $option, $parameter, $option2, $parameter2, $option3 = $CURLFORM_END) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_formadd", "ptr", $firstitem, "ptr", $lastitem, "int", $option, "str", $parameter, "int", $option2, "str", $parameter2, "int", $option3) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_formadd ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_formfree ; Description ...: Free a previously build multipart/formdata HTTP POST chain ; Syntax ........: _curl_formfree($form) ; Parameters ....: $form - A pointer as returned from a previous call to _curl_formadd() and may be NULL. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_formadd ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_formfree.html">http://curl.haxx.se/libcurl/c/curl_formfree.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_formfree($form) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_formfree", "ptr", $form) If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_formfree ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_free ; Description ...: Reclaim memory that has been obtained through a libcurl call ; Syntax ........: _curl_free($ptr) ; Parameters ....: $ptr - A pointer value. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: None. ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_free.html">http://curl.haxx.se/libcurl/c/curl_free.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_free($ptr) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_free", "str", $ptr) If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_free ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_getdate ; Description ...: Convert a date string to number of seconds since January 1, 1970 ; Syntax ........: _curl_getdate($datestring, $now) ; Parameters ....: $datestring - A string containing several items separated by whitespace. The order of the items is immaterial. ; $now - Not used, pass a NULL there. ; Return values .: Success - The number of seconds as described. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; |3 - Failed to parse the date string. ; Author ........: smartee ; Modified ......: ; Remarks .......: This parser was written to handle date formats specified in RFC 822 (including the update in RFC 1123) using time zone name or time zone delta and RFC 850 (obsoleted by RFC 1036) and ANSI C's asctime() format. ; These formats are the only ones RFC 2616 says HTTP applications may use. ; Related .......: None. ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_getdate.html">http://curl.haxx.se/libcurl/c/curl_getdate.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_getdate($datestring, $now) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "uint:cdecl", "curl_getdate", "str", $datestring, "ptr", $now) If @error Then Return SetError(2, @extended, -1) If $aRes[0] = -1 Then Return SetError(3, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_getdate ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_global_cleanup ; Description ...: Global libcurl cleanup ; Syntax ........: _curl_global_cleanup() ; Parameters ....: None. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: This function releases resources acquired by _curl_global_init(). ; Related .......: _curl_global_init ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_global_cleanup.html">http://curl.haxx.se/libcurl/c/curl_global_cleanup.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_global_cleanup() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_global_cleanup") If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_global_cleanup ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_global_init ; Description ...: Global libcurl initialisation ; Syntax ........: _curl_global_init($flags) ; Parameters ....: $flags - A bit pattern that tells libcurl exactly what features to init. (A $CURL_GLOBAL_* value.) ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_global_init_mem ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_global_init.html">http://curl.haxx.se/libcurl/c/curl_global_init.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_global_init($flags) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_global_init", "long", $flags) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_global_init ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_global_init_mem ; Description ...: Global libcurl initialisation with memory callbacks ; Syntax ........: _curl_global_init_mem($flags, $m, $f, $r, $s, $c) ; Parameters ....: $flags - A bit pattern that tells libcurl exactly what features to init. (A $CURL_GLOBAL_* value.) ; $m - Callback for malloc, prototype: void *malloc_callback(size_t size); ; $f - Callback for free, prototype: void free_callback(void *ptr); ; $r - Callback for realloc, prototype: void *realloc_callback(void *ptr, size_t size); ; $s - Callback for strdup, prototype: char *strdup_callback(const char *str); ; $c - Callback for malloc, prototype: void *calloc_callback(size_t nmemb, size_t size); ; Return values .: Success - $CURLE_OK or an appropriate $CURLE_* error code will be returned. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: Manipulating these gives considerable powers to the application to severely screw things up for libcurl. Take care! ; Related .......: _curl_global_init, _curl_global_cleanup ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_global_init_mem.html">http://curl.haxx.se/libcurl/c/curl_global_init_mem.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_global_init_mem($flags, $m, $f, $r, $s, $c) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "int:cdecl", "curl_global_init_mem", "long", $flags, "ptr", $m, "ptr", $f, "ptr", $r, "ptr", $s, "ptr", $c) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_global_init_mem ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_slist_append ; Description ...: Add a string to an slist ; Syntax ........: _curl_slist_append($list, $string) ; Parameters ....: $list - A list pointer. ; $string - A string value. ; Return values .: Success - A new list pointer. ; Failure - A null pointer or -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_slist_free_all ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_slist_append.html">http://curl.haxx.se/libcurl/c/curl_slist_append.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_slist_append($list, $string) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "ptr:cdecl", "curl_slist_append", "ptr", $list, "str", $string) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_slist_append ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_slist_free_all ; Description ...: Free an entire curl_slist list ; Syntax ........: _curl_slist_free_all($list) ; Parameters ....: $list - A list pointer. ; Return values .: Success - 1 ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_slist_append ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_slist_free_all.html">http://curl.haxx.se/libcurl/c/curl_slist_free_all.html</a> ; Example .......: Yes ; =============================================================================================================================== Func _curl_slist_free_all($list) If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) DllCall($g_hDll_libcurl, "none:cdecl", "curl_slist_free_all", "ptr", $list) If @error Then Return SetError(2, @extended, 0) Return 1 EndFunc ;==>_curl_slist_free_all ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_version ; Description ...: Returns the libcurl version string ; Syntax ........: _curl_version() ; Parameters ....: None. ; Return values .: Success - A pointer to a zero terminated string. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_version_info ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_version.html">http://curl.haxx.se/libcurl/c/curl_version.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_version() If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, "") Local $aRes = DllCall($g_hDll_libcurl, "str:cdecl", "curl_version") If @error Then Return SetError(2, @extended, "") Return $aRes[0] EndFunc ;==>_curl_version ; #FUNCTION# ==================================================================================================================== ; Name ..........: _curl_version_info ; Description ...: Returns run-time libcurl version info ; Syntax ........: _curl_version_info($type) ; Parameters ....: $type - The version of this functionality by the time you write your program. ; Return values .: Success - A pointer to a curl_version_info_data struct. ; Failure - -1, Sets @Error: ; |1 - DLL could not be opened. ; |2 - DllCall failed. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: _curl_version ; Link ..........: <a target="_blank" href="http://curl.haxx.se/libcurl/c/curl_version_info.html">http://curl.haxx.se/libcurl/c/curl_version_info.html</a> ; Example .......: No ; =============================================================================================================================== Func _curl_version_info($type) If $g_hDll_libcurl == -1 Then __cURL_DllOpen() If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, -1) Local $aRes = DllCall($g_hDll_libcurl, "ptr:cdecl", "curl_version_info", "int", $type) If @error Then Return SetError(2, @extended, -1) Return $aRes[0] EndFunc ;==>_curl_version_info ; #INTERNAL_USE_ONLY# =========================================================================================================== ;__cURL_DllOpen ;__cURL_DllClose ; Name ..........: __cURL_DllOpen ; Description ...: Opens the libcurl DLL for use with this UDF library. ; Syntax ........: __cURL_DllOpen() ; Parameters ....: None. ; Return values .: Success - 1, Sets $g_hDll_libcurl to the DLL's handle. ; Failure - 0, Sets @Error: ; |1 - DLL could not be opened. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: __cURL_DllClose ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __cURL_DllOpen() $g_hDll_libcurl = DllOpen("libcurl.dll") If $g_hDll_libcurl == -1 Then Return SetError(1, @extended, 0) OnAutoItExitRegister("__cURL_DllClose") Return 1 EndFunc ;==>__cURL_DllOpen ; #INTERNAL_USE_ONLY# =========================================================================================================== ;__cURL_DllOpen ;__cURL_DllClose ; Name ..........: __cURL_DllClose ; Description ...: Closes a open handle to the libcurl DLL. ; Syntax ........: __cURL_DllClose() ; Parameters ....: None. ; Return values .: None. ; Author ........: smartee ; Modified ......: ; Remarks .......: ; Related .......: __cURL_DllOpen ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __cURL_DllClose() If $g_hDll_libcurl <> -1 Then DllClose($g_hDll_libcurl) $g_hDll_libcurl = -1 EndFunc ;==>__cURL_DllClose Example 1: _curl_slist_append.au3 #include <libcURL.au3> _Demo1() Func _Demo1() Local $sURL = "http://www.google.com/search?q=http+headers" Local $hcurl = _curl_easy_init() If ($hcurl) Then ; set referer Local $ptNewList = _curl_slist_append(0, "Referer: http://www.google.com") ; add a custom accept $ptNewList = _curl_slist_append($ptNewList, "Accept: foo") Local $tCURLSTRUCT_URL = DllStructCreate("char[" & StringLen($sURL) + 1 & "]") DllStructSetData($tCURLSTRUCT_URL, 1, $sURL) _curl_easy_setopt($hcurl, $CURLOPT_URL, DllStructGetPtr($tCURLSTRUCT_URL)) _curl_easy_setopt($hcurl, $CURLOPT_VERBOSE, 1) _curl_easy_perform($hcurl) ; redo request with our custom headers: _curl_easy_setopt($hcurl, $CURLOPT_HTTPHEADER, $ptNewList) _curl_easy_perform($hcurl) _curl_slist_free_all($ptNewList) _curl_easy_cleanup($hcurl) EndIf EndFunc ;==>_Demo1 TODO: "multi" interface"share" interfaceDownload: LAST UPDATED: 06-APR-2012 Here's a zipped file with everything you need to get started, (Help-file with examples, calltips.api, userudfs.properties, current libcurl.dll (v7.25.0 & deps) etc.) libcURLUDFv1.0.zip 1.09 MB All feedback is welcome -smartee
-
Hi all, My programming knowledge is very basic. I have an old script that creates shares and assign permissions. It normally registers SetAcl.ocx if necessary and creates an object to assign permissions. The command that registers SetAcl was apparently working fine under Windows 7 but is not working under Windows 10. RunWait("regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE) As I'm logged in as admin, I changed this command to : RunAsWait(@UserName, "", "", 0, "regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE) It seems to terminate correctly but the script still doesn't work as expected. To check that, I've created that small script : Local $objSetAcl = ObjCreate("SETACL.SetACLCtrl.1") If IsObj($objSetAcl) Then ConsoleWrite("Object successfully created." & @CRLF) Else ConsoleWrite("Object not created. Registering SetAcl.ocx" & @CRLF) Local $result = RunAsWait(@UserName, "", "", 0, "regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE); Use of my admin username to elevate CMD ConsoleWrite("Return code : " & $result & @CRLF) ConsoleWrite("Creating object" & @CRLF) $objSetAcl = ObjCreate("SETACL.SetACLCtrl.1") If IsObj($objSetAcl) Then ConsoleWrite("Object successfully created." & @CRLF) Else ConsoleWrite("Object creation failed." & @CRLF) EndIf EndIf It tries to register SetAcl.ocx, return code 0 seems to be fine but still can't use SetAcl. But if I go to CMD as admin, run the regsvr32 command and restart my script, it can create the object without issue. I know my poor knowledge makes me miss something. Anyone can help me figure this out ?
-
Hi! Is there any way to use .NET DLL libraries with AutoIt? I happen to have one that'd have made my life easier, but DLLCall() returns an error: no functions with such name found. Searching and reading forums made me think that's not a fault of a library. I've used yashied's DLL Helper, but it didn't return any function names as well. Thanks!
-
Dear members of the forum, I'm working on a project in which I have to use Image recognition technique. Due to client restrictions, I couldn't use AutoIt for this project. Is there a way to use this DLL "ImageSearchDLL.dll" (which is used to do image recognition steps in AutoIt) in VB.Net to achieve the same result? I have used this DLL few years before and got good results. If there is a latest version of this DLL and if you can share it, that will be helpful too. Any guidance is deeply appreciated.
- 2 replies
-
- image
- recognition
-
(and 3 more)
Tagged with:
-
Hi AutoIt Scripters/Programmers. I have a question about MIME Tools for Notepad++: I've recently found a UDF about Base64 in forum, but they can't decode\encode correctly some emojis , other UTFs and etc. so i decided to use mimeTools.dll of Notepad++ or main site My problem is how to use this dll in AutoIt Language? I will be happy with your comments and answers❤ Thanks.
-
Good morning Forums In these days, I am working on a project that involved me to use some Windows APIs to obtain some information about Terminal Servers. I'm doing this using wtsapi32.dll in a VBA Project, but, the lack of knowledge about few things threated in the articles make this quite difficult to implement and understand at the same time. The most difficult thing I'm facing is "translating" C/C++ functions or struct in VBA when pointers are used, or pointers of pointers, and so on. Since VBA seems to not have a pointer type, to make those functions work I need to implement other functions taken from other DLLs, and this confuses me a lot. For example, starting from this code, I splitted all the functions and all the definitions to understand why they are there, and why I need to use them. At the end, I've found out that the code I was going to implement starting from the functions provided in the Microsoft Docs won't be ever be able to work without some supplementary functions which are not mentioned anywhere. So, I was wondering if someone would please point me out to a good and practical exaplanation about pointers (in general) or specifically for VBA, because I need to use them quite often in these days, and I'd like to understand what I am doing. Thanks in advance. Best Regards and Stay at home 🏡
-
All my scripts were working fine and now I am getting this error. How do I resolve it? Which folder(s) do the DLLs need to be in? ! Dll not found or Call Dll error !
- 2 replies
-
- dll not found
- dll
-
(and 2 more)
Tagged with:
-
Hi guys! A pretty simple UDF to convert HTML to PDF using wkHTMLtoPDF. It uses the C API of the tool (DLL), so no external process, no ActiveX or COM sh*t. See the example, and the documentation of wkHTMLtoPDF. Cheers https://github.com/matwachich/wkhtmltopdf-au3
-
Hello all! I got the Acroname Programmable USB Hub based on BrainStem platform. I will use it to manage ports and read current. They have development kit (BRAINSTEM DEVELOPMENT KIT) with examples for any languages like C#, C++, LabVIEW and python but no AutoIt. The kit include BrainStem2.dll (x32 and x64), BrainStem2_LabVIEW.dll, BrainStem2CLI.dll and many examples. Anyone used this dll and implemented it in AutoIt? Please share some example for Device Discovering, User LED Flashing or power enable/disable on port to start play with this HUB BrainStem Reference BrainStem2 lib+example.7z USB HUB User Manual s79-usbhub-3p_v1.10_0.pdf
-
This is relevant From here https://stackoverflow.com/questions/3454315/is-it-possible-to-pin-a-dll-in-memory-to-prevent-unloading I use several UDFs on the Forum to do various things. Those UDFs work very well. Effectively the UDFs are DLL wrappers, that make it possible to access DLL functions easily without the long hard slog of DLLCall() every time. However, I have now run into the issue that multiple UDF DLLCalls are slow. Not mind numbingly slow, but slow enough to become noticeable with a large of repeated function calls. So I was wondering, is it possible to "load a DLL into memory" and leave it there for the duration of my script's lifetime, avoid repeated DLL on-disk reads with a persistent in memory DLL? From Microsoft https://docs.microsoft.com/en-us/windows/desktop/dlls/about-dynamic-link-libraries Looks like what I want to do is: load-time dynamic linking, So next question, (a) how do I do this with AutoIt (b) How would this impact on standard AutoIt type DLL calls? The point is speed. Is there a different approach? Or am I barking up the wrong tree? Skysnake
-
Hello, i need help to translate the c code to autoit . I don't understand the callback function. #include <windows.h> #include <stdio.h> // native IR Data by PAnsiChar typedef void CALLBACK CallBackPAnsiChar(char*, char*, char*, char*); typedef int (__stdcall *impInitPAnsiChar)(CallBackPAnsiChar); CALLBACK MyCallBackPAnsiChar(char* Protocol, char* Address, char* Command, char* Flags) { printf("\nIR Data received: Protocol: %s, Address: 0x%s, Command: 0x%s, Flags: 0x%s", Protocol, Address, Command, Flags); fflush(stdout); } int main(int argc, char **argv) { impInitPAnsiChar InitPAnsiChar = NULL; // Load DLL file HINSTANCE hinstLib = LoadLibrary(TEXT("USB_IR_Remote_Receiver.dll")); if (hinstLib == NULL) { printf("\nERROR: unable to load DLL\n"); return 1; } // Get function pointer InitPAnsiChar InitPAnsiChar = (impInitPAnsiChar)GetProcAddress(hinstLib, "InitPAnsiChar"); if (InitPAnsiChar == NULL) { printf("\nERROR: unable to find DLL function\n"); FreeLibrary(hinstLib); return 1; } if (InitPAnsiChar(*MyCallBackPAnsiChar)) { printf("\nInit DLL with InitPAnsiChar successfull"); } else { // Unload DLL file FreeLibrary(hinstLib); return 0; } while(1) { } //return 0; }
-
Hi all, i want to start a new application that capture a screen or image from webcam an read all barcode inside the picture. I have test this code https://www.autoitscript.com/forum/topic/27925-webcam-example/ Works fine for my webcam. Now i need to read all barcodes (code 128 code39, no 2d) inside the picture. I have found this https://www.codeproject.com/Articles/42852/Reading-Barcodes-from-an-Image-III It's possible to make a dll from VB source i linked with this parameters : filename, Array of barcode founded, error code and launch from Autoit with function ? Anyone can help me to make dll and autoit function, i don't know VB. Thanks
-
Hello, Someone is so kind to compile for me this DLL? https://github.com/stephane/libmodbus/tree/master/src/win32 Many thanks!
-
I'm trying to verify which is the default scanner and if it is different from what I need to propose a choice among those available. All this is possible with eztw32.dll however I can not make certain functions work Are these: int TWAIN_GetDefaultSourceName(LPSTR pzName) string TWAIN_DefaultSourceName() int TWAIN_GetSourceList(void) source: http://www.eztwain.com/pub/eztp/EZTwain_User_Guide.pdf I tried this way but they do not work: Local $pzName $pzName = DllCall($pathDLL,"int","TWAIN_DefaultSourceName") ; $rc = DllCall($pathDLL,"int","TWAIN_GetDefaultSourceName", "str*", $pzName) ; $rc = DllCall($pathDLL,"int","TWAIN_GetDefaultSourceName","str", $pzName) ; $rc = DllCall($pathDLL,"int","TWAIN_GetSourceList") $rc = DllCall($pathDLL,"int","TWAIN_GetSourceList", "NONE", "") ; Can anyone help me? Everything else works, here is the code: Local $pathDLL = @ScriptDir&"\_res\eztw32.dll" Local $rc = DllCall($pathDLL,'int','TWAIN_EasyVersion') if @error <> 0 then MsgBox(16+262144, "DllCall Error", "Error load eztw32.dll") else ConsoleWrite('--> eztw32.dll version: ' & $rc[0]/100 & @CRLF) $rc = DllCall($pathDLL,"int","TWAIN_IsAvailable") If @error > 0 Then MsgBox(16+262144, "DllCall Error", "Error call DLL - TWAIN_IsAvailable") if $rc[0] <> 0 then ConsoleWrite('--> TWAIN available: RC = ' & $rc[0]&@CRLF) ;;;;;;;;;;;;;;;;;;;;;; I NEED HERE ;manual select scanner Local $hwnd $rc = DllCall($pathDLL,"long","TWAIN_SelectImageSource",'hwnd',$hwnd) ConsoleWrite('--> TWAIN_SelectImageSource = ' & $rc[0]&@CRLF) if $rc[0] <> 0 then ConsoleWrite("--> TWAIN device selected"&@CRLF) else ConsoleWrite("--> no TWAIN device selected"&@CRLF) endif Else ConsoleWrite('--> TWAIN NOT available: RC = ' & $rc[0]&@CRLF) ; es: 0 endif endif thank you
-
Hi Everybody I want know if there is someone kind enough to help me translate this code in to Autoit please don't blame me cause I'm a newbe here is the code I need to translate also I want know if it's possible to look through a DLL functions Declaration in Visual Basic 6: Simply add the DLL import unit 'cashdll.bas' to your project, or add following line to the declarations part: Declare Function CASH_OPENCOM Lib "CASH.DLL" (ByVal CASH_COMPORT As Long) As Long Declaration in Visual Basic 6: Simply add the DLL import unit 'cashdll.bas' to your project, or add following line to the declarations part: Declare Sub CASH_CLOSECOM Lib "CASH.DLL" () and here is the code I have written so far down below is the DLL attached also a screen shot of the exit code of SciTE #include<Array.au3> $CashDLL = DllOpen("C:\Users\manue\Downloads\Casll DLL\cash.dll") if $CashDLL Then MsgBox (0,"","CashDLL Open",0) $HOPPER_OPENCOM = DllCall($CashDLL,"LONG","HOPPER_OPENCOM") if isarray ($HOPPER_OPENCOM) Then _Arraydisplay ($HOPPER_OPENCOM) Else MsgBox (0,"",@error,0) EndIf $HOPPER_CLOSECOM = DllCall($CashDLL,"NONE","HOPPER_CLOSECOM") if isarray ($HOPPER_CLOSECOM) Then _Arraydisplay ($HOPPER_CLOSECOM) Else MsgBox (0,"",@error,0) EndIf DllClose ($CashDLL) cash.dll
-
Ciao I would like to control an ATEM Video Mixer from autoit. I downloaded his SDK which is written in c ++ and I found the sequences to interface, but I was not able to convert the script to self. The instructions say to follow this sequence: and to connectTo with C++ is: string address = "192.168.1.240"; _BMDSwitcherConnectToFailure failureReason = 0; IBMDSwitcher switcher = null; var discovery = new CBMDSwitcherDiscovery(); discovery.ConnectTo(address, out switcher, out failureReason); From Blackmagic SDK: IBMDSwitcherDiscovery::ConnectTo method The ConnectTo method connects to the specified switcher and returns an IBMDSwitcher object interface for the switcher. Syntax HRESULT ConnectTo (string deviceAddress, IBMDSwitcher** switcherDevice, BMDSwitcherConnectToFailure* failReason); Parameters: deviceAddress in Network hostname or IP address of switcher to connect to. switcherDevice out IBMDSwitcher object interface for the connected switcher. failReason out Reason for connection failure as a BMDSwitcherConnectToFailure value. So, I have I tried these solutions but with non success: $DllName =@ScriptDir&"\BMDSwitcherAPI.dll" $result = DllCall($DllName, "none", "IBMDSwitcherDiscovery::ConnectTo" & @CRLF) ConsoleWrite("DLLCall Result: " & $result & @CRLF) and I have tried also create an Object (That I think is the best way solution): #include <MsgBoxConstants.au3> $oSwitcher=ObjCreate("IBMDSwitcher") If IsObj($oSwitcher) Then MsgBox(64, "", "Object $oSwitcher created successfully") EndIf $oAtem=ObjCreate("IBMDSwitcherDiscovery") If IsObj($oAtem) Then MsgBox(64, "", "Object $oAtem created successfully") EndIf $failureReason =ObjCreate("_BMDSwitcherConnectToFailure") If IsObj($failureReason) Then MsgBox(64, "", "Object $failureReason created successfully") EndIf $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler Global $errore,$oSwitcher1 $oAtem.ConnectTo("192.168.1.36",$oSwitcher,$failureReason); ; This is the custom error handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Helpfile is: " & $oMyError.helpfile & @CRLF & _ "Helpcontext is: " & $oMyError.helpcontext & @CRLF & _ "Lastdllerror is: " & $oMyError.lastdllerror & @CRLF & _ "Scriptline is: " & $oMyError.scriptline) EndFunc ;==>MyErrFunc But the result is: We intercepted a COM Error ! Number is: 000000A9 Windescription is: Variable must be of type 'Object'. Source is: Description is: Helpfile is: Helpcontext is: Lastdllerror is: 0 Scriptline is: 17 The BMDSwitcherAPI.dll is registered in system. Can someone help me? Grazie Marco
-
This baby can do almost any language! I found Gleany on this site and set it up on a fresh win10 install. all i would need to do to make it build an exe of the search files app we discovered is the .NET Target Framework download to build 100 % but the exe works and generates! You also need to add the path the the version of csc.exe that you want to run. MSBuild is part of .NET and can read your .csproj file. YOU can develop .NET OR C/C++ on this baby! Super lightweight (fit for crappy laptops), and you can use any dev compilers you wish, Ming, MS, etc, whatever. To use the build, you need to open the csproj file, else, to check your syntax it can compile individual files as well. The warning are because I do not have the .NET 4.6 Targeting Pack installed... LOL, and I could get rid of the Core warning, yes, I did not want to build a .NET Core.dll I wanted a live x64 exe! Told you MSBUILD could handle .CSPROJ, .VBPROJ, and all others Microsoft. Don't let Visual Code or Visual Studio slow you down, although, this works with Visual Code as well but there is only debugging in CORE.DLL projects ListFiles Example.zip