示例#1
0
int main(int argc, char** argv)
{
	printf("EBP located at: %p\n",getEIP());
	return 0;
}
示例#2
0
void CPU::_CALL_imm32(Instruction& insn)
{
    push32(getEIP());
    jumpRelative32(insn.imm32());
}
示例#3
0
void CPU::_CALL_RM32(Instruction& insn)
{
    push32(getEIP());
    jumpAbsolute32(insn.modrm().read32());
}
示例#4
0
void MS_bop_1(void) {

    if (!WowModeInitialized) {
    //Load the WOW DLL
    if ((hWOWDll = SafeLoadLibrary("WOW32")) == NULL)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        TerminateVDM();
        return;
    }

    // Get the init entry point and dispatch entry point
    if ((WOWInitEntry = (MYFARPROC)GetProcAddress(hWOWDll, "W32Init")) == NULL)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        FreeLibrary(hWOWDll);
        TerminateVDM();
        return;
    }

    if ((WOWDispatchEntry = GetProcAddress(hWOWDll, "W32Dispatch")) == NULL)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        FreeLibrary(hWOWDll);
        TerminateVDM();
        return;
    }

    //Get Comms functions
    if ((GetCommHandle = (GCHfn) GetProcAddress(hWOWDll, "GetCommHandle")) == NULL)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        FreeLibrary(hWOWDll);
        TerminateVDM();
        return;
    }

    if ((GetCommShadowMSR = (GCSfn) GetProcAddress(hWOWDll, "GetCommShadowMSR")) == NULL)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        FreeLibrary(hWOWDll);
        TerminateVDM();
        return;
    }

    //Get hung app Notification routine
    pW32HungAppNotifyThread = (VOID(*)(UINT))GetProcAddress( hWOWDll,
                                                    "W32HungAppNotifyThread");
    if (!pW32HungAppNotifyThread)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        FreeLibrary(hWOWDll);
        TerminateVDM();
        return;
    }


    // Call the init routine
    if ((*WOWInitEntry)() == FALSE)
    {
#ifndef PROD
        HostDebugBreak();
#endif
        TerminateVDM();
        return;
    }

    WowModeInitialized = TRUE;
    }

#if !defined(CPU_40_STYLE) || defined(CCPU)
    (*WOWDispatchEntry)();
#else
    // Dispatch to WOW dispatcher
    {
	static BYTE **AddressOfLocal;
	BYTE *localSimulateContext = GLOBAL_SimulateContext;

	AddressOfLocal = &localSimulateContext;

	(*WOWDispatchEntry)();

	SET_GLOBAL_SimulateContext(localSimulateContext);

	if(AddressOfLocal != &localSimulateContext)
	{
	    //Thread switch detected via stack change, force CPU to
	    //abort the current fragment, reseting GDP var's refering
	    //to the host stack

	    setEIP(getEIP());
	}
    }
#endif	/* CPU_40_STYLE */
}