; \(123\|321\) ; \?{} ; \* ; \n ; \t ; \\ ; \w{1} ; \d{1} proc __atoi ;lpStr pushad mov esi,[esp+4*9] xor edx,edx mov ecx,8 @@: lodsb cmp al,'9' ja .ret cmp al,'0' jb .ret sub al,'0' imul edx,edx,10 add dl,al loop @B .ret: mov [esp+4*7],edx popad retn 4 endp 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 proc __strDel; lpSrc,lpX pushad i __strFindX,[esp+4*(8+2)],[esp+4*(8+2)] jnc .error lea esi,[eax+ecx] xchg eax,edi @@: cmp byte[esi],0 je .ret movsb jmp @B .ret: movsb stc jmp .error+1 .error: clc popad retn 4*2 endp proc __strFindX; lpStr,lpX push esi mov esi,[esp+4*2] dec esi @@: inc esi cmp byte[esi],0 je .error i Xsearch,esi,[esp+4*3] jnc @B sub eax,ecx stc jmp .error+1 .error: clc pop esi retn 4*2 endp proc __strlen; lpSrc push edi mov edi,[esp+4*2] or ecx,-1 mov al,0 repne scasb inc ecx inc ecx neg ecx pop edi retn 4 endp proc __strInsert ;lpSrc,lpStr,lpX pushad mov esi,[esp+4*(8+1)] i __strFindX,esi,[esp+4*(8+3)] jnc .error add eax,ecx push eax sub eax,esi xchg eax,ebp mov ebx,__strlen mov eax,[esp+4*(8+3)] ;lpStr push eax c ebx,eax ;__strlen,lpStr xchg ecx,edi c ebx,esi ;__strlen,lpSrc add ecx,edi inc ecx i GlobalAlloc,GMEM_ZEROINIT,ecx xchg eax,edi xchg ecx,ebp mov ebp,edi rep movsb pop esi xchg ecx,eax rep movsb pop esi c ebx,esi rep movsb c ebx,ebp mov [esp+4*6],ecx mov [esp+4*7],ebp stc jmp .error+1 .error: clc popad retn 4*3 endp proc __strReplace ;lpSrc,lpStr,lpX i __strInsert,[esp+4*3],[esp+4*3],[esp+4*3] jnc .error i __strDel,eax,[esp+4*3] stc jmp .error+1 .error: clc retn 4*3 endp proc __strGet ;lpSrc,lpRet,lpX i __strFindX,[esp+4*(1+1)],[esp+4*3] jnc .ret push edi mov edi,[esp+4*(2+1)] push esi push eax xchg eax,esi push ecx rep movsb pop ecx eax esi edi stc .ret: ret endp