News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

constant expected

Started by Magnum, February 26, 2013, 02:39:14 PM

Previous topic - Next topic

Magnum

; error A2026: constant expected

mov ebx, dword ptr DebugText * 4

DebugText      db    "Please exit the premises.",0

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

the line doesn't make sense
what do you want in EBX ?

Magnum

This is a work in progress.

It incorporates some code by Random.

I am interested in decrypting encrypted code while the program is running using self mod code.

The link I posted to bomz has a program that makes changes to P.E. files to allow write permissions in the code section.

Andy

Wind is blowing something fierce in Seabrook, Texas.



GoodGuyText    db    "You beat me.",0
GoodGuyCaption db    "Congrats.",0
DlgName        db    "My",0


DebugText      db    "Please exit the premises.",0

DebugCaption    db     "Ist gefunden.",0   

BadGuyText    db  "That is incorrect",0

buffer       DB      10 DUP (0) 

.data?

.code

start:

call SpagCode

invoke ExitProcess,0

SpagCode proc

call spagh

Return:

jmp continue

spagh:

pop edx
mov edi,3

continue:

; future project
;call BreakPointCheck
jmp StartShow

Loop1:

mov ebx, dword ptr [edi * 4 + address_array]
call ebx
dec edi
jnz Loop1
jmp Return
ret

Code3:

mov ecx,3
cmp ecx,eax
je junk2

; compare first 2 digits of serial no. of your program

mov eax, dword ptr buffer

; error A2026: constant expected

mov ebx, dword ptr DebugText * 4
cmp al,bl
je Compare3
call ShowBadGuy

ret

Compare2:
ret

;jmp StartShow


GoodGuy: ; real code in middle of junk

db 4eh, 21h, 30h, 4ch, 14h, 61h, 58h, 29h, 24h, 11h, 18h, 41h, 4eh, 21h,
   0b0h, 0ch, 25h, 21h, 58h, 2bh, 24h, 0c9h, 00h, 40h, 24h, 21h, 0c8h, 0d1h
nop
nop

Code2:

mov ecx,5
cmp ecx,eax
je junk2

mov eax, dword ptr buffer + 2
mov ebx, dword ptr GoodGuyText + 5
cmp al,bl
je Compare3
call ShowBadGuy
ret

Compare3:

mov eax, dword ptr buffer + 3
mov ebx, dword ptr GoodGuyText + 10
cmp al,bl
je Compare4
call ShowBadGuy

Compare4:
ret

Code1:

mov ecx,0
cmp ecx,eax
je junk2

; compare 5th and last digit of serial no.

mov eax, dword ptr buffer + 4
mov ebx, dword ptr BadGuyText + 6
cmp al,bl
je Compare5
call ShowBadGuy
ret

Compare5:

mov eax, dword ptr buffer + 5
mov ebx, dword ptr DebugCaption + 14
cmp al,bl
je Compare6
call ShowBadGuy

Compare6:
ret

junk2:

invoke ExitProcess,0

address_array dd 0, Code3, Code2, Code1

; Decrypt code for a MessageBox
;
StartShow:

mov edi, GoodGuy
mov ecx, 7
mov eax, "&21"

Loop7:

xor [edi], eax
add edi,4
dec ecx
jne Loop7

SpagCode endp

ShowBadGuy proc

; print message or whatever

ret
ShowBadGuy endp

end     start

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

that's crazy code   :biggrin:

mov ebx, dword ptr DebugText * 4
just won't fly

mov ebx, dword ptr DebugText
will get you the first 4 bytes of the string in EBX, little endian order

mov ebx, dword ptr DebugText + 4
will get you the next 4 bytes of the string in EBX, little endian order

mov ebx, offset DebugText
will get you the address of the string

mov ebx, dword ptr DebugText + 4
will get you the address of the string, plus 4

mov ebx, dword ptr DebugText
shl ebx, 2

will get you the first 4 bytes of the string (little endian), times 4