Jump to content

Siao

Active Members
  • Posts

    914
  • Joined

  • Last visited

Profile Information

  • Member Title
    RTFM, foo!
  • Location
    Temple of Logic

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Siao's Achievements

Universalist

Universalist (7/7)

8

Reputation

  1. In that While loop, check the State (and possibly Type) member of each MEMORY_BASIC_INFORMATION structure to filter out unallocated pages. At the very least, state should read MEM_COMMIT. Also, if you only looking for code caves and not interested in memory allocated after PE is loaded, you could loop though PE section header, and get start address, raw/virtual size and flags of each section.
  2. As if it's something new to AutoIt... Scite, Search > Find in files..., point to AutoIt include folder, and search for tRect. Or actually, search for the same in helpfile.
  3. Not necessarily. And zero padding each number string is the worst way to go, unless maybe you are dealing with huge numbers that can't be expressed with numeric types properly.
  4. Get rid of those @SW_LOCK/@SW_UNLOCK, update only if $NewText <> $OldText, use ControlSetText instead of GUICtrlSetData.
  5. That's not funny, that just proves my point. Anyway, since I want to be done with you ASAP and put you back on my ignore list where you rightfully belong, see this for example: #470173
  6. Take time to learn how to search, it will pay off many times over.
  7. DllCall a LoadKeyboardLayout+ActivateKeyboardLayout
  8. Because in theory, quicksort is not a stable sorting algo (see http://en.wikipedia.org/wiki/Stable_sort#Stability). That's just the way it is.
  9. In its most basic form: #include <WinAPI.au3> ConsoleWrite('Enumerating - user32.dll, type=3 (RT_ICON):' & @CRLF) _ResourceEnumNames(_WinAPI_GetModuleHandle('user32.dll'), 3) ConsoleWrite('Enumerating - ntbackup.exe, type=10 (RT_RCDATA):' & @CRLF) _ResourceEnumNames('ntbackup.exe', 10) Func _ResourceEnumNames($vModule, $iType) Local $hModule = $vModule, $aRet, $fLoad = IsString($vModule), $xCB = DllCallbackRegister('___EnumResNameProc','int','int_ptr;int_ptr;int_ptr;int_ptr') If $fLoad Then $hModule = _WinAPI_LoadLibrary($vModule) $aRet = DllCall('kernel32.dll','int','EnumResourceNamesW', 'ptr',$hModule, 'int',$iType, 'ptr',DllCallbackGetPtr($xCB), 'ptr',0) DllCallbackFree($xCB) If $fLoad Then _WinAPI_FreeLibrary($hModule) EndFunc Func ___EnumResNameProc($vModule, $pType, $pName, $lParam) Local $aSize = DllCall('kernel32.dll','int','GlobalSize','ptr',$pName), $tBuf If $aSize[0] Then $tBuf = DllStructCreate('wchar[' & $aSize[0] & ']', $pName) ConsoleWrite(DllStructGetData($tBuf, 1) & @CRLF) ;string ID Else ConsoleWrite($pName & @CRLF) ;integer ID EndIf Return 1 ;continue enumeration EndFunc
  10. MsgBox(0,'','Test = ' & _Crypt_HashData("Test")) ;=============================================================================== ; Function Name: _Crypt_HashData() ; Description: Calculate hash from data ; Syntax: ; Parameter(s): $vData - data to hash, can be binary or a string ; $iAlgID - hash algorithm identifier, can be one of the following: ; 0x8001 = MD2 ; 0x8002 = MD4 ; 0x8003 = MD5 (default) ; 0x8004 = SHA1 ; also see http://msdn.microsoft.com/en-us/library/aa375549(VS.85).aspx ; Requirement(s): ; Return Value(s): Success = Returns hash string ; Failure = Returns empty string and sets error: ; @error -1 = error opening advapi32.dll ; @error 1 = failed CryptAcquireContext ; @error 2 = failed CryptCreateHash ; @error 3 = failed CryptHashData ; Author(s): Siao ; Modification(s): ;=============================================================================== Func _Crypt_HashData($vData, $iAlgID = 0x8003) Local $hDll = DllOpen('advapi32.dll'), $iLen = BinaryLen($vData), $hContext, $hHash, $aRet, $sRet = "", $iErr = 0, $tDat = DllStructCreate("byte[" & $iLen+1 & "]"), $tBuf DllStructSetData($tDat, 1, $vData) If $hDll = -1 Then Return SetError($hDll,0,$sRet) $aRet = DllCall($hDll,'int','CryptAcquireContext', 'ptr*',0, 'ptr',0, 'ptr',0, 'dword',1, 'dword',0xF0000000) ;PROV_RSA_FULL = 1; CRYPT_VERIFYCONTEXT = 0xF0000000 If Not @error And $aRet[0] Then $hContext = $aRet[1] $aRet = DllCall($hDll,'int','CryptCreateHash', 'ptr',$hContext, 'dword',$iAlgID, 'ptr',0, 'dword',0, 'ptr*',0) If $aRet[0] Then $hHash = $aRet[5] $aRet = DllCall($hDll,'int','CryptHashData', 'ptr',$hHash, 'ptr',DllStructGetPtr($tDat), 'dword',$iLen, 'dword',0) If $aRet[0] Then $aRet = DllCall($hDll,'int','CryptGetHashParam', 'ptr',$hHash, 'dword',2, 'ptr',0, 'int*',0, 'dword',0) ;HP_HASHVAL = 2 $tBuf = DllStructCreate("byte[" & $aRet[4] & "]") DllCall($hDll,'int','CryptGetHashParam', 'ptr',$hHash, 'dword',2, 'ptr',DllStructGetPtr($tBuf), 'int*',$aRet[4], 'dword',0) $sRet = Hex(DllStructGetData($tBuf, 1)) Else $iErr = 3 EndIf DllCall($hDll,'int','CryptDestroyHash', 'ptr',$hHash) Else $iErr = 2 EndIf DllCall($hDll,'int','CryptReleaseContext', 'ptr',$hContext, 'dword',0) Else $iErr = 1 EndIf DllClose($hDll) Return SetError($iErr,0,$sRet) EndFunc
  11. You don't get it. It's not AutoIt problem at all. It's how you build your DLL in Delphi. Just digest this: http://en.wikipedia.org/wiki/Dynamic-link_library#Delphi
  12. I'm not familiar with Delphi, but it could be something like... function GetCurrentHP(wnd:HWND):DWORD stdcall; export; Geez, just read some delphi help on how to make proper usable DLLs.
  13. And that doesn't tell you anything? GetCurrentHP isn't exported. What language is this, Delphi? There should be some "export" keyword to be used in func declaration...
×
×
  • Create New...