Hello, i've been lookin in a program and found the following piece of code,


off_0_410887
dd offset loc_0_41067E
dd offset loc_0_41069D
dd offset loc_0_4106BC
dd offset loc_0_4106DB

jmp off_0_410887

how by this jump it chooses one of the four locations ? is it like a C switch() instruction in C ? how would i make it in C without using the goto instruction..oh well first i need to understand it to make it C..hope anyone can help me out =)
Posted on 2002-05-20 11:04:34 by The Keeper
if ecx is 0 then it jumps to the first address if ecx is 1 then it jumps to the seccond address...

in c you could do the same by having an array of function pointers and a variable doing what ecx is doing.

EDIT
Actually function pointers wouldn't quite do it because these are jumps not calls.
Posted on 2002-05-20 11:24:11 by Kudos
why not:
.RADIX 16
jmp off 0fac11ff
or
jmp 0ffac11ff
:D
Posted on 2002-05-20 16:53:58 by jademtech
I think "NOT" 'cause author of the code wanted jmp to one of the addresses depending on ecx value
Posted on 2002-05-21 00:31:27 by The Svin
Yes it most definitely is a switch() statement in C. That is how most compilers optimize switch(). That piece of code looks like a disassembly. You doing RE?
Posted on 2002-05-21 08:09:04 by AmkG