Originally Posted by
iMalc
If it's not valid for dsect to be NULL then it should be passed by reference instead.
What is a Tstring? Is that something you made yourself? If so, my money's on the problem being in that.
"caught" is spelt with an h
The DLL functions are extern "C" functions, so that part has to pass by pointers.
Code:
typedef std::basic_string<TCHAR> Tstring;
Originally Posted by
MacGyver
Code:
EXIT_INITTERM_DSECT dsect;
GetEXIT_INITTERM_DSECT( dsect ); // Populate dsect with some data.
I'm guessing dsect is being passed by reference here or it's really a macro of some sort. Otherwise, this is kind of pointless.
Is pXINIT typedef'ed as this:
Code:
typedef unsigned int (*pXINIT)(EXIT_INITTERM_DSECT*);
Yes, GetEXIT_INITTERM_DSECT() takes a reference to dsect, and that's the typedef I'm using for the DLL function pointer.
Code:
#ifdef _UNICODE
# define Strncpy_s wcsncpy_s
#else
# define Strncpy_s strncpy_s
#endif
void
GetEXIT_INITTERM_DSECT( EXIT_INITTERM_DSECT& dsect )
{
dsect.EXIT_EXIT_NUMBER = 1;
Strncpy_s( dsect.EXIT_INIT_COMPUTER_NAME, (sizeof(dsect.EXIT_INIT_COMPUTER_NAME) / sizeof(TCHAR)),
_T("Computer_Name"), (sizeof(dsect.EXIT_INIT_COMPUTER_NAME) / sizeof(TCHAR)) );
Strncpy_s( dsect.EXIT_MESSAGE, (sizeof(dsect.EXIT_MESSAGE) / sizeof(TCHAR)),
_T("Message"), (sizeof(dsect.EXIT_MESSAGE) / sizeof(TCHAR)) );
dsect.EXIT_RETURN_CODE = 2;
dsect.EXIT_USER_FULLWORD = 3;
dsect.EXIT_VERSION = 4;
}