When my code (below) is executed, a error message is triggered which says "The operation completed successfully." To give this some context, hFileMap is valid; I have checked this with my debugger, and other operations can easily be performed correctly on this handle that yield correct results. The only weird thing is that MapViewOfFile returns a null pointer. Since I use this memory mapped file as a way of communicating between two applications, this function is critical. Please note that I am no beginner to coding, and this same program successfully implements multi-threading as well as on-the-fly (dynamic) function creation (also called reflection) for its scripting engine.
static char *Buff = NULL;
static HANDLE hFileMap;
int jointCount = 0;
int startingBone = msModel_GetBoneCount(pModel);
msBone *currentBone = NULL;
UINT_PTR threadId;
int value = 10;
hFileMap = OpenFileMapping(PAGE_READONLY, true, "animationMemFileClientOut");
if (hFileMap == NULL)
{
msModel_Destroy(pModel);
return 0;
}
char* buffer = (char *)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, 0);
if (buffer == NULL)
{
DWORD pMessage = GetLastError();
buffer = new char[128];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
(LPCVOID)pMessage,
0,
0,
buffer,
128,
NULL);
MessageBox(NULL, (LPCSTR)buffer, "Error", MB_OK);
}