In my input (decoder) plugin, I use the following to call the base-class (MJInputSource, part of the SDK):
long nRetVal = CMJInputSource::Open(pFilename);
if (nRetVal != 0) return nRetVal;
Inside the MJInputSource, it does the following to create a reader interface and then open the file.
m_pReader = GetGeneralReader(pFilename);
if (m_pReader == NULL) { return -1; }
if (m_pReader->Open() == FALSE) { return -1; }
The GetGeneralReader works fine (it loads the JRReader.dll from the Media Center installation), but the Open fails with the following error:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
It appears this is a mismatch between the JRReader.lib provided in the SDK and the JRReader.dll provided with Media Center. In any case, since I am calling the base class and the base class is failing, the Input SDK is broken.
My Input SDK is the most recent version posted on the developer pages (I downloaded again to be certain), with files dated in September, 2005. My JRReader.dll is 11.0.123 (from Media Center 11.1.113) and is dated 12/23/2005.
I compile with the __cdecl calling convention normally; when I tried using __stdcall, the base-class instead bombs with the same error at the pFunction function call inside the GetGeneralReader function:
IGeneralReader * pReader = NULL;
if (g_dllReader.GetLibrary() != NULL)
{
GetGeneralReaderFunc pFunction = (GetGeneralReaderFunc) ::GetProcAddress(g_dllReader.GetLibrary(), "GetGeneralReader");
if (pFunction)
pReader = pFunction(pResourceName, JRREADER_TYPE_LOCAL_OR_INTERNET);
}