ok, i've tried creating a proto that counts the number of "," after a "[" by using the lodsb....but it wouldnt work. and i was wondering if anyone got some source for that...so i can parse "Client.Connect" in a textbox...whats the best way of doing that....i looked at smurf's thread but it didnt help me much :(
Posted on 2002-01-30 12:42:05 by Guest
Guest,
take a closer look at the code, I posted in smurf's thread.
I count the commas (',') after the first bracket ('('). Should be a easy task to adapt this code to your needs. If you don't have success, post your try here, and we'll try to improve / correct your code.

:)

Thanx,
bAZiK
Posted on 2002-01-31 01:35:26 by bazik
you should really check out the Masm32 lib functions
InString, szMid, szLeft, and szRight, it's what i use for all my string parsing, it makes it really simple.
Posted on 2002-01-31 04:12:28 by Asm_Freak
Ok heres my code, how would i got about getting it supporting more than 2 parameters? thanks


.386
.model flat, stdcall
option casemap:none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.data
m00p db "Client.Connect",0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.data?
buffer db 512 dup(?)
buffer2 db 512 dup(?)
buffer3 db 512 dup(?)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.code
start:
mov esi, offset m00p
mov edi, offset buffer

@@GetCommand:
mov al,
inc esi
mov , al
inc edi
test al, al
jz @@Done
cmp al, "["
jne @@GetCommand
mov byte ptr , 0
mov edi, offset buffer2

@@GetParam1:
mov al,
inc esi
mov , al
inc edi
test al, al
jz @@Done
cmp al, ","
jne @@GetParam1
mov byte ptr , 0
mov edi, offset buffer3

@@GetParam2:
mov al,
inc esi
mov , al
inc edi
test al, al
jz @@Done
; cmp al, "," Causes general protection fault
; jne @@GetParam2
cmp al, "]"
jne @@GetParam2

@@Done:
mov byte ptr , 0
invoke MessageBox, 0, addr buffer, addr buffer2, 0
invoke MessageBox, 0, addr buffer3, addr m00p, 0
invoke ExitProcess, 0
end start
Posted on 2002-01-31 16:43:09 by Guest
this should do what you asked. im still new to string parsing so this code might not be the most efficient but should come close.

.386 

.model flat, stdcall
option casemap:none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.data
m00p db "Client.Connect[localhost,6,5,5,3,5]",0
fmt db "%hu",0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.data?
buffer db 512 dup(?)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.code
start:
xor ecx,ecx
xor edx,edx
mov al,byte ptr[m00p + ecx]
cmp al,"["
repne scasb
@L1:
mov al,byte ptr[m00p + ecx]
cmp al,0
je @L3
inc ecx
cmp al,","
je @L2
jmp @L1
@L2:
inc edx
jmp @L1
@L3:
invoke wsprintf,addr buffer,addr fmt,edx
invoke MessageBox, 0,addr buffer,0,0

invoke ExitProcess, 0
end start
Posted on 2002-02-01 05:59:40 by smurf