You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.3 KiB
89 lines
2.3 KiB
/*
|
|
* Copyright 2002-2019 Intel Corporation.
|
|
*
|
|
* This software is provided to you as Sample Source Code as defined in the accompanying
|
|
* End User License Agreement for the Intel(R) Software Development Products ("Agreement")
|
|
* section 1.L.
|
|
*
|
|
* This software and the related documents are provided as is, with no express or implied
|
|
* warranties, other than those that are expressly stated in the License.
|
|
*/
|
|
|
|
|
|
#include <windows.h>
|
|
#include <stdio.h>
|
|
#include "probe_stdcall_fastcall.h"
|
|
|
|
DWORD GetEspBeforeCalled(void);
|
|
|
|
#define EXPORT_SYM __declspec( dllexport )
|
|
|
|
|
|
int dummyVar;
|
|
|
|
EXPORT_SYM DummyFunc1()
|
|
{
|
|
dummyVar = 1;
|
|
}
|
|
|
|
char funcChar1 = 0, funcChar2 = 0;
|
|
char funcInt1 = 0, funcInt2 = 0;
|
|
EXPORT_SYM void WINAPI StdCallFunctionToBeReplacedByPin( char c1,
|
|
int num1,
|
|
char c2,
|
|
int num2)
|
|
|
|
|
|
{
|
|
funcChar1 = c1;
|
|
funcChar2 = c2;
|
|
funcInt1 = num1;
|
|
funcInt2 = num2;
|
|
}
|
|
|
|
EXPORT_SYM Dummyfunc()
|
|
{
|
|
dummyVar = 2;
|
|
}
|
|
main ()
|
|
{
|
|
|
|
BOOL success = TRUE;
|
|
DWORD esp;
|
|
esp = GetEspBeforeCalled();
|
|
StdCallFunctionToBeReplacedByPin (CHAR_VAL1, INT_VAL1, CHAR_VAL2, INT_VAL2);
|
|
if (esp != GetEspBeforeCalled())
|
|
{
|
|
printf ("APP ERROR: StdCallFunctionToBeReplacedByPin returned with bad stack\n");
|
|
success = FALSE;
|
|
}
|
|
|
|
|
|
|
|
if (funcChar1 != CHAR_VAL1+CHAR_ADD_VAL1)
|
|
{
|
|
printf ("APPX ERROR: StdCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar1 %c\n", funcChar1);
|
|
success = FALSE;
|
|
}
|
|
if (funcChar2 != CHAR_VAL2+CHAR_ADD_VAL2)
|
|
{
|
|
printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in c1 as expected, actual funcChar2 %c\n", funcChar2);
|
|
success = FALSE;
|
|
}
|
|
if (funcInt1 != INT_VAL1+INT_ADD_VAL1)
|
|
{
|
|
printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in num1 as expected, actual funcInt1 %d\n", funcInt1);
|
|
success = FALSE;
|
|
}
|
|
if (funcInt2 != INT_VAL2+INT_ADD_VAL2)
|
|
{
|
|
printf ("APP ERROR: StdCallFunctionToBeReplacedByPin was not passed in num2 as expected, actual funcInt2 %d\n", funcInt2);
|
|
success = FALSE;
|
|
}
|
|
|
|
if (success)
|
|
{
|
|
printf ("SUCCESS\n");
|
|
}
|
|
|
|
} |