MsgHook Native library updates

MsgHook Native library works from native test application, still
introducing library to java side through jni.
This commit is contained in:
Edward Jakubowski
2014-05-23 06:50:49 -04:00
parent 1721d2a130
commit b5ede5e6cb
28 changed files with 304 additions and 52 deletions

View File

@@ -19,9 +19,10 @@ BOOL APIENTRY DllMain( HMODULE hModule,
memset((void *)&szBaseName, '\0', sizeof(TCHAR) * _MAX_FNAME);
if (GetModuleBaseName(GetCurrentProcess(), (HMODULE)hModule, szTmp, sizeof(szTmp)))// compute MMF-filename from current module base name, uses Psapi
_wsplitpath(szTmp, NULL, NULL, szBaseName, NULL);
_wsplitpath_s(szTmp, NULL, NULL, szBaseName, _MAX_FNAME, NULL, NULL, NULL, NULL);
//_wsplitpath(szTmp, NULL, NULL, szBaseName, NULL);
wcscat(szBaseName, TEXT("MsgHookSharedMem")); // add specifier string
wcscat_s(szBaseName, TEXT("MsgHookSharedMem")); // add specifier string
hMappedFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(GLOBALDATA), szBaseName);
pData = (GLOBALDATA*)MapViewOfFile(hMappedFile, FILE_MAP_WRITE, 0, 0, 0);
@@ -29,9 +30,10 @@ BOOL APIENTRY DllMain( HMODULE hModule,
if(bStartingProcess) // if the MMF doesn't exist, we have the first instance
{
pData->g_hInstance = hModule; // so set the instance handle
pData->g_hWnd = NULL; // and initialize the other handles
pData->g_hHook = NULL;
pData->g_hInstance = hModule; // so set the instance handle
pData->g_hWnd = NULL; // and initialize the other handles
pData->g_CwpHook = NULL;
pData->g_MsgHook = NULL;
}
DisableThreadLibraryCalls((HMODULE)hModule);
}