1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | proc Xsearch; lpStr,lpX
pushad
mov esi,[esp+4*9]
mov edi,[esp+4*10]
call @F
mov eax,[esp+4*3]
mov esp,[eax+0xC4]
jmp Xsearch_Err
@@:
xor eax,eax
push [fs:eax]
mov [fs:eax],esp
.Start:
or ecx,-1
@@: inc ecx
mov al,byte[edi+ecx]
cmp al,0
je @F
cmp al,'\'
jne @B
@@: rep cmpsb
jne Xsearch_Err
or ecx,ecx
jne Xsearch_Err
cmp byte[edi],0
je Xsearch_Suc
inc edi
mov al,byte[edi]
cmp al, 'n'
je .n
cmp al, 'w'
je .w
cmp al, '?'
je .?
cmp al, 't'
je .t
cmp al, 'd'
je .d
cmp al, '*'
je .xx
cmp al, '('
je .c ;\(....\|...\)
cmp al, '|'
je Xsearch_Suc
cmp al, ')'
je Xsearch_Suc
;.\\:
inc edi
lodsb
cmp al,'\'
jne Xsearch_Err
jmp .Start
.xx: ;.*:
inc edi
dec esi
@@: inc esi
cmp byte[esi],0
je Xsearch_Err
i Xsearch,esi,edi
jnc @B
xchg eax,esi
jmp Xsearch_Suc
.t:
lodsb
cmp al,9
jne Xsearch_Err
inc edi
jmp .Start
.n:
lodsw
cmp ax,0x0A0D
jne Xsearch_Err
inc edi
jmp .Start
.?:
inc edi
inc esi
cmp byte[edi], '{'
jne .Start
i __atoi,addr edi+1
dec eax
add esi,eax
@@: inc edi
cmp byte[edi], '}'
jne @B
inc edi
jmp .Start
.w:
mov ecx,1
inc edi
cmp byte[edi], '{'
jne .w_loop
i __atoi,addr edi+1
xchg eax,ecx
@@: inc edi
cmp byte[edi], '}'
jne @B
inc edi
.w_loop:
lodsb
or al,0x20
cmp al, 'a'
jb Xsearch_Err
cmp al, 'z'
ja Xsearch_Err
loop .w_loop
jmp .Start
.d:
mov ecx,1
inc edi
cmp byte[edi], '{'
jne .d_loop
i __atoi,addr edi+1
xchg eax,ecx
@@: inc edi
cmp byte[edi], '}'
jne @B
inc edi
.d_loop:
lodsb
cmp al,0
jb Xsearch_Err
cmp al,9
ja Xsearch_Err
loop .w_loop
jmp .Start
.c:
inc edi
i Xsearch,esi,edi
jc .c_end
@@: inc edi
cmp word[edi], '\)'
je Xsearch_Err
cmp word[edi], '\|'
jne @B
inc edi
jmp .c
.c_end:
xchg eax,esi
@@: inc edi
cmp word[edi], '\)'
jne @B
inc edi
inc edi
jmp .Start
;-------------------------------
Xsearch_Suc:
mov dword[esp+4*9],esi
sub esi,[esp+4*11]
mov dword[esp+4*8],esi
stc
jmp Xsearch_Ret
Xsearch_Err:
clc
Xsearch_Ret:
pop dword[fs:0]
pop eax
popad
retn 4*2
endp
|