I need to determine the first char of a buffer by using
a pointer. So far this isnt working...
mov esi, offset bSocketBuffer
.if byte ptr != "2"
jmp Cleanup
.endif
Any Ideas?
XtremeI think I solved it with:
mov eax, bSocketBuffer
mov dl, byte ptr
.if dl != "2"
jmp Cleanup
.endif
// mov eax, bSocketBuffer
// mov dl, byte ptr
// .if dl != "2"
// jmp Cleanup
// .endif
hm, you forget calculating the offset...
but i think it's better to use this:
mov eax,offset bSocketBuffer
cmp byte ptr ,"2"
jnz Cleanup
This message was edited by drcmda, on 3/10/2001 10:39:17 PM
Try this if you need to test a single byte in a buffer
mov al, buffer[0]
It works by treating the buffer as a BYTE array so you can just
set the offset in the square brackets.
Regards,
hutch@pbq.com.auThis is what I'm using now. Its the only thing that seems
to work right. Note that
bSocketBuffer
is a
pointer returned from the GlobalLock function.
mov eax, bSocketBuffer
.if byte ptr != "2"
jmp Cleanup
.else
Regards,
Xtremeyou can't say that this is not working,
it's the same but shorter & faster:
cmp byte ptr bSocketBuffer[0],"2"
jnz Cleanup
just go to iczelions site and you will
find a lot of wonderfull resources (links)
about asm basics like conditional jumps.
bye and good luck in your project.
Sorry,
With the code I using now the the app jumps to
Cleanup
when
the first char isnt 2 - like its supposed to. When I use your
code (I really want to) the app always jumps to Cleanup
.
I don't know why...
Xtremecmp byte ptr , "2"
jnz Cleanup
try that...
a better name for bSocketBuffer would be lpSocketBuffer, then it would be easier to see that it's really a pointer to a buffer and not the buffer itself. lp = long pointer
This message was edited by Zynaps, on 3/13/2001 11:46:45 AM