mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
25 lines
535 B
C
25 lines
535 B
C
|
#include "ThTypes.h"
|
||
|
|
||
|
HANDLE MMFHandle = 0;
|
||
|
TGlobalDLLData *GlobalData = NULL;
|
||
|
|
||
|
void ThTypes_Init()
|
||
|
{
|
||
|
if (!MMFHandle)
|
||
|
MMFHandle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(TGlobalDLLData), "GoldenDictTextOutHookSharedMem");
|
||
|
if (!GlobalData)
|
||
|
GlobalData = MapViewOfFile(MMFHandle, FILE_MAP_ALL_ACCESS, 0, 0, 0);
|
||
|
}
|
||
|
|
||
|
void Thtypes_End()
|
||
|
{
|
||
|
if (GlobalData) {
|
||
|
UnmapViewOfFile(GlobalData);
|
||
|
GlobalData = NULL;
|
||
|
}
|
||
|
if (MMFHandle) {
|
||
|
CloseHandle(MMFHandle);
|
||
|
MMFHandle = 0;
|
||
|
}
|
||
|
}
|