Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/09/2015 in all areas

  1. UEZ

    Glowing Inputbox

    Here my version (proof of concept): ;idea taken from http://codepen.io/jackrugile/full/ABeIi #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <EditConstants.au3> #include <StaticConstants.au3> _GDIPlus_Startup() Global $__hGUI_, $__iInput_, $__hGUI_Glow, $__bPlayAnim = False Global Const $fDeg = 180 / ACos(-1), $fRad = ACos(-1) / 180 ModernSearchGUI(800, 300) _GDIPlus_Shutdown() Func ModernSearchGUI($iW = @DesktopWidth, $iH = @DesktopHeight) Local Const $iBgColor = 0x151515 $iW = $iW < (346 + 2 * 220 + 3) ? (346 + 2 * 220 + 3) : $iW $iH = $iH < 2 * 84 ? 2 * 84 : $iH $__hGUI_ = GUICreate("", $iW, $iH, ($iW <> @DesktopWidth) ? (@DesktopWidth - $iW) / 2 : 0, ($iH <> @DesktopHeight) ? (@DesktopHeight - $iH) / 2 : 0, BitOR($WS_TABSTOP, $WS_POPUP), $WS_EX_TOPMOST) GUISetBkColor($iBgColor) Local Const $iW_Frame = 346, $iH_Frame = 84 Local Const $iPosX = Int(($iW - $iW_Frame) / 2), $iPosY = Int($iH / 4) Local Const $iPicFrame = GUICtrlCreatePic("", $iPosX, $iPosY, $iW_Frame, $iH_Frame) GUICtrlSetState(-1, $GUI_DISABLE) Local Const $iStripLeft = GUICtrlCreatePic("", $iPosX - 220, $iPosY + $iH_Frame / 2, 220, 2) Local Const $iStripRight = GUICtrlCreatePic("", $iPosX + $iW_Frame, $iPosY + $iH_Frame / 2, 220, 2) Local $hBmp = _GDIPlus_BitmapCreateFromScan0(220, 2), $hHBmp Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp) #Region l/r strips Local Const $hBrushL1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF0A0A0A, 1) Local Const $hBrushR1 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF0A0A0A, 0xFF151515, 1) Local Const $hBrushL2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF151515, 0xFF2F2F2F, 1) Local Const $hBrushR2 = _GDIPlus_LineBrushCreate(0, 0, 220, 1, 0xFF2F2F2F, 0xFF151515, 1) _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, 220, 1, $hBrushL1) _GDIPlus_GraphicsFillRect($hCtxt, 0, 1, 220, 1, $hBrushL2) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iStripLeft, 0x0172, $IMAGE_BITMAP, $hHBmp)) _WinAPI_DeleteObject($hHBmp) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_ImageRotateFlip($hBmp, 4) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iStripRight, 0x0172, $IMAGE_BITMAP, $hHBmp)) _WinAPI_DeleteObject($hHBmp) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_BrushDispose($hBrushL1) _GDIPlus_BrushDispose($hBrushL2) _GDIPlus_BrushDispose($hBrushR1) _GDIPlus_BrushDispose($hBrushR2) #EndRegion #Region Frame $hBmp = _GDIPlus_BitmapCreateFromScan0($iW_Frame, $iH_Frame) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999)) _GDIPlus_GraphicsClear($hCtxt, 0xFF000000 + $iBgColor) Local $hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1) _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg) Local $hPath = _GDIPlus_PathCreate() Local Const $hPen = _GDIPlus_PenCreate(0xFF000000) Local $aPoints[9][2] = [[8]], $iCorner = 3 ;outer border $aPoints[1][0] = $iCorner $aPoints[1][1] = 0 $aPoints[2][0] = $iW_Frame - $iCorner $aPoints[2][1] = 0 $aPoints[3][0] = $iW_Frame - 1 $aPoints[3][1] = $iCorner $aPoints[4][0] = $iW_Frame - 1 $aPoints[4][1] = $iH_Frame - $iCorner $aPoints[5][0] = $iW_Frame - $iCorner - 1 $aPoints[5][1] = $iH_Frame - 1 $aPoints[6][0] = $iCorner $aPoints[6][1] = $iH_Frame - 1 $aPoints[7][0] = 0 $aPoints[7][1] = $iH_Frame - $iCorner $aPoints[8][0] = 0 $aPoints[8][1] = $iCorner _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) ;inner border _GDIPlus_PathReset($hPath) _GDIPlus_PenSetColor($hPen, 0xFF272727) $aPoints[1][0] = $iCorner $aPoints[1][1] = 1 $aPoints[2][0] = $iW_Frame - $iCorner $aPoints[2][1] = 1 $aPoints[3][0] = $iW_Frame - 2 $aPoints[3][1] = $iCorner $aPoints[4][0] = $iW_Frame - 2 $aPoints[4][1] = $iH_Frame - $iCorner $aPoints[5][0] = $iW_Frame - $iCorner - 2 $aPoints[5][1] = $iH_Frame - 2 $aPoints[6][0] = $iCorner $aPoints[6][1] = $iH_Frame - 2 $aPoints[7][0] = 1 $aPoints[7][1] = $iH_Frame - $iCorner $aPoints[8][0] = 1 $aPoints[8][1] = $iCorner _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iPicFrame, 0x0172, $IMAGE_BITMAP, $hHBmp)) _WinAPI_DeleteObject($hHBmp) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_BrushDispose($hBrushBg) #EndRegion #Region input box Local Const $iPicBg = GUICtrlCreatePic("", $iPosX + ($iW_Frame - 304) / 2 - 8, $iPosY + 12, 320, 60) GUICtrlSetState(-1, $GUI_DISABLE) Local $hPicBg = GUICtrlGetHandle($iPicBg) _GDIPlus_PathReset($hPath) _GDIPlus_PenSetColor($hPen, 0xFF000000) _GDIPlus_PenSetWidth($hPen, 2) $aPoints[0][0] = 4 $aPoints[1][0] = 310 $aPoints[1][1] = 48 $aPoints[2][0] = 308 $aPoints[2][1] = 50 $aPoints[3][0] = 11 $aPoints[3][1] = 50 $aPoints[4][0] = 8 $aPoints[4][1] = 48 $hBmp = _GDIPlus_BitmapCreateFromScan0(320, 60) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 + (@OSBuild > 5999)) _GDIPlus_PathAddCurve2($hPath, $aPoints, 0.025) _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) ;draw shadow _GDIPlus_PathReset($hPath) _GDIPlus_PenSetColor($hPen, 0xFF686868) _GDIPlus_PenSetWidth($hPen, 1) $aPoints[0][0] = 8 $aPoints[1][0] = 11 $aPoints[1][1] = 8 $aPoints[2][0] = 308 $aPoints[2][1] = 8 $aPoints[3][0] = 311 $aPoints[3][1] = 11 $aPoints[4][0] = 311 $aPoints[4][1] = 45 $aPoints[5][0] = 308 $aPoints[5][1] = 48 $aPoints[6][0] = 11 $aPoints[6][1] = 48 $aPoints[7][0] = 8 $aPoints[7][1] = 45 $aPoints[8][0] = 8 $aPoints[8][1] = 11 _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 0.025) ;draw round rectangle _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B) _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush) _GDIPlus_GraphicsDrawLine($hCtxt, 230, 8, 230, 48, $hPen) _GDIPlus_PenSetColor($hPen, 0xFF000000) _GDIPlus_GraphicsDrawLine($hCtxt, 231, 8, 231, 48, $hPen) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iPicBg, 0x0172, $IMAGE_BITMAP, $hHBmp)) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _WinAPI_DeleteObject($hHBmp) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBmp) $__iInput_ = GUICtrlCreateInput("What are you looking for?", 12 + $iPosX + ($iW_Frame - 304) / 2, $iPosY + ($iH_Frame - 18) / 2, 195, 18, $ES_AUTOHSCROLL, 0) GUICtrlSetFont(-1, 10, 400, 0, "Arial", 5) GUICtrlSetColor(-1, 0x888888) GUICtrlSetBkColor(-1, 0x2B2B2B) Local Const $iBtn = GUICtrlCreateLabel("Search", $iPosX + 245, $iPosY + 21, 78, 39, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_TABSTOP)) GUICtrlSetFont(-1, 11, 400, 0, "Arial", 5) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetBkColor(-1, 0x2B2B2B) ControlFocus($__hGUI_ , "", $iBtn) $__hGUI_Glow = GUICreate("", $iW_Frame, $iH_Frame, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TRANSPARENT, $WS_EX_LAYERED), $__hGUI_) GUISetBkColor(0x00011, $__hGUI_Glow) Local Const $iPic_Glow = GUICtrlCreatePic("", 14, 15, 236, 57) GUICtrlSetState(-1, $GUI_DISABLE) $hBmp = _GDIPlus_BitmapCreateFromScan0(239, 57) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 4 + (@OSBuild > 5999)) _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, $iW_Frame, $iH_Frame) _GDIPlus_RegionCombineRect($hRegion, 18, 20, 195, 18, 3) _GDIPlus_GraphicsSetClipRegion($hCtxt, $hRegion) $hBrushBg = _GDIPlus_LineBrushCreate($iW_Frame / 2, 0, $iW_Frame / 2, $iH_Frame, 0xFF1F1F1F, 0xFF101010, 1) _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iW_Frame, $iH_Frame, $hBrushBg) $hBrush = _GDIPlus_BrushCreateSolid(0xFF2B2B2B) _GDIPlus_GraphicsFillRect($hCtxt, 10, 13, 220, 36, $hBrush) _GDIPlus_GlowCreate($hCtxt, 10, 8, 10, 49, 8) _GDIPlus_GlowCreate($hCtxt, 233, 8, 233, 49, 8) _GDIPlus_GlowCreate($hCtxt, 8, 8, 236, 8) _GDIPlus_GlowCreate($hCtxt, 8, 49, 236, 49) $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Glow, 0x0172, $IMAGE_BITMAP, $hHBmp)) _GDIPlus_BrushDispose($hBrushBg) _GDIPlus_BrushDispose($hBrush) _GDIPlus_RegionDispose($hRegion) _WinAPI_DeleteObject($hHBmp) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBmp) #EndRegion GUISetState(@SW_SHOW, $__hGUI_) GUISetState(@SW_SHOW, $__hGUI_Glow) _WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, 0x00) GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') AdlibRegister("PlayGlowAnim", 30) Local $iMpos, $iBState = 0 Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE AdlibUnRegister("PlayGlowAnim") GUIDelete() Return 1 Case $iBtn MsgBox(0, "Test", GUICtrlRead($__iInput_), 0, $__hGUI_ ) EndSwitch $iMpos = GUIGetCursorInfo($__hGUI_ )[4] Switch $iMpos Case $iBtn If Not $iBState Then GUICtrlSetColor($iBtn, 0x55FF55) GUICtrlSetBkColor($iBtn, 0x383838) $iBState = 1 EndIf Case Else If $iBState Then $iBState = 0 GUICtrlSetColor($iBtn, 0xF0F0F0) GUICtrlSetBkColor($iBtn, 0x2B2B2B) EndIf EndSwitch Until False EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $__hGUI_ Switch BitAND($wParam, 0xFFFF) Case $__iInput_ Switch BitShift($wParam, 16) Case $EN_KILLFOCUS $__bPlayAnim = False WinSetTrans($__hGUI_Glow, "", 0) If GUICtrlRead($__iInput_) = "" Then Return GUICtrlSetData($__iInput_, "What are you looking for?") * 0 Case $EN_SETFOCUS $__bPlayAnim = True If GUICtrlRead($__iInput_) = "What are you looking for?" Then GUICtrlSetData($__iInput_, "") Return 0 EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _GDIPlus_GlowCreate(ByRef $hGraphics, $iX1, $iY1, $iX2, $iY2, $iSize = 16, $iCInner = 0x6010FF10) ;coded by UEZ build 2015-01-09 beta Local Const $fAngle = ATan(($iY2 - $iY1) / ($iX2 - $iX1)) * $fDeg ;calculate the angle of the 2 points Local Const $iW = Round(Sqrt(($iY2 - $iY1) ^ 2 + ($iX2 - $iX1) ^ 2), 0), $iH = $iW ;length between the 2 points Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) Local Const $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2) _GDIPlus_MatrixRotate($hMatrix, $fAngle + 90) _GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2) _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix) Local Const $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddRectangle($hPath, ($iW - $iSize) / 2 - $iSize / 2, 0, $iSize * 2, $iH) $hBrush_Glow = _GDIPlus_LineBrushCreate(($iW - $iSize) / 2, 0, ($iH + $iSize) / 2, 0, 0, 0) Local $aColorGradient[4][2], $iCOuter = 0x00000000 $aColorGradient[0][0] = 3 $aColorGradient[1][0] = $iCOuter $aColorGradient[1][1] = 0.0 $aColorGradient[2][0] = $iCInner $aColorGradient[2][1] = 0.5 $aColorGradient[3][0] = $iCOuter $aColorGradient[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hBrush_Glow, $aColorGradient) _GDIPlus_GraphicsFillRect($hCtxt, ($iW - $iSize) / 2, 0, $iSize, $iH, $hBrush_Glow) Local $fDX, $fDY If $fAngle <= 180 Then ;adjust position $fDX = $iX2 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2) $fDY = $iY2 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2) Else $fDX = $iX1 - ($iW / 2 + Cos($fAngle * $fRad) * $iW / 2) $fDY = $iY1 - ($iH / 2 + Sin($fAngle * $fRad) * $iH / 2) EndIf _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $fDX, $fDY, $iW, $iH) _GDIPlus_PathDispose($hPath) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_BrushDispose($hBrush_Glow) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BitmapDispose($hBitmap) EndFunc ;==>_GDIPlus_GlowCreate Func PlayGlowAnim() If $__bPlayAnim Then Local Static $fTransparency = 0x40, $iDir = 1 _WinAPI_SetLayeredWindowAttributes($__hGUI_Glow, 0x00011, $fTransparency < 0x40 ? 0x40: $fTransparency > 0xFF ? 0xFF : $fTransparency) $fTransparency += 8 * $iDir If $fTransparency < 0x40 Or $fTransparency > 0xFF Then $iDir *= -1 EndIf EndFunc The glowing effect isn't good as in the original CSS version because of the rounded corners. Further it is not designed to add more controls to the GUI easily. It is just to show that it is possible to create such GUIs. Tested only on Win 8.1. Might not work on WinXP or when Aero is disabled! Br, UEZ
    2 points
  2. Thanks to Joachim Bauch's tutorial about Loading a DLL from memory. Here comes the easiest way to run the codes written in other language. All you need to do are make a DLL, convert it to HEX format, and embed into your script. For now, only stdcall is supported (up to four parameters) (There is no limit now, see update note). BTW, this script is only tested on Windows XP SP3. If you can run it in other systems, please let me know, thanks. Demo how to use: (this 3k md5.dll is written by myself and anyone is welcome to use it. But the machine code version of MD5 should be better choice in AutoIt) ; ------------------------------------------------------------- ; ; Step 1: Try to use the DLLs in the normal method (by DllCall) ; ; ------------------------------------------------------------- $String = "The quick brown fox jumps over the lazy dog" $Digest = DllStructCreate("byte[16]") DllCall("md5.dll", "str", "md5", "str", $String, "uint", StringLen($String), "ptr", DllStructGetPtr($Digest)) $Hash = DllStructGetData($Digest, 1) $Digest = 0 MsgBox(0, 'MD5 Hash', $Hash) ; ---------------------------------------------------------------------------- ; ; Step 2: Use MemoryDllGen.au3 to convert the DLL to script form and paste it. ; ; ---------------------------------------------------------------------------- Dim $DllBinary = ''; this line is too long to omit, check the attachment ; -------------------------------------------------------------------------------- ; ; Step 3: Replace DllCall to MemoryDllCall, and use $DllBinary instead of dll name ; ; -------------------------------------------------------------------------------- #Include "MemoryDll.au3" MemoryDllInit() $String = "The quick brown fox jumps over the lazy dog" $Digest = DllStructCreate("byte[16]") MemoryDllCall($DllBinary, "str", "md5", "str", $String, "uint", StringLen($String), "ptr", DllStructGetPtr($Digest)) $Hash = DllStructGetData($Digest, 1) $Digest = 0 MsgBox(0, 'MD5 Hash', $Hash) MemoryDllExit() ; ------------------------------------------------------------------------- ; ; Step 4: Finally, you have the functions in Pure AutoIt Scirpt. Have fun ! ; ; -------------------------------------------------------------------------MemoryDll.zip (4.67K) Number of downloads: 253 08/08/03 Update Note: Rearrange the return array of MemoryDllCall, now it's return should just like DllCall.Add support to accept more than four parameters, but in this case, some return value will be destoryed.Add a little Tutorial.MemoryDll.zip (9.17K) Number of downloads: 251 08/08/18 Update Note: I finally found a perfect trick to call a function in memory. So this UDF now supports DLL functions in both stdcall and cdecl mode with any number of parameters. In theory, DllCall now can be fully replaced by MemoryDllCall.There is a new func called MemoryFuncCall in this version. It is a new way to call a memory address. Compared to CallWindowProc (old method), MemoryFuncCall is flexible (supports cdecl, etc. ), but a bit slower.There are also two new utility scripts in attachment. AESFile uses the dll downloaded from http://adeil.com. It encrypt/decrypt files by a key of 32, 48 or 64 bytes long. SHA2 is written by Brian Gladman and compiled to DLL by me. It generates SHA2 hash of 224, 256, 384, or 512 bits long. Thanks to -Ultima- and ProgAndy's suggestion.MemoryDll.zip (50.27K) Number of downloads: 441 08/12/06 Update Note: Improves compatibility. Now MemoryDllCall should work better under Vista.Example of AESFile and SHA512 are removed. Please see my other post about AES and Hashes.MemoryDll.zip (8.95K) Number of downloads: 1118 2010/10/18 Update Note: Avoiding DEP issue.Improves compatibility. Now BASS.DLL is supported.MemoryDll.zip 2011/04/03 Update Note: Rewritten all code in AutoIt. Now both x86 and x64 DLL are supported.MemoryDllInit(), MemoryDllExit(), and old examples are removed.Add new example, MemoryDll version of SQLite.au3.Ps. I think old version are still good or even better when only used under x86 mode.But this version support x64 and has better compatibility I guess.MemoryDll.zip 2015/01/08 Update Note: Update the machine code version. Both x86 and x64 DLL are supported.TLS callback are supported.Remove all MemoryFuncXXX() related functions. Use build-in DllCallAddress instead.Add MemoryDllLoadString(), MemoryDllLoadResource() Add _WinAPI_MemoryFindResource(), _WinAPI_MemoryFindResourceEx(), _WinAPI_MemorySizeOfResource(), _WinAPI_MemoryLoadResource(), _WinAPI_MemoryLoadString(), _WinAPI_MemoryLoadStringEx()Using BinaryCall.au3 to loading the machine code.MemoryDll.zip 2015/01/23 Update Node: Add ability to load a DLL that needs other DLLs. For example: libcurl.dll needs libeay32.dll and ssleay32.dll for https support. Now you can load all of them by MemoryDll UDF. Before this version, only libcurl.dll can loaded by MemoryDll, other files must store on the disk.Add ability to call functions by ordinal value.Add MemoryDllRun(). It run a EXE file from memory. Relocation table in EXE file is required. Most PE rebuilding tools remove the section to reduce the file size.Add a script to demonstrate all the new features.This version of MemoryDll can works together with BinaryCall UDF. Binary machine code can call functions in DLL loaded by MemoryDll. MemoryDll.zip
    1 point
  3. Ward

    MessagePack UDF

    Introduction "MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller." (by http://msgpack.org/). There are already so many languages support MessagePack format, here comes AutoIt version. The backend coder is Charlie Gunyon's cmp. It supported MessagePack proposal v5. This UDF only have two public functions: MsgPack_Pack() and MsgPack_Unpack(). It just like Json_Enocde() and Json_Decode() in my ?do=embed' frameborder='0' data-embedContent>>JSON UDF. The Map type will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). So I suggest using Json.au3 to deal with the Map/Object data type. The main difference is MessagePack support Binary format, but Json not. For example (?do=embed' frameborder='0' data-embedContent>>Json.au3 is required to run this example): Local $Obj1 Json_Put($Obj1, ".binary", Binary("0x00")) Json_Put($Obj1, ".string", "abc") Json_Put($Obj1, ".int", Random(0, 1000, 1)) Json_Put($Obj1, ".float", Random()) Json_Put($Obj1, ".bool", True) Json_Put($Obj1, ".null", Null) Local $Binary = MsgPack_Pack($Obj1) Local $Obj2 = MsgPack_Unpack($Binary) ConsoleWrite("Test2 $Obj1.binary is " & VarGetType(Json_Get($Obj2, ".binary")) & @LF) ; "Binary" In my opinion, for human readable data storing or exchanging, of course choose Json. Otherwise, especially to exchange data on the internet, MessagePack may be a better choice. MsgPack.zip
    1 point
  4. Ontosy

    bug in date.au3?

    In the file: AutoIt3IncludeDate.au3 in the function: _SetTime at line: 1045 have: If $iSecond > 0 Then DllStructSetData($tSYSTEMTIME, "MSeconds", $iSecond) It should not be If $iSecond > 0 Then DllStructSetData($tSYSTEMTIME, "Second", $iSecond) ? Do it is possible to add mSeconds also to library?
    1 point
  5. Here is the namespace called CustomMethod with the class called Extensions. It's to add additional functionality to the likes of in-built datatypes such as string. Use the same way as you would when calling the likes of "myString".ToUpper() or 'c'.ToString() etc... /* * Created by guinness * User: guinness * Date: 05/04/2014 */ using System; using System.Text.RegularExpressions; namespace CustomMethod { public static class Extensions // Create a custom class for extension methods. { /// <summary> /// Checks whether a character is a digit from 0-9. /// </summary> /// <param name="c">A character value.</param> /// <returns>True or False</returns> public static bool IsDigit(this char c) { return (c >= '0' && c <= '9'); } /// <summary> /// Checks whether a string is a digits from 0-9. /// </summary> /// <param name="i">A string value.</param> /// <returns>True or False</returns> public static bool IsDigit(this string i) { foreach (char value in i) { if (value < '0' || value > '9') return false; } return true; } /// <summary> /// Checks whether a double is an even value. /// </summary> /// <param name="d">A double value.</param> /// <returns>True or False</returns> public static bool IsEven(this double d) { return Math.Round(d) % 2 == 0; } /// <summary> /// Checks whether an integer is an even value. /// </summary> /// <param name="i">An integer value.</param> /// <returns>True or False</returns> public static bool IsEven(this int i) { return i % 2 == 0; } /// <summary> /// Checks whether a character is a hexadecimal value from 0-9 and A-F. /// </summary> /// <param name="c">A character value.</param> /// <returns>True or False</returns> public static bool IsHex(this char c) { return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f'); } /// <summary> /// Checks whether a string is a hexadecimal value from 0-9 and A-F. /// </summary> /// <param name="s">A string value.</param> /// <returns>True or False</returns> public static bool IsHex(this string s) { foreach (char value in s) { if (value < '0' || value > '9' && value < 'A' || value > 'F' && value < 'a' || value > 'f') return false; } return true; } /// <summary> /// Checks if a double is an odd value. /// </summary> /// <param name="d">A double value.</param> /// <returns>True or False</returns> public static bool IsOdd(this double d) { return Math.Round(d) % 2 == 1; } /// <summary> /// Checks if an integer is an odd value. /// </summary> /// <param name="i">An integer value.</param> /// <returns>True or False</returns> public static bool IsOdd(this int i) { return i % 2 == 1; } /// <summary> /// Checks whether a string is a palindrome. /// </summary> /// <param name="s">A string value.</param> /// <returns>True or False</returns> public static bool IsPalindrome(this string s) { s = Regex.Replace(s, @"\W", "").ToLower(); // Remove all non-word characters and convert to lowercase. char[] c = s.ToCharArray(); Array.Reverse(c); return new string(c) == s; } /// <summary> /// Checks if a byte value is true when non-zero. (Like in most languages.) /// </summary> /// <param name="b">A byte value.</param> /// <returns>True or False</returns> public static bool IsTrue(this byte b) { return b != 0; } /// <summary> /// Checks if a double value is true when non-zero. (Like in most languages.) /// </summary> /// <param name="d">A double value.</param> /// <returns>True or False</returns> public static bool IsTrue(this double d) { return d != 0; } /// <summary> /// Checks if an integer value is true when non-zero. (Like in most languages.) /// </summary> /// <param name="i">An integer value.</param> /// <returns>True or False</returns> public static bool IsTrue(this int i) { return i != 0; } /// <summary> /// Checks if a string is true when the value is not empty. (Like in most languages.) /// </summary> /// <param name="s">A string value.</param> /// <returns>True or False</returns> public static bool IsTrue(this string s) { return s.Length != 0; } /// <summary> /// Repeat a character a certain number of times. /// </summary> /// <param name="c">A character value.</param> /// <param name="count">Number of times to repeat the character.</param> /// <returns>Repeated character.</returns> public static string Repeat(this char c, int count) { return (count < 0) ? c.ToString() : new string(c, count); } /// <summary> /// Repeat a string a certain number of times. /// </summary> /// <param name="s">A string value.</param> /// <param name="count">Number of times to repeat the string.</param> /// <returns>Repeated string.</returns> public static string Repeat(this string s, int count) // Idea taken from AutoIt _StringRepeat() { if (count < 0 || s.Length < 1) // Check the string length is greater than 1 and the repeat count is valid. Zero is considered valid. return s; return string.Join(s, new string[count + 1]); // http://rosettacode.org/wiki/Repeat_a_string#C.23 } /// <summary> /// Reverse a string. /// </summary> /// <param name="s">A string value.</param> /// <returns>Reversed string.</returns> public static string Reverse(this string s) { char[] c = s.ToCharArray(); int i = 0, j = c.Length - 1; while (i < j) // This version is a slightly optimised version than Array.Reverse(). { char temp = c[i]; c[i++] = c[j]; c[j--] = temp; } return new string(c); /* char[] c = s.ToCharArray(); Array.Reverse(c); return new string(c); */ } /// <summary> /// Convert an integer to a hexadecimal representation. /// </summary> /// <param name="i">An integer value.</param> /// <param name="isLowerCase">Is the representation lowercase (true) or uppercase (false).</param> /// <returns>Hexadecimal string.</returns> public static string ToHexString(this int i, bool isLowerCase = true) // Convert an integer to a hex string representation. { return i.ToString((isLowerCase) ? "x" : "X"); } private static string ToLowerFast(this string s) // (Faster) convert a string to lowercase characters. Access the same way as .ToLower(). { string lowerString = string.Empty; foreach (char value in s) { lowerString += (char)((value >= 'A' && value <= 'Z') ? (value + 32) : value); // Cast as a char. } return lowerString; } private static string ToUpperFast(this string s) // (Faster) convert a string to uppercase characters. Access the same way as .ToUpper(). { string upperString = string.Empty; foreach (char value in s) { upperString += (char)((value >= 'a' && value <= 'z') ? (value - 32) : value); // Cast as a char. } return upperString; } } } Note: Improved version found >here.
    1 point
  6. Well without the code the error seems correct to me.
    1 point
  7. 2015/01/08 Update Note: * Update the machine code version. Both x86 and x64 DLL are supported. * TLS callback are supported. * Remove all MemoryFuncXXX() related functions. Use build-in DllCallAddress instead. * Add MemoryDllLoadString(), MemoryDllLoadResource() * Add _WinAPI_MemoryFindResource(), _WinAPI_MemoryFindResourceEx(), _WinAPI_MemorySizeOfResource(), _WinAPI_MemoryLoadResource(), _WinAPI_MemoryLoadString(), _WinAPI_MemoryLoadStringEx() * Using BinaryCall.au3 to loading the machine code.
    1 point
  8. While I can see where someone might consider this legit. I don't. You knew it had to do with a game. You knew it had source code. You ran it anyway. Then you post it (the source about a game hack) on this forum. Then you want assistance because you weren't smart enough to either just not run the code, or ask first? This topic is closed.
    1 point
  9. Several things 1. Remove that code! I understand why you are asking what you are asking but the code itself in my opinion is against forum rules. 2. I read the script and I'm not seeing anything that would cause your rig any harm. I'm not the best here at this but from what I read it looks like a game hack script that uses memory reading to do what it needs to do. I do recommend a second opinion to confirm my findings. 3. You may want to ask a moderator for assistance on this. This way you do not cause harm to others by posting that code while at the same time you get the help you need.
    1 point
×
×
  • Create New...