//veriaveis globais unsigned far* seg_tabela = (unsigned far*)MK_FP(0x40,0x0C);//aponta para 40:c onde esta o seg da tabela unsigned far* end_tab; int CS_p, IP_p, IP_main, DS_ES_SS; void main() { //end = CS:IP CS_p = FP_SEG(serial); //guarda CS(segment) do processo IP_p = FP_OFF(serial); //IP do processo(deslocameto) IP_main = FP_OFF(main); //IP da funçao main DS_ES_SS = FP_OFF(&seg_tabela); // registradores vao conter segmento da tabela //alterando o valor dos registradores _BX = CS_p; _CX = IP_p; _SI = IP_main; _DI = 0x1111; _BP = _SP-2; //SP inicial _AX = 0xAAAA; asm { pushf push BX push CX push AX push BX push CX push DX push ES push DS push SI push DI push BP mov AX,SP sub AX,2 push AX sub AX,2 push AX sub AX,2 push AX sub AX,2 push AX } end_tab=(unsigned far*)MK_FP(seg_tab,0x100) //deslocameto!!!!!!! while(!(*end_tab==0xFFF)) //procurar tabela { end_tab=end_tab-2; } //se achou tabela guardar o conteudo dos registadores SS:SP nela *end_tab = _SP; *end_tab+1 = _SS; printf("\n Registradores do processo:\n CS: %4x\n IP: %4x\n DS = ES = SS: %4x\n tabela:%p",CS_p,IP_p,DS_ES_SS,end_tab); keep(0,_SS-_psp+_SP/16+10); //10 parag = 160 bytes seguranca }