summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow16/ddeml/tests/ddestrs/ddestrs.h
blob: 192a2c3a9d52bc9bb18ef0a64b510ddeb563fca9 (plain) (blame)
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#ifdef WIN16

typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;

#define GETCURRENTTHREADID() 1

#else

#define GETCURRENTTHREADID() GetCurrentThreadId()

#endif

#define WHITE			  RGB(255,255,255)
#define GREEN			  RGB(0,128,128)
#define GREY			  RGB(192,192,192)
#define TOPIC			  "Test"

extern HANDLE hExtraMem;

#ifdef WIN32
#define PNT_INTERVAL 60000
#else
#define PNT_INTERVAL 30000
#endif

#define _5SEC			  5000 // milliseconds
#define _1MIN			  1
#define _1HOUR			  60
#define _1DAY			  1440
#define _1WEEKEND		  4320
#define _1WEEK			  10080
#define SERVER			  0
#define CLIENT			  1

#ifdef WIN16
#define NUM_FORMATS		  5
#else
#define NUM_FORMATS		  6
#endif

// The below offsets are used with Set/GetThreadLong()	   "THREAD"
// Offset defines cannot be interchanged between window
// and thread use because of collisions.

#define OFFSET_IDINST		  0
#define OFFSET_HCONVLIST	  4
#define OFFSET_CSERVERCONVS	  8
#define OFFSET_HSERVERCONVS	 12
#define OFFSET_HAPPOWNED	 16
#define OFFSET_CCLIENTCONVS	 20
#define OFFSET_HWNDDISPLAY	 24
#define OFFSET_CLIENTTIMER	 28
#define OFFSET_SERVERTIMER	 32
#define DELAY_METRIC		 2

#define EXTRA_THREAD_MEM	 OFFSET_SERVERTIMER+4
#define S2L(s)	 (LONG)(MAKELONG((WORD)(s),0))

// The below offsets are used with Set/GetWindowLong()	  "WINDOW"

#define OFFSET_FLAGS		  0
#define OFFSET_RUNTIME		  4
#define OFFSET_STARTTIME_SEC	  8
#define OFFSET_STARTTIME_MIN	  12
#define OFFSET_STARTTIME_HOUR	  16
#define OFFSET_STARTTIME_DAY	  20
#define OFFSET_LAST_MIN 	  24
#define OFFSET_LAST_HOUR	  28
#define OFFSET_TIME_ELAPSED	  32
#define OFFSET_DELAY		  36
#define OFFSET_STRESS		  40
#define OFFSET_SERVER_CONNECT	  44
#define OFFSET_CLIENT_CONNECT	  48
#define OFFSET_CLIENT		  52
#define OFFSET_SERVER		  56

#define OFFSET_THRDMAIN 	  60	  // <== ***
#define OFFSET_THRD2		  64	  // <== *** Ordering here is relied
#define OFFSET_THRD3		  68	  // <== *** upon in the test.	Keep
#define OFFSET_THRD4		  72	  // <== *** This group of values
#define OFFSET_THRD5		  76	  // <== *** in sequential order.
#define OFFSET_THRDMID		  80	  // <== ***
#define OFFSET_THRD2ID		  84	  // <== ***
#define OFFSET_THRD3ID		  88	  // <== ***
#define OFFSET_THRD4ID		  92	  // <== ***
#define OFFSET_THRD5ID		  96	  // <== ***
#define OFFSET_THRD2EVENT	  100	  // <== ***
#define OFFSET_THRD3EVENT	  104	  // <== ***
#define OFFSET_THRD4EVENT	  108	  // <== ***
#define OFFSET_THRD5EVENT	  112	  // <== ***

#define OFFSET_CRITICALSECT	  116
#define OFFSET_THRDCOUNT	  120
#define OFFSET_EXTRAMEM 	  124
#define OFFSET_DISPWNDHEIGHT	  128
#define OFFSET_BASE_DELAY	  132
#define OFFSET_MEM_ALLOCATED	  136

#define WND			  OFFSET_MEM_ALLOCATED+4

#define ID_OFFSET		  20
#define INC			  1
#define DEC			  0
#define STP			  2
#define PNT			  3
#define ALL			  -1

#define ON			  1
#define OFF			  0

#define AT_SWITCH		  1
#define AT_FILE 		  2
#define AT_STRESS		  3
#define AT_DELAY		  4
#define AT_TIME 		  5
#define AT_WND			  6
#define AT_MSG			  7
#define AT_FORMAT		  8
#define AT_THRD 		  9

#define FLAG_BACKGROUND 	  0x00000001
#define FLAG_AUTO		  0x00000002
#define FLAG_TIME		  0x00000004
#define FLAG_STOP		  0x00000008
#define FLAG_LOG		  0x00000010
#define FLAG_USRWNDCOUNT	  0x00000020
#define FLAG_USRMSGCOUNT	  0x00000040
#define FLAG_USRDELAY		  0x00000080
#define FLAG_DEBUG		  0x00000100
#define FLAG_CHARINFO		  0x00000200
#define FLAG_DELAYON		  0x00000400
#define FLAG_TEST_MSG_ON	  0x00000800
#define FLAG_MSGDELAYON 	  0x00001000
#define FLAG_APPOWNED		  0x00002000
#define FLAG_MULTTHREAD 	  0x00004000

