Ejemplo n.º 1
0
main ()
{

    BOOL success = TRUE;
    DWORD esp;
    esp = GetEspBeforeCalled();
    FastCallFunctionToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2);
    if (esp != GetEspBeforeCalled())
    {
        printf ("APP ERROR: FastCallFunctionToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }

    

    if (funcChar1 != CHAR_VAL1+CHAR_ADD_VAL1)
    {
        printf ("APP ERROR: FastCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2+CHAR_ADD_VAL2)
    {
        printf ("APP ERROR: FastCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1+INT_ADD_VAL1)
    {
        printf ("APP ERROR: FastCallFunctionToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2+INT_ADD_VAL2)
    {
        printf ("APP ERROR: FastCallFunctionToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }
    
    if (success)
    {
        printf ("SUCCESS\n");
    }

}
main ()
{

    BOOL success = TRUE;
    DWORD esp, espAfter;
    esp = GetEspBeforeCalled();
    printf ("esp before StdCallFunctionToBeReplacedByPin %x\n", esp);
    StdCallFunctionToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: StdCallFunctionToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  StdCallFunctionToBeReplacedByPin %x\n", espAfter);

    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APPX ERROR: StdCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }


    esp = GetEspBeforeCalled();
    printf ("esp before StdCallFunction2ToBeReplacedByPin %x\n", esp);
    StdCallFunction2ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: StdCallFunction2ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  StdCallFunction2ToBeReplacedByPin %x\n", espAfter);

    if (funcChar1a != CHAR_VAL1)
    {
        printf ("APPX ERROR: StdCallFunction2ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2a != CHAR_VAL2)
    {
        printf ("APP ERROR: StdCallFunction2ToBeReplacedByPin was not passed in c1 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcInt1a != INT_VAL1)
    {
        printf ("APP ERROR: StdCallFunction2ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2a != INT_VAL2)
    {
        printf ("APP ERROR: StdCallFunction2ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }


    esp = GetEspBeforeCalled();
    printf ("esp before StdCallFunction3ToBeReplacedByPin %x\n", esp);
    StdCallFunction3ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: StdCallFunction3ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  StdCallFunction3ToBeReplacedByPin %x\n", espAfter);

    if (funcChar1b != CHAR_VAL1)
    {
        printf ("APPX ERROR: StdCallFunction3ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2b != CHAR_VAL2)
    {
        printf ("APP ERROR: StdCallFunction3ToBeReplacedByPin was not passed in c1 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcInt1b != INT_VAL1)
    {
        printf ("APP ERROR: StdCallFunction3ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2b != INT_VAL2)
    {
        printf ("APP ERROR: StdCallFunction3ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }
    
    if (success)
    {
        printf ("SUCCESS\n");
    }

}
main ()
{

    BOOL success = TRUE;
    DWORD esp, espAfter;
    int retVal1, retVal2, retVal3, retVal4, retVal5;
    funcChar1 = 0;
    funcChar2 = 0;
    funcInt1 = 0;
    funcInt2 = 0;
    funcChar3 = 0;
    esp = GetEspBeforeCalled();
    printf ("esp before DefaultCallFunctionToBeReplacedByPin %x\n", esp);
    retVal1 = DefaultCallFunctionToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2, CHAR_VAL3);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  DefaultCallFunctionToBeReplacedByPin %x\n", espAfter);

    if (retVal1 != RETVAL1)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin returned unexpected value %d\n", retVal1);
        success = FALSE;
    }
    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin was not passed in c2 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcChar3 != CHAR_VAL3)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c3 as expected, actual funcChar3 %c\n", funcChar3);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunctionToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }


    funcChar1 = 0;
    funcChar2 = 0;
    funcInt1 = 0;
    funcInt2 = 0;
    funcChar3 = 0;
    esp = GetEspBeforeCalled();
    printf ("esp before DefaultCallFunction2ToBeReplacedByPin %x\n", esp);
    retVal2 = DefaultCallFunction2ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2, CHAR_VAL3);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: DefaultCallFunction2ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  DefaultCallFunction2ToBeReplacedByPin %x\n", espAfter);

    if (retVal2 != RETVAL2)
    {
        printf ("APP ERROR: DefaultCallFunction2ToBeReplacedByPin returned unexpected value %d\n", retVal2);
        success = FALSE;
    }

    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APPX ERROR: DefaultCallFunction2ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction2ToBeReplacedByPin was not passed in c2 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcChar3 != CHAR_VAL3)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c3 as expected, actual funcChar3 %c\n", funcChar3);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction2ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction2ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }

    funcChar1 = 0;
    funcChar2 = 0;
    funcInt1 = 0;
    funcInt2 = 0;
    funcChar3 = 0;
    esp = GetEspBeforeCalled();
    printf ("esp before DefaultCallFunction3ToBeReplacedByPin %x\n", esp);
    retVal3 = DefaultCallFunction3ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2, CHAR_VAL3);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  DefaultCallFunction3ToBeReplacedByPin %x\n", espAfter);

    if (retVal3 != RETVAL3)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin returned unexpected value %d\n", retVal3);
        success = FALSE;
    }
    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin was not passed in c2 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcChar3 != CHAR_VAL3)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c3 as expected, actual funcChar3 %c\n", funcChar3);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction3ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }
    
    if (success)
    {
        printf ("SUCCESS\n");
    }


    funcChar1 = 0;
    funcChar2 = 0;
    funcInt1 = 0;
    funcInt2 = 0;
    funcChar3 = 0;
    esp = GetEspBeforeCalled();
    printf ("esp before DefaultCallFunction4ToBeReplacedByPin %x\n", esp);
    retVal4 = DefaultCallFunction4ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2, CHAR_VAL3);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  DefaultCallFunction4ToBeReplacedByPin %x\n", espAfter);

    if (retVal4 != RETVAL4)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin returned unexpected value %d\n", retVal4);
        success = FALSE;
    }
    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin was not passed in c2 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcChar3 != CHAR_VAL3)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c3 as expected, actual funcChar3 %c\n", funcChar3);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction4ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }
    
    if (success)
    {
        printf ("SUCCESS\n");
    }

    funcChar1 = 0;
    funcChar2 = 0;
    funcInt1 = 0;
    funcInt2 = 0;
    funcChar3 = 0;
    esp = GetEspBeforeCalled();
    printf ("esp before DefaultCallFunction5ToBeReplacedByPin %x\n", esp);
    retVal5 = DefaultCallFunction5ToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2, CHAR_VAL3);
    espAfter =  GetEspBeforeCalled();
    if (esp != espAfter)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin returned with bad stack\n");
        success = FALSE;
    }
    printf ("esp after  DefaultCallFunction5ToBeReplacedByPin %x\n", espAfter);

    if (retVal5 != RETVAL5)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin returned unexpected value %d\n", retVal5);
        success = FALSE;
    }

    if (funcChar1 != CHAR_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
        success = FALSE;
    }
    if (funcChar2 != CHAR_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c2 as expected, actual funcChar2 %c\n", funcChar2);
        success = FALSE;
    }
    if (funcChar3 != CHAR_VAL3)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in c3 as expected, actual funcChar3 %c\n", funcChar3);
        success = FALSE;
    }
    if (funcInt1 != INT_VAL1)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
        success = FALSE;
    }
    if (funcInt2 != INT_VAL2)
    {
        printf ("APP ERROR: DefaultCallFunction5ToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
        success = FALSE;
    }
    
    if (success)
    {
        printf ("SUCCESS\n");
    }

}