00001
00006 #include "../dllkit/dllkit.h"
00007 #include "../usrmsgs.h"
00008 #include <stdio.h>
00009 #include <tchar.h>
00010
00012 HANDLE hThisModule;
00014 MSGLIST Msgs;
00017 INITDLLSTRUCT info;
00018
00020 BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call,
00021 LPVOID lpReserved)
00022 {
00023
00024 hThisModule = hModule;
00025 switch (ul_reason_for_call) {
00026 case DLL_PROCESS_ATTACH:
00027
00028 CreateMsgList(&Msgs, 1);
00029 break;
00030 case DLL_PROCESS_DETACH:
00031
00032 FreeMsgList(&Msgs);
00033 break;
00034 }
00035 return TRUE;
00036 }
00037
00041 DLLEXPORT void __cdecl InitDll(INITDLLSTRUCT* ids, INITDLLINFO* idi)
00042 {
00043
00044 AddMessage(Msgs, WM_COMMAND);
00045
00046
00047 info.CSMemory = ids->CSMemory;
00048 info.hInst = ids->hInst;
00049 info.hWnd = ids->hWnd;
00050 info.memory = ids->memory;
00051 info.memgetb = ids->memgetb;
00052 info.memsetb = ids->memsetb;
00053 info.optional = ids->optional;
00054 info.hTb = ids->hTb;
00055
00056
00057
00058
00059
00060 idi->iolo = IOLO + 21;
00061 idi->iohi = IOLO + 30;
00062 idi->msglist = Msgs;
00063 }
00064
00068 DLLEXPORT void __cdecl OnMessage(MESSAGEDLLSTRUCT* mds)
00069 {
00070 int wmId, wmEvent;
00071
00072 switch (mds->message) {
00073 case WM_COMMAND:
00074 wmId = LOWORD(mds->wParam);
00075 wmEvent = HIWORD(mds->wParam);
00076 switch (wmId) {
00077 case IDM_START:
00078 Running = TRUE;
00079 break;
00080 case IDM_END:
00081 Running = FALSE;
00082 break;
00083 }
00084 break;
00085 }
00086
00087 }
00088
00090 #define IOSETGET(GVAR, SVAR) \
00091 if (mode == IOREAD) { \
00092 *data = GVAR; \
00093 } \
00094 else { \
00095 SVAR = *data; \
00096 }
00097
00098
00102 DLLEXPORT void __cdecl IOFunc(UINT adr, unsigned char* data, iomode mode)
00103 {
00104 switch (adr) {
00105 case IOLO + 21:
00106 if (mode == IOREAD) {
00107
00108 }
00109 else {
00110
00111 }
00112 break;
00113 }
00114 }
00115