#define FLAG_THRD2		  0x00008000
#define FLAG_THRD3		  0x00010000
#define FLAG_THRD4		  0x00020000
#define FLAG_THRD5		  0x00040000

#define FLAG_NET		  0x00080000
#define FLAG_SYNCPAINT		  0x00100000
#define FLAG_USRTHRDCOUNT	  0x00200000
#define FLAG_PAUSE_BUTTON	  0X00400000
#define FLAG_PAUSE		  0X00800000

#define THREADLIMIT		  5

#define STD_EXIT		  1
#define ABNORMAL_EXIT		  0

#define FLAGON(a,b)		  (LONG)(a|b)
#define FLAGOFF(a,b)		  (LONG)(a&(~b))

//#define MAX_SERVER_HCONVS   1000
#define MAX_SERVER_HCONVS   500

#define IDR_ICON    1
#define IDR_MENU    2
#define IDM_DIE     100

#define DIGITS_IN_TENMILL 8
#define BLANK_SPACE    3
#define LONGEST_LINE 15

#define NUM_COLUMNS (LONGEST_LINE+BLANK_SPACE+DIGITS_IN_TENMILL)
#define NUM_ROWS    16
#define MAX_TITLE_LENGTH 100

#define TXT	  0
#define DIB	  1
#define BITMAP	  2
#define ENHMETA   3
#define METAPICT  4
#define PALETTE   5

#define EXIT_THREAD  WM_USER+6
#define START_DISCONNECT WM_USER+7

#include "globals.h"

/*
 * Prototypes
 */

/*
 * ddestrs.c
 */

LONG FAR PASCAL MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LONG lParam);

VOID InitArgsError(HWND,unsigned);
VOID SysTime(LPSYSTEMTIME);
BOOL ParseCommandLine(HWND,LPSTR);
int SetupArgv( char **, char *, LPSTR);
BOOL PASCAL get_cmd_arg(HWND,LPSTR);
BOOL IsTimeExpired(HWND);

INT DIV(INT,INT);

BOOL TStrCmp(LPSTR,LPSTR);
LPSTR TStrCpy(LPSTR,LPSTR);
LPSTR TStrCat(LPSTR,LPSTR);
INT TStrLen(LPSTR);

LPSTR FAR PASCAL itola(int,LPSTR);
int APIENTRY latoi(LPSTR);

BOOL DOut(HWND,LPSTR,LPSTR,INT);
BOOL EOut(LPSTR);


#ifdef WIN32
BOOL ThreadShutdown(VOID);
BOOL ThreadDisconnect(VOID);
#endif

#define DDEMLERROR(a) EOut(a)
#define LOGDDEMLERROR(a) EOut(a)


/*
 * client.c
 */

void CALLBACK TimerFunc(HWND,UINT,UINT,DWORD);
VOID PaintClient(HWND hwnd, PAINTSTRUCT *pps);
VOID ReconnectList(VOID);
BOOL InitClient(VOID);
VOID CloseClient(VOID);

/*
 * server.c
 */

HDDEDATA RenderHelp_Text(HDDEDATA hData);
BOOL PokeTestItem_Text(HDDEDATA hData);
HDDEDATA RenderTestItem_Text(HDDEDATA hData);
BOOL PokeTestItem_DIB(HDDEDATA hData);
HDDEDATA RenderTestItem_DIB(HDDEDATA hData);
BOOL PokeTestItem_BITMAP(HDDEDATA hData);
HDDEDATA RenderTestItem_BITMAP(HDDEDATA hData);
BOOL PokeTestItem_METAPICT(HDDEDATA hData);
HDDEDATA RenderTestItem_METAPICT(HDDEDATA hData);
BOOL PokeTestItem_ENHMETA(HDDEDATA hData);
HDDEDATA RenderTestItem_ENHMETA(HDDEDATA hData);
BOOL PokeTestItem_PALETTE(HDDEDATA hData);
HDDEDATA RenderTestItem_PALETTE(HDDEDATA hData);
HINSTANCE GetHINSTANCE(HWND);

BOOL Execute(HDDEDATA hData);
VOID PaintServer(HWND hwnd, PAINTSTRUCT *pps);
HDDEDATA FAR PASCAL CustomCallback(UINT wType, UINT wFmt, HCONV hConv, HSZ hsz1,
	HSZ hsz2, HDDEDATA hData, DWORD dwData1, DWORD dwData2);

#ifdef WIN32
VOID ThreadWait(HWND);
DWORD SecondaryThreadMain(DWORD);
BOOL ThreadInit(HWND);
#endif

LONG SetFlag(HWND,LONG,INT);
LONG SetCount(HWND,INT,LONG,INT);
LPSTR GetMem(INT, LPHANDLE);
BOOL FreeMem(HANDLE);
BOOL FreeMemHandle(HANDLE);
HANDLE GetMemHandle(INT);
LONG SetThreadLong(DWORD,INT,LONG);
LONG GetThreadLong(DWORD,INT);
BOOL FreeThreadExtraMem(void);
BOOL CreateThreadExtraMem(INT,INT);
BOOL InitThreadInfo(DWORD);
BOOL FreeThreadInfo(DWORD);
INT IDtoTHREADNUM(DWORD);
HWND CreateDisplayWindow(HWND,INT);
LONG GetCurrentCount(HWND,INT);