i have pass a nested structure into a dll function,
it return "Access Violation from the dll function.
Is my code have any problem ?
Thank you so much
What I have tried:
#define CM24_NUMDEPCASSETTE 24
typedef struct SNOTETYPE
{
char Notetype[6];
int NumNote;
}SNOTE;
struct SWITH
{
int OutNumber;
SNOTE Types[CM24_NUMDEPCASSETTE * 4];
};
typedef int (WINAPI*FNPTR) (SWITH RequestBankNot, SWITH WithdrawData);
FNPTR fnWithdraw = (FNPTR)GetProcAddress(Hinst, "InterDoWithdrawall");
if (fnWithdraw)
{
SWITH vWithdrawall, vWithdrallData;
vWithdrawall.OutNumber = 0;
vWithdrawall.Types.NumNote = 1;
strncpy_s(vWithdrawall.Types.Notetype, sizeof(vWithdrawall.Types.Notetype), "CPEA", sizeof(SNOTETYPE::Notetype));
vWithdrallData.OutNumber = 0;
vWithdrallData.Types.NumNote = 0;
int Result = fnWithdraw(vWithdrawall, vWithdrallData);
std::cout << "\nResult:\n", Result;
}