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? Xtreme
Posted on 2001-03-10 19:58:00 by xtreme
I think I solved it with:

    mov eax, bSocketBuffer
    mov dl, byte ptr 
    .if dl != "2"
        jmp Cleanup
    .endif
Posted on 2001-03-10 20:08:00 by xtreme
// 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
Posted on 2001-03-10 22:38:00 by drcmda
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.au
Posted on 2001-03-11 04:00:00 by hutch--
This 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, Xtreme
Posted on 2001-03-11 16:52:00 by xtreme
you 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.
Posted on 2001-03-11 20:57:00 by drcmda
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... Xtreme
Posted on 2001-03-11 21:21:00 by xtreme
cmp 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
Posted on 2001-03-13 10:44:00 by Zynaps