Verwertung von strlen()



  • Bei dem Lesen von Assembly bin ich auf folgenden Part gestoßen:

    push	esi
    		push	eax		; Str
    		call	strlen
    		pop	ecx
    		push	[ebp+dwProcessId] ; dwProcessId
    		mov	esi, eax
    		push	edi		; bInheritHandle
    		push	2Ah		; dwDesiredAccess
    		inc	esi
    		call	OpenProcess
    		cmp	eax, edi
    		mov	[ebp+hProcess],	eax
    		jz	loc_9A65D2
    		push	40h		; flProtect
    		push	3000h		; flAllocationType
    		lea	ecx, [esi+20h]
    		push	ecx		; dwSize
    		push	edi		; lpAddress
    		push	eax		; hProcess
    		call	VirtualAllocEx
    

    Alles soweit sinnig doch ich verstehe nicht, wieso erst strlen(Str)+1 berechnet und in esi abgelegt wird und dann später bei VirtualAllocEx bei dwSize die effektive Addresse von [esi+20h] und nicht esi angegeben wird. Könnte mir da jmd. eine schnelle Erklärung liefern?

    MfG, 0x2A



  • LEA wird hier zum Addieren benutzt:
    VirtualAllocEx(...,...,strlen(Str)+1+32);


Anmelden zum Antworten