-
Notifications
You must be signed in to change notification settings - Fork 0
/
General.cpp
244 lines (202 loc) · 5.96 KB
/
General.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// rSDK demonstration release - www.aquadasoft.com
// Jamie McLaughlin and Jean Villy Edberg
// Send any queries or bug reports to [email protected]
// =====================================================================================
//
// The following routines are used internally by MMF, and should not need to be modified
//
// =====================================================================================
#include "common.h"
HINSTANCE hInstLib;
EXT_INIT()
// ============================================================================
//
// LIBRARY ENTRY & QUIT POINTS
//
// ============================================================================
// -----------------
// Entry points
// -----------------
// Usually you do not need to do any initialization here: it is preferable to
// do it in "Initialize" found in Edittime.cpp
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
{
conditionsInfos = getConditionInfos();
actionsInfos = getActionInfos();
expressionsInfos = getExpressionInfos();
ConditionJumps = getConditions();
ActionJumps = getActions();
ExpressionJumps = getExpressions();
switch (dwReason)
{
// DLL is attaching to the address space of the current process.
case DLL_PROCESS_ATTACH:
hInstLib = hDLL; // Store HINSTANCE
break;
// A new thread is being created in the current process.
case DLL_THREAD_ATTACH:
break;
// A thread is exiting cleanly.
case DLL_THREAD_DETACH:
break;
// The calling process is detaching the DLL from its address space.
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// -----------------
// Initialize
// -----------------
// Where you want to do COLD-START initialization.
// Called when the extension is loaded into memory.
//
extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet)
{
// No error
return 0;
}
// -----------------
// Free
// -----------------
// Where you want to kill and initialized data opened in the above routine
// Called just before freeing the DLL.
//
extern "C" int WINAPI DLLExport Free(mv _far *mV)
{
// No error
return 0;
}
// ============================================================================
//
// GENERAL INFO
//
// ============================================================================
// -----------------
// Get Infos
// -----------------
//
extern "C"
{
DWORD WINAPI DLLExport GetInfos(int info)
{
switch (info)
{
case KGI_VERSION:
return EXT_VERSION2;
case KGI_PLUGIN:
return EXT_PLUGIN_VERSION1;
case KGI_PRODUCT:
return ForVersion;
case KGI_BUILD:
return MinimumBuild;
default:
return 0;
}
}
}
// ----------------------------------------------------------
// GetRunObjectInfos
// ----------------------------------------------------------
// Fills an information structure that tells MMF2 everything
// about the object, its actions, conditions and expressions
//
short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr)
{
infoPtr->conditions = (LPBYTE)ConditionJumps;
infoPtr->actions = (LPBYTE)ActionJumps;
infoPtr->expressions = (LPBYTE)ExpressionJumps;
infoPtr->numOfConditions = Conditions.size();
infoPtr->numOfActions = Actions.size();
infoPtr->numOfExpressions = Expressions.size();
infoPtr->editDataSize = sizeof(EDITDATA);
MagicFlags(infoPtr->editFlags);
infoPtr->windowProcPriority = WINDOWPROC_PRIORITY;
MagicPrefs(infoPtr->editPrefs);
infoPtr->identifier = IDENTIFIER;
infoPtr->version = VERSION;
return TRUE;
}
// ----------------------------------------------------------
// GetDependencies
// ----------------------------------------------------------
// Returns the name of the external modules that you wish MMF to include
// with stand-alone applications (these modules must be in the MMF
// Data\Runtime folder).
//
LPCSTR* WINAPI DLLExport GetDependencies()
{
// Do some rSDK stuff
#include "rGetDependencies.h"
//LPCSTR szDep[] = {
// "MyDll.dll",
// NULL
//};
return NULL; // szDep;
}
// -----------------
// LoadObject
// -----------------
// Routine called for each object when the object is read from the MFA file (edit time)
// or from the CCN or EXE file (run time).
// You can load data here, reserve memory etc...
//
int WINAPI DLLExport LoadObject(mv _far *mV, LPCSTR fileName, LPEDATA edPtr, int reserved)
{
return 0;
}
// -----------------
// UnloadObject
// -----------------
// The counterpart of the above routine: called just before the object is
// deleted from the frame.
//
void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved)
{
}
// --------------------
// UpdateEditStructure
// --------------------
// For you to update your object structure to newer versions
// Called at both edit time and run time
//
HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr)
{
// We do nothing here
return 0;
}
// --------------------
// UpdateFileNames
// --------------------
// If you store file names in your datazone, they have to be relocated when the
// application is moved to a different directory: this routine does it.
// Called at edit time and run time.
//
// Call lpfnUpdate to update your file pathname (refer to the documentation)
//
void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR))
{
}
// ---------------------
// EnumElts
// ---------------------
//
// Uncomment this function if you need to store an image in the image bank.
//
// Note: do not forget to enable the function in the .def file
// if you remove the comments below.
//
/*
int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2)
{
int error = 0;
// Replace wImgIdx with the name of the WORD variable you create within the edit structure
// Enum images
if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 )
{
// Undo enum images
undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2);
}
return error;
}
*/