Exemple #1
0
void* find_printf() {
	int i = 0;
	int j = 0;
	unsigned int sp;
	unsigned int* stack = &sp;
	void(*default_block_write)(void) = find_function("default_block_write", TARGET_BASEADDR, TARGET_BASEADDR);
	default_block_write();
	for(i = 0; i < 0x100; i += 4) {
		unsigned int value = *(stack - i);
		if((value & TARGET_BASEADDR) == TARGET_BASEADDR) {
			for(j = 0; j < 0x100; j++) {
				unsigned short* instruction = (unsigned short*)(value + j);
				if(*instruction == 0xB40F) {
					return (void*) value + (j+1);
				}
			}
		}
	}
	return 0;
}
Exemple #2
0
PVOID
FwpFindPrintf(
    VOID
    )
/*++

Routine Description:

    Find _printf in iBoot.
    
Arguments:

    None.
    
Return Value:

    Address of the function.
    
--*/
{
    int i = 0;
    int j = 0;
    unsigned int sp;
    unsigned int* stack = &sp;
    void(*default_block_write)(void) = FwPatchFindFunction((PUCHAR)"default_block_write", (PUCHAR)TARGET_BASEADDR, (PUCHAR)TARGET_BASEADDR);
    default_block_write();
    for(i = 0; i < 0x100; i += 4) {
        unsigned int value = *(stack - i);
        if((value & TARGET_BASEADDR) == TARGET_BASEADDR) {
            for(j = 0; j < 0x100; j++) {
                unsigned short* instruction = (unsigned short*)(value + j);
                if(*instruction == 0xB40F) {
                    return (void*) value + (j+1);
                }
            }
        }
    }
    return 0;    
}