⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysutils.inc

📁 The final version of UPX scrambler and PE sources in Delphi and flat assembler.
💻 INC
字号:

; System functions

proc GetMainArgs
     local flag:BYTE
     ;--------------
     push ebx edi esi
     invoke GetCommandLineA
     mov edi,eax
     invoke lstrlenA,eax
     mov esi,eax
     invoke VirtualAlloc,0,esi,MEM_COMMIT,PAGE_READWRITE
     test eax,eax
     jz @@ret
     mov ebx,eax
     xor ecx,ecx
     mov [flag],0
     mov [_argc],0
     mov [_argv],ebx
     .while ecx < esi
	    .if byte [edi+ecx] <> 22h
		.if byte [edi+ecx] <> 20h
@@:		    mov al,[edi+ecx]
		    mov [ebx],al
		    inc ebx
		.else
		    cmp [flag],0
		    jne @r
		    inc ebx
		    .if byte [edi+ecx+1] <> 20h
			inc [_argc]
			.if [_argc] > MAX_PARAM_COUNT
			    mov [_argc],MAX_PARAM_COUNT
			    jmp @@ret
			.endif
			mov eax,[_argc]
			shl eax,2
			mov [_argv+eax],ebx
		    .endif
		.endif
	    .else
		not [flag]
	    .endif
	    inc ecx
     .endw
@@ret:
     pop esi edi ebx
     ret
endp

proc ParamStr,nIndex:BYTE;:LPCTSTR ; -> EAX: pointer to n-param
     mov edx,[_argc]
     .if [nIndex] < dl
	 movzx edx,[nIndex]
     .endif
     shl edx,2
     mov eax,[_argv+edx]
     ret
endp

proc Randomize
     local SystemTime:SYSTEMTIME
     ;--------------------------
     lea eax,[SystemTime]
     invoke GetSystemTime,eax
     movzx eax,[SystemTime.wHour]
     imul eax,60
     add ax,[SystemTime.wMinute]
     imul eax,60
     xor edx,edx
     mov dx,[SystemTime.wSecond]
     add eax,edx
     imul eax,1000
     mov dx,[SystemTime.wMilliseconds]
     add eax,edx
     mov [RandSeed],eax
     ret
endp

proc Random,dwRange:DWORD ; -> EAX: random number
     mov eax,[dwRange]
     imul edx,[RandSeed],08088405h
     inc edx
     mov [RandSeed],edx
     mul edx
     mov eax,edx
     ret
endp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -