source: trunk/dll/datamin.c@ 1335

Last change on this file since 1335 was 1335, checked in by Steven Levine, 17 years ago

Ticket 26: Add exception handlers to all threads using xbeginthread

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.6 KB
RevLine 
[30]1
2/***********************************************************************
3
4 $Id: datamin.c 1335 2008-12-12 23:49:02Z stevenhl $
5
6 Minimized data bar
7
8 Copyright (c) 1993-98 M. Kimes
[1335]9 Copyright (c) 2001, 2008 Steven H. Levine
[30]10
[130]11 14 Sep 02 SHL Handle large partitions
12 16 Oct 02 SHL Handle large partitions better
13 23 May 05 SHL Use QWL_USER
[136]14 23 May 05 SHL Avoid delays for inaccessible drives
[162]15 25 May 05 SHL Use ULONGLONG and CommaFmtULL
[204]16 06 Jun 05 SHL Drop unused code
[346]17 22 Jul 06 SHL Check more run time errors
[552]18 02 Jan 07 GKY Changed drive information string formating to accomodate 6 char FS names
19 07 Jan 07 GKY Move error strings etc. to string file
[593]20 30 Mar 07 GKY Remove GetPString for window class names
[793]21 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[828]22 02 Sep 07 GKY Replaced DosQProcStatus with DosQuerySysState to fix trap in thunk code
[1335]23 10 Dec 08 SHL Integrate exception handler support
[30]24
25***********************************************************************/
26
[907]27#include <string.h>
28#include <ctype.h>
29#include <limits.h>
[1335]30// #include <process.h> // _beginthread
[907]31
[2]32#define INCL_DOS
[136]33#define INCL_DOSERRORS
[2]34#define INCL_WIN
35#define INCL_GPI
[162]36#define INCL_LONGLONG
[2]37
[1178]38#include "fm3dll.h"
[1222]39#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1206]40#include "info.h" // Data declaration(s)
41#include "notebook.h" // Data declaration(s)
42#include "inis.h" // Data declaration(s)
43#include "init.h" // Data declaration(s)
44#include "defview.h" // Data declaration(s)
[2]45#include "fm3dlg.h"
46#include "fm3str.h"
47#include "procstat.h"
[136]48#include "datamin.h"
[907]49#include "errutil.h" // Dos_Error...
50#include "strutil.h" // GetPString
[1156]51#include "commafmt.h" // CommaFmtUL
52#include "killproc.h" // KillDlgProc
53#include "sysinfo.h" // SysInfoDlgProc
54#include "mainwnd.h" // TopWindowName
[1178]55#include "commafmt.h" // CommaFmtUL
56#include "common.h" // OpenDirCnr
57#include "shadow.h" // OpenObject
58#include "chklist.h" // PopupMenu
59#include "presparm.h" // SetPresParams
60#include "undel.h" // UndeleteDlgProc
61#include "misc.h" // GetCmdSpec
62#include "wrappers.h" // xDosFindFirst
63#include "systemf.h" // runemf2
[1038]64#include "fortify.h"
[1335]65#include "excputil.h" // 06 May 08 SHL added
[2]66
[136]67APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
[2]68
[136]69static volatile HEV G_hevDataMin = NULLHANDLE;
70static volatile HWND G_hwndSingle = NULLHANDLE;
[2]71
[551]72static VOID dataminThread(VOID * pv);
[2]73
[1206]74// Data definitions
75#pragma data_seg(GLOBAL1)
76HWND DataHwnd;
77BOOL fDataInclRemote;
78BOOL fDataShowDrives;
79BOOL fDataToFore;
80BOOL fDullMin;
81
82#pragma data_seg(DATA2)
83
84static PSZ pszSrcFile = __FILE__;
85
[136]86long MINI_X = 208, MINI_Y = 16;
[2]87
[136]88//=== MiniTimeProc - time, swap and drive status mini windows procedure ===
[2]89
[136]90MRESULT EXPENTRY MiniTimeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
91{
92 APIRET rc;
[551]93
94 switch (msg) {
[136]95 case WM_CREATE:
96 {
[551]97 PVOID pv = xmalloc(sizeof(tDataMin), pszSrcFile, __LINE__);
[959]98 if (pv)
[1335]99 WinSetWindowPtr(hwnd, QWL_DATAMIN_PTR, pv);
[136]100 }
101 break;
[2]102
[136]103 case WM_BUTTON1CLICK:
104 {
105 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
106
[551]107 if (id >= MINI_DRIVEA) {
108 if (G_hevDataMin != NULLHANDLE) {
[136]109 G_hwndSingle = hwnd;
110 rc = DosPostEventSem(G_hevDataMin);
[551]111 if (rc) {
[1335]112 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
113 GetPString(IDS_POSTSEMFAILED));
[136]114 }
115 }
116 }
117 else if (id == MINI_TIME)
[551]118 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP6, // Up time
119 MPVOID, MPVOID);
[136]120 else if (id == MINI_PROC)
121 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]122 WM_SYSCOMMAND, MPFROM2SHORT(SC_TASKMANAGER, 0), MPVOID);
[136]123 }
124 break;
[2]125
[136]126 case WM_BUTTON1DBLCLK:
127 {
128 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
[2]129
[551]130 if (id >= MINI_DRIVEA && !hwndMain) {
[136]131 CHAR s[] = " :\\";
[2]132
[136]133 *s = (CHAR) (id - MINI_DRIVEA) + 'A';
[551]134 OpenDirCnr((HWND) 0, HWND_DESKTOP, (HWND) 0, FALSE, s);
[136]135 return MRFROMLONG(1L);
136 }
[551]137 else if (id == MINI_TIME) {
[136]138 OpenObject("<WP_CLOCK>",
[551]139 (SHORT2FROMMP(mp2) & KC_SHIFT) ? Default : Settings, hwnd);
[136]140 return MRFROMLONG(1L);
141 }
[2]142
143#ifdef NEVER
[551]144 else if (id == MINI_MEM) {
[136]145 WinDlgBox(HWND_DESKTOP,
146 HWND_DESKTOP,
[551]147 SysInfoDlgProc, FM3ModHandle, SYS_FRAME, NULL);
[136]148 return MRFROMLONG(1L);
149 }
[2]150#endif
151
[551]152 else if (id == MINI_PROC || id == MINI_MEM) {
[136]153 WinDlgBox(HWND_DESKTOP,
[551]154 hwnd, KillDlgProc, FM3ModHandle, KILL_FRAME, NULL);
[136]155 return MRFROMLONG(1L);
156 }
[551]157 else if (id == MINI_SWAP && *SwapperDat) {
[2]158
[136]159 char s[5];
[2]160
[136]161 strncpy(s, SwapperDat, 4);
162 s[3] = 0;
163 WinDlgBox(HWND_DESKTOP,
164 hwndMain,
[551]165 UndeleteDlgProc, FM3ModHandle, UNDEL_FRAME, MPFROMP(s));
[136]166 return MRFROMLONG(1L);
[2]167 }
[136]168 }
169 break;
[2]170
[136]171 case WM_BUTTON1MOTIONSTART:
172 PostMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]173 UM_BUTTON1MOTIONSTART, MPVOID, MPVOID);
[136]174 break;
[2]175
[136]176 case WM_CONTEXTMENU:
[551]177 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_CONTEXTMENU, MPVOID, MPVOID);
[136]178 break;
[2]179
[136]180 case WM_PAINT:
181 {
182 MRESULT mr = 0;
183 USHORT id;
184
185 id = WinQueryWindowUShort(hwnd, QWS_ID);
[551]186 if (id >= MINI_DRIVEA) {
[136]187 HPS hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
[551]188
189 if (hps) {
[136]190 mr = WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]191 UM_PAINT, MPFROM2SHORT(id, 0), MPFROMLONG(hps));
[136]192 WinEndPaint(hps);
[551]193 return mr; // Bypass default paint
[136]194 }
195 }
196 }
197 break;
[2]198
[551]199 case WM_DESTROY:
200 {
201 PVOID pv = WinQueryWindowPtr(hwnd, QWL_DATAMIN_PTR);
202
[1009]203 xfree(pv, pszSrcFile, __LINE__);
[551]204 }
205 break;
[2]206 }
[136]207 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]208
[551]209} // MiniTimeProc
[2]210
[136]211//=== DataProc - databar client window procedure ===
[2]212
[136]213MRESULT EXPENTRY DataProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
214{
215 APIRET rc;
216
[2]217 static ULONG counter;
[136]218 static BOOL NoFloat, noqproc = FALSE, Positioned;
[551]219 static HWND hwndMenu = (HWND) 0;
[2]220
[551]221 switch (msg) {
[136]222 case WM_CREATE:
[377]223 if (DataHwnd) {
[551]224 WinSetWindowPos(DataHwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_SHOW);
[136]225 return MRFROMLONG(1L);
226 }
227 DataHwnd = WinQueryWindow(hwnd, QW_PARENT);
228 NoFloat = FALSE;
229 Positioned = FALSE;
230 SetPresParams(hwnd,
[551]231 &RGBGREY, &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVTEXT));
[136]232 {
233 int c;
234 long x = 3;
[551]235 USHORT ids[] = { MINI_TIME, MINI_MEM, MINI_SWAP, MINI_PROC, 0 };
[136]236 POINTL aptl[TXTBOX_COUNT];
237 HPS hps;
238
239 hps = WinGetPS(hwnd);
[551]240 if (hps) {
[136]241 GpiQueryTextBox(hps,
242 34,
243 " -=03:08:22 SMW 1998/08/02=- ",
[551]244 TXTBOX_COUNT, aptl);
[136]245 WinReleasePS(hps);
246 MINI_X = aptl[TXTBOX_TOPRIGHT].x + 6;
247 MINI_Y = aptl[TXTBOX_TOPRIGHT].y + 6;
[2]248 }
[551]249 for (c = 0; ids[c]; c++) {
[377]250 if (!WinCreateWindow(hwnd,
[593]251 WC_MINITIME,
[551]252 NullStr,
253 SS_TEXT | DT_CENTER | DT_VCENTER | WS_VISIBLE,
254 x,
255 3,
256 MINI_X,
257 MINI_Y, hwnd, HWND_TOP, ids[c], NULL, NULL)) {
258 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
[377]259 }
[136]260 x += (MINI_X + 4);
[2]261 }
[136]262 }
[551]263 if (!hwndMain) {
[136]264 SWCNTRL swctl;
[2]265
[136]266 memset(&swctl, 0, sizeof(swctl));
267 swctl.hwnd = WinQueryWindow(hwnd, QW_PARENT);
268 swctl.uchVisibility = SWL_VISIBLE;
269 swctl.fbJump = (fDataToFore) ? SWL_NOTJUMPABLE : SWL_JUMPABLE;
270 swctl.bProgType = PROG_PM;
[551]271 strcpy(swctl.szSwtitle, GetPString(IDS_DATABARTITLETEXT));
272 WinCreateSwitchEntry(WinQueryAnchorBlock(hwnd), &swctl);
[136]273 }
[551]274 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
[136]275 return 0;
[2]276
[136]277 case WM_MENUEND:
278 NoFloat = FALSE;
[551]279 if (hwndMenu == (HWND) mp2) {
[136]280 WinDestroyWindow(hwndMenu);
[551]281 hwndMenu = (HWND) 0;
[136]282 }
283 break;
284
285 case UM_RESTORE:
286 WinSetWindowPtr(hwnd, QWL_USER, mp1);
287 return 0;
288
289 case UM_SETUP:
290 {
291 long x, y;
292 SWP swp, swpD;
293 int c;
294 ULONG size = sizeof(SWP);
295 ULONG numdrives = 0;
296 ULONG drivestyle = (DRIVE_REMOVABLE | DRIVE_INVALID |
[553]297 DRIVE_IGNORE | DRIVE_ZIPSTREAM | DRIVE_NOSTATS);
[136]298 ULONG ulDriveNum, ulDriveMap;
299
300 if (!fDataInclRemote)
[553]301 drivestyle |= DRIVE_REMOTE || DRIVE_VIRTUAL || DRIVE_RAMDISK;
[551]302 if (fDataShowDrives) {
[136]303 DosError(FERR_DISABLEHARDERR);
304 DosQCurDisk(&ulDriveNum, &ulDriveMap);
305 x = 3;
306 y = MINI_Y + 4;
307 // Drive status windows
[551]308 for (c = 2; c < 26; c++) {
309 if ((ulDriveMap & (1L << c)) && !(driveflags[c] & drivestyle)) {
[377]310 if (!WinCreateWindow(hwnd,
[593]311 WC_MINITIME,
[551]312 NullStr,
313 SS_TEXT | DT_CENTER | DT_VCENTER |
314 WS_VISIBLE, x, y, MINI_X, MINI_Y, hwnd,
315 HWND_TOP, MINI_DRIVEA + c, NULL, NULL)) {
316 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__,
317 IDS_WINCREATEWINDOW);
[377]318 }
[136]319 numdrives++;
320 x += (MINI_X + 4);
[551]321 if ((numdrives % 4) == 0) {
[136]322 y += (MINI_Y + 4);
323 x = 3;
324 }
325 }
326 }
[2]327 }
[136]328 x = (MINI_X * 4) + 18;
329 y = (MINI_Y + 4) + ((numdrives / 4) * (MINI_Y + 4)) +
330 (((numdrives % 4) != 0) * (MINI_Y + 4));
[551]331 if (!Positioned) {
332 if (PrfQueryProfileData(fmprof, appname, "DataMinPos", &swp, &size)) {
[136]333 WinQueryWindowPos(HWND_DESKTOP, &swpD);
334 if (swp.x > swpD.cx - 16)
335 swp.x = swpD.cx - 16;
336 if (swp.y > swpD.cy - 16)
337 swp.y = swpD.cy - 16;
338 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
339 HWND_TOP,
340 swp.x,
341 swp.y,
[551]342 x, y, SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER);
[136]343 }
344 else
345 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
346 HWND_TOP,
347 0,
348 0,
[551]349 x, y, SWP_SHOW | SWP_SIZE | SWP_MOVE | SWP_ZORDER);
[136]350 Positioned = TRUE;
351 }
352 else
353 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
354 HWND_TOP,
[551]355 0, 0, x, y, SWP_SHOW | SWP_SIZE | SWP_ZORDER);
356 WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
[136]357 if (numdrives) {
[1335]358 if (xbeginthread(dataminThread,
359 32768,
360 (PVOID)hwnd,
361 pszSrcFile,
362 __LINE__) == -1)
363 {
[551]364 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[136]365 }
366 }
367 counter = 0;
[551]368 PostMsg(hwnd, UM_TIMER, MPVOID, MPVOID);
[136]369 }
[551]370 return 0; // UM_SETUP
[136]371
372 case WM_BUTTON1DBLCLK:
373 if (hwndMain)
[551]374 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[136]375 break;
376
377 case UM_CONTEXTMENU:
378 case WM_CONTEXTMENU:
379 if (!hwndMenu)
[551]380 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MINI_FRAME);
381 if (hwndMenu) {
382 WinCheckMenuItem(hwndMenu, MINI_FLOAT, fDataToFore);
383 WinCheckMenuItem(hwndMenu, MINI_SHOW, fDataShowDrives);
384 WinCheckMenuItem(hwndMenu, MINI_BORING, fDullMin);
385 WinCheckMenuItem(hwndMenu, MINI_INCLREMOTE, fDataInclRemote);
[136]386 NoFloat = TRUE;
[551]387 if (!PopupMenu(hwnd, hwnd, hwndMenu))
[136]388 NoFloat = FALSE;
389 }
390 if (msg == UM_CONTEXTMENU)
[2]391 return 0;
[136]392 break;
[2]393
[136]394 case WM_BUTTON2DBLCLK:
[551]395 if (!(SHORT2FROMMP(mp2) & KC_SHIFT)) {
396 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_FLOAT, 0), MPVOID);
[2]397 break;
[136]398 }
399 /* else intentional fallthru */
400 case WM_CHORD:
401 case WM_BUTTON3DBLCLK:
[551]402 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_SHOW, 0), MPVOID);
[136]403 break;
[2]404
[136]405 case UM_BUTTON1MOTIONSTART:
406 case WM_BUTTON1MOTIONSTART:
407 {
408 TRACKINFO TrackInfo;
409 SWP Position;
[2]410
[136]411 memset(&TrackInfo, 0, sizeof(TrackInfo));
412 TrackInfo.cxBorder = 1;
413 TrackInfo.cyBorder = 1;
414 TrackInfo.cxGrid = 1;
415 TrackInfo.cyGrid = 1;
416 TrackInfo.cxKeyboard = 8;
417 TrackInfo.cyKeyboard = 8;
418 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &Position);
419 TrackInfo.rclTrack.xLeft = Position.x;
420 TrackInfo.rclTrack.xRight = Position.x + Position.cx;
421 TrackInfo.rclTrack.yBottom = Position.y;
422 TrackInfo.rclTrack.yTop = Position.y + Position.cy;
423 WinQueryWindowPos(HWND_DESKTOP, &Position);
424 TrackInfo.rclBoundary.xLeft = Position.x;
425 TrackInfo.rclBoundary.xRight = Position.x + Position.cx;
426 TrackInfo.rclBoundary.yBottom = Position.y;
427 TrackInfo.rclBoundary.yTop = Position.y + Position.cy;
428 TrackInfo.ptlMinTrackSize.x = 0;
429 TrackInfo.ptlMinTrackSize.y = 0;
430 TrackInfo.ptlMaxTrackSize.x = Position.cx;
431 TrackInfo.ptlMaxTrackSize.y = Position.cy;
432 TrackInfo.fs = TF_MOVE | TF_STANDARD | TF_ALLINBOUNDARY;
[551]433 if (WinTrackRect(HWND_DESKTOP, (HPS) 0, &TrackInfo)) {
[136]434 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
435 HWND_TOP, TrackInfo.rclTrack.xLeft,
436 TrackInfo.rclTrack.yBottom, 0, 0, SWP_MOVE);
437 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
438 }
439 }
440 break;
[2]441
[136]442 case WM_HELP:
443 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
444 break;
445
446 case WM_COMMAND:
[551]447 switch (SHORT1FROMMP(mp1)) {
[136]448 case IDM_COMMANDLINE:
449 case IDM_DOSCOMMANDLINE:
450 case IDM_WINFULLSCREEN:
451 {
452 CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
453 INT type = SEPARATE | WINDOWED;
454
455 *path = 0;
[551]456 TopWindowName(hwnd, (HWND) 0, path);
[136]457 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
458 env = GetCmdSpec(TRUE);
[551]459 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
[136]460 env = "WINOS2.COM";
461 type = SEPARATE | FULLSCREEN;
462 }
[1335]463 runemf2(type, hwnd, pszSrcFile, __LINE__,
464 path, NULL, "%s", env);
[2]465 }
[136]466 break;
[2]467
[136]468 case IDM_HELP:
469 if (hwndHelp)
470 WinSendMsg(hwndHelp,
471 HM_DISPLAY_HELP,
[551]472 MPFROM2SHORT(HELP_DATABAR, 0), MPFROMSHORT(HM_RESOURCEID));
[2]473 break;
474
[136]475 case MINI_CLOSE:
[551]476 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]477 break;
478
[136]479 case MINI_BORING:
480 fDullMin = (fDullMin) ? FALSE : TRUE;
481 PrfWriteProfileData(fmprof,
[551]482 FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
483 if (G_hevDataMin != NULLHANDLE) {
[136]484 rc = DosPostEventSem(G_hevDataMin);
485 if (rc) {
[1335]486 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
487 GetPString(IDS_POSTSEMFAILED));
[136]488 }
[2]489 }
[136]490
[2]491 break;
492
[136]493 case MINI_INCLREMOTE:
494 case MINI_SHOW:
[551]495 if (SHORT1FROMMP(mp1) == MINI_SHOW) {
[136]496 fDataShowDrives = (fDataShowDrives) ? FALSE : TRUE;
497 PrfWriteProfileData(fmprof,
498 appname,
[551]499 "DataShowDrives", &fDataShowDrives, sizeof(BOOL));
[136]500 }
[551]501 else {
[136]502 fDataInclRemote = (fDataInclRemote) ? FALSE : TRUE;
503 PrfWriteProfileData(fmprof,
504 appname,
[551]505 "DataInclRemote", &fDataInclRemote, sizeof(BOOL));
[136]506 }
507 {
508 HENUM henum;
509 HWND hwndChild;
510 USHORT id;
[2]511
[136]512 henum = WinBeginEnumWindows(hwnd);
[551]513 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]514 id = WinQueryWindowUShort(hwndChild, QWS_ID);
515 if (id >= MINI_DRIVEA)
516 WinDestroyWindow(hwndChild);
517 }
518 WinEndEnumWindows(henum);
[2]519 }
[136]520 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
[2]521 break;
522
[136]523 case MINI_FLOAT:
524 fDataToFore = (fDataToFore) ? FALSE : TRUE;
525 PrfWriteProfileData(fmprof,
[551]526 appname, "DataToFore", &fDataToFore, sizeof(BOOL));
527 if (!hwndMain) {
[136]528
529 SWCNTRL swcntrl;
530 HSWITCH hswitch;
531
532 hswitch = (HSWITCH) WinQuerySwitchHandle(hwnd, (PID) 0);
[551]533 if (hswitch) {
[136]534 memset(&swcntrl, 0, sizeof(SWCNTRL));
[551]535 if (!WinQuerySwitchEntry(hswitch, &swcntrl)) {
[136]536 swcntrl.fbJump = (fDataToFore) ? SWL_NOTJUMPABLE : SWL_JUMPABLE;
[551]537 WinChangeSwitchEntry(hswitch, &swcntrl);
[136]538 }
539 }
540 }
[2]541 break;
[136]542 }
543 return 0;
[2]544
[136]545 case WM_SIZE:
546 WinSetWindowPos(hwnd,
547 HWND_TOP,
548 0,
549 0,
550 SHORT1FROMMP(mp2),
[551]551 SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE);
[136]552 break;
[2]553
[136]554 case WM_PAINT:
555 {
556 HPS hps;
557 POINTL ptl;
558 SWP swp;
559 RECTL rcl;
[2]560
[551]561 hps = WinBeginPaint(hwnd, (HPS) 0, &rcl);
562 if (hps) {
563 WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
[136]564 GpiSetMix(hps, FM_OVERPAINT);
565 GpiSetColor(hps, CLR_WHITE);
566 WinQueryWindowPos(hwnd, &swp);
567 ptl.x = 0;
568 ptl.y = 0;
569 GpiMove(hps, &ptl);
570 ptl.y = swp.cy - 1;
571 GpiLine(hps, &ptl);
572 ptl.x = swp.cx - 1;
573 GpiLine(hps, &ptl);
574 GpiSetColor(hps, CLR_DARKGRAY);
575 ptl.y = 0;
576 GpiLine(hps, &ptl);
577 ptl.x = 0;
578 GpiLine(hps, &ptl);
579 {
580 HENUM henum;
581 HWND hwndTemp;
[2]582
[136]583 henum = WinBeginEnumWindows(hwnd);
[551]584 while ((hwndTemp = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]585 PaintRecessedWindow(hwndTemp,
[551]586 hps, (WinQueryWindowUShort(hwndTemp, QWS_ID)
587 != MINI_TIME), FALSE);
[136]588 }
589 WinEndEnumWindows(henum);
590 }
591 WinEndPaint(hps);
592 }
593 }
594 return 0;
[2]595
[136]596 case UM_PAINT:
597 {
598 CHAR s[90];
599 CHAR szFreeQty[38];
600 CHAR szDrvLtr[] = " :";
601 CHAR *pszFSystem;
[162]602 ULONGLONG ullFreeQty;
[136]603 ULONG ulPercentFree;
604 ULONG wasx;
605 HPS hps = (HPS) mp2;
606 HWND hwndChild;
607 USHORT id;
608 SWP swp;
609 POINTL ptl;
610 tDataMin *pDM;
[2]611
[136]612 id = SHORT1FROMMP(mp1);
[551]613 if (id >= MINI_DRIVEA) {
[136]614 hwndChild = WinWindowFromID(hwnd, id);
615 if (!hwndChild)
616 return 0;
617 if (!WinQueryWindowPos(hwndChild, &swp))
618 return 0;
619 pDM = WinQueryWindowPtr(hwndChild, QWL_DATAMIN_PTR);
[551]620 if (!pDM || pDM->qfsi_rc) {
[162]621 ullFreeQty = 0;
[136]622 ulPercentFree = 0;
623 }
[551]624 else {
625 ullFreeQty = (ULONGLONG) pDM->fsa.cUnitAvail *
626 (pDM->fsa.cSectorUnit * pDM->fsa.cbSector);
[2]627
[551]628 ulPercentFree = (pDM->fsa.cUnit && pDM->fsa.cUnitAvail) ?
629 (pDM->fsa.cUnitAvail * 100) / pDM->fsa.cUnit : 0;
[136]630 }
[2]631
[551]632 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
633 *szDrvLtr = (CHAR) (id - MINI_DRIVEA) + 'A';
[2]634
[551]635 if (!pDM || pDM->qfsi_rc || pDM->qfsa_rc)
[136]636 pszFSystem = "N/A";
[551]637 else {
[689]638 pszFSystem = (PCHAR)(pDM->fsqb2.szName) + pDM->fsqb2.cbName + 1;
[136]639 pszFSystem[15] = 0;
640 }
641 sprintf(s,
[549]642 "%s %13s %lu%%-%s %6s ",
[136]643 szDrvLtr,
644 szFreeQty,
[551]645 ulPercentFree, GetPString(IDS_FREETEXT), pszFSystem);
[136]646 if (!hps)
647 hps = WinGetPS(hwndChild);
[551]648 if (hps) {
649 if (!fDullMin) {
[136]650 ptl.x = 0;
651 ptl.y = 0;
[551]652 GpiMove(hps, &ptl);
653 GpiSetColor(hps, CLR_BLACK);
[136]654 ptl.x = swp.cx - 1;
655 ptl.y = swp.cy - 1;
[551]656 GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
[136]657 ptl.x = 1;
658 ptl.y = 1;
[551]659 if (ulPercentFree) {
[136]660 GpiMove(hps, &ptl);
661 GpiSetColor(hps,
662 (ulPercentFree < 11) ? CLR_DARKRED :
663 (ulPercentFree < 26) ? CLR_DARKBLUE :
664 CLR_DARKGREEN);
665 ptl.y = swp.cy - 2;
666 ptl.x = ((swp.cx - 2) * ulPercentFree) / 100;
667 wasx = ptl.x;
[551]668 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]669 GpiSetColor(hps,
670 (ulPercentFree < 11) ? CLR_RED :
671 (ulPercentFree < 26) ? CLR_BLUE : CLR_GREEN);
672 ptl.x = wasx;
673 ptl.y = swp.cy - 2;
[551]674 GpiMove(hps, &ptl);
[136]675 ptl.x = 1;
[551]676 GpiLine(hps, &ptl);
[136]677 ptl.y = 2;
678 ptl.x = 1;
[551]679 GpiLine(hps, &ptl);
[136]680 ptl.x = wasx;
681 }
[551]682 if (ulPercentFree < 99) {
683 GpiSetColor(hps, CLR_DARKGRAY);
[136]684 wasx = ptl.x;
685 ptl.y = 2;
686 GpiMove(hps, &ptl);
687 ptl.y = swp.cy - 2;
688 ptl.x = swp.cx - 2;
[551]689 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]690 ptl.x = wasx;
[551]691 GpiMove(hps, &ptl);
692 GpiSetColor(hps, CLR_PALEGRAY);
[136]693 ptl.x = swp.cx - 3;
694 GpiLine(hps, &ptl);
695 ptl.x = wasx;
696 ptl.y = 1;
697 GpiMove(hps, &ptl);
[551]698 GpiSetColor(hps, CLR_BLACK);
[136]699 ptl.x = swp.cx - 2;
700 GpiLine(hps, &ptl);
701 ptl.y = swp.cy - 3;
702 GpiLine(hps, &ptl);
703 }
[551]704 GpiSetColor(hps, CLR_WHITE);
[136]705 }
[551]706 else {
707 GpiSetColor(hps, CLR_PALEGRAY);
[136]708 ptl.x = 0;
709 ptl.y = 0;
[551]710 GpiMove(hps, &ptl);
[136]711 ptl.x = swp.cx - 1;
712 ptl.y = swp.cy - 1;
[551]713 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]714 GpiSetColor(hps,
[551]715 (ulPercentFree < 11) ? CLR_DARKRED : CLR_DARKBLUE);
[136]716 }
[551]717 GpiSetBackMix(hps, BM_LEAVEALONE);
718 GpiSetMix(hps, FM_OVERPAINT);
[136]719 {
720 POINTL aptl[TXTBOX_COUNT];
[2]721
[551]722 GpiQueryTextBox(hps, strlen(s), s, TXTBOX_COUNT, aptl);
[136]723 ptl.y = ((swp.cy / 2) -
724 ((aptl[TXTBOX_TOPRIGHT].y +
725 aptl[TXTBOX_BOTTOMLEFT].y) / 2));
726 ptl.y++;
727 ptl.x = (swp.cx / 2) - (aptl[TXTBOX_TOPRIGHT].x / 2);
728 if (ptl.x < 2)
729 ptl.x = 2;
[551]730 GpiCharStringAt(hps, &ptl, strlen(s), s);
[136]731 }
732 if (!mp2)
733 WinReleasePS(hps);
734 }
[551]735 } // if drive window
[136]736 }
737 return 0;
738
739 case UM_TIMER:
740 {
741 CHAR s[134];
742 DATETIME dt;
743
744 if (fDataToFore && !NoFloat)
745 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
746 HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
[551]747 if (counter && (counter % 19) && (counter % 20)) {
748 if (!DosGetDateTime(&dt)) {
[136]749 sprintf(s,
750 " %02hu:%02hu:%02hu %s %04u/%02u/%02u",
751 dt.hours,
752 dt.minutes,
753 dt.seconds,
754 GetPString(IDS_SUNDAY + dt.weekday),
[551]755 dt.year, dt.month, dt.day);
756 WinSetDlgItemText(hwnd, MINI_TIME, s);
[136]757 }
[2]758 }
[136]759 else if (!counter || !(counter % 19))
760 PostMsg(hwnd, UM_SETUP6, MPVOID, MPVOID); // Uptime
[551]761 if (!(counter % 4)) {
[136]762 PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); // Memory utilization
[551]763 if (!(counter % 10)) {
[136]764 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); // Process status
[551]765 if (!(counter % 20)) {
[136]766 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); // Swapper
767 }
768 }
769 }
770 }
771 counter++;
772 return 0;
[2]773
[136]774 case UM_SETUP2:
775 {
[204]776 CHAR s[134], szFileQty[38], szFreeQty[38];
[841]777 FILEFINDBUF3L ffb;
[761]778 ULONG nm = 1;
[162]779 ULONGLONG ullFreeQty;
[136]780 HDIR hdir = HDIR_CREATE;
781 FSALLOCATE fsa;
[2]782
[551]783 if (*SwapperDat) {
[136]784 DosError(FERR_DISABLEHARDERR);
[838]785 if (!xDosFindFirst(SwapperDat, &hdir, FILE_NORMAL | FILE_HIDDEN |
786 FILE_SYSTEM | FILE_ARCHIVED | FILE_READONLY,
[841]787 &ffb, sizeof(ffb), &nm, FIL_STANDARDL)) {
[136]788 priority_bumped();
789 DosFindClose(hdir);
790 DosError(FERR_DISABLEHARDERR);
791 if (!DosQueryFSInfo(toupper(*SwapperDat) - '@', FSIL_ALLOC,
[551]792 &fsa, sizeof(FSALLOCATE))) {
793 ullFreeQty =
794 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
795 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
[136]796 }
797 else
[162]798 *szFreeQty = 0;
799
[551]800 CommaFmtULL(szFileQty, sizeof(szFileQty), ffb.cbFile, ' ');
[162]801 sprintf(s, " %s %s%s%s",
[136]802 GetPString(IDS_SWAPTITLETEXT),
[551]803 szFileQty, *szFreeQty ? "/" : NullStr, szFreeQty);
804 WinSetDlgItemText(hwnd, MINI_SWAP, s);
[136]805 }
806 }
807 }
808 return 0;
[2]809
[136]810 case UM_SETUP3: // Memory utilization
811 {
[162]812 CHAR s[134], tm[38], szQty[38];
[136]813 ULONG amem = 0;
[2]814
[136]815 if (!DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM,
[551]816 (PVOID) & amem, (ULONG) sizeof(amem))) {
817 CommaFmtUL(tm, sizeof(tm), amem, 'M');
[162]818 if (!Dos16MemAvail(&amem))
[551]819 CommaFmtUL(szQty, sizeof(szQty), amem, 'M');
[136]820 else
[162]821 *szQty = 0;
822 sprintf(s, " %s%s%s%s",
[136]823 GetPString(IDS_MEMTITLETEXT),
[551]824 szQty, (*szQty) ? "/" : NullStr, tm);
825 WinSetDlgItemText(hwnd, MINI_MEM, s);
[2]826 }
[136]827 }
828 return 0;
[2]829
[551]830 case UM_SETUP5: // Process status
[136]831 {
[828]832 CHAR s[134], tm[38], szQty[38];
[136]833
[828]834 if (fUseQProcStat && !noqproc) {
[2]835
[136]836 PROCESSINFO *ppi;
837 BUFFHEADER *pbh = NULL;
838 MODINFO *pmi;
839 ULONG numprocs = 0, numthreads = 0;
[346]840 APIRET rc;
[136]841
[829]842 rc = DosAllocMem((PVOID)&pbh, USHRT_MAX + 4096,
[551]843 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
[346]844 if (rc)
[551]845 Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
846 GetPString(IDS_OUTOFMEMORY));
847 else {
[829]848 if (DosQProcStatus((ULONG *)pbh, USHRT_MAX))
[346]849 noqproc = TRUE;
850 else {
[551]851 ppi = pbh->ppi;
852 while (ppi->ulEndIndicator != PROCESS_END_INDICATOR) {
853 pmi = pbh->pmi;
854 while (pmi && ppi->hModRef != pmi->hMod)
855 pmi = pmi->pNext;
856 if (pmi) {
[136]857 numprocs++;
[551]858 numthreads += ppi->usThreadCount;
[136]859 }
[551]860 ppi = (PPROCESSINFO) (ppi->ptiFirst + ppi->usThreadCount);
[36]861 }
[136]862 commafmt(szQty, sizeof(szQty), numprocs);
863 commafmt(tm, sizeof(tm), numthreads);
864 sprintf(s,
865 " %s%s %s%s",
866 GetPString(IDS_PROCSTITLETEXT),
[551]867 szQty, GetPString(IDS_THRDSTITLETEXT), tm);
868 WinSetDlgItemText(hwnd, MINI_PROC, s);
[136]869 }
870 DosFreeMem(pbh);
871 }
[2]872 }
[828]873 else if (fUseQSysState && !noqproc) {
874
875 QSPREC *ppi;
876 QSPTRREC *pbh = NULL;
877 QSLREC *pmi;
878 ULONG numprocs = 0, numthreads = 0;
879 APIRET rc;
880
881 rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
882 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
883 if (rc)
884 Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
885 GetPString(IDS_OUTOFMEMORY));
886 else { //2 Sep 07 GKY 0x05 = process & Mod data only
887 if (DosQuerySysState(QS_PROCESS | QS_MTE, 0, 0, 0, pbh, USHRT_MAX))
888 noqproc = TRUE;
889 else {
890 ppi = pbh->pProcRec;
891 while (ppi->RecType == 1) {
892 pmi = pbh->pLibRec;
893 while (pmi && ppi->hMte != pmi->hmte)
894 pmi = pmi->pNextRec;
895 if (pmi) {
896 numprocs++;
897 numthreads += ppi->cTCB;
898 }
899 ppi = (QSPREC *) (ppi->pThrdRec + ppi->cTCB);
900 }
901 commafmt(szQty, sizeof(szQty), numprocs);
902 commafmt(tm, sizeof(tm), numthreads);
903 sprintf(s,
904 " %s%s %s%s",
905 GetPString(IDS_PROCSTITLETEXT),
906 szQty, GetPString(IDS_THRDSTITLETEXT), tm);
907 WinSetDlgItemText(hwnd, MINI_PROC, s);
908 }
909 DosFreeMem(pbh);
910 }
911 }
[551]912 else {
[136]913 commafmt(szQty, sizeof(szQty),
[551]914 WinQuerySwitchList(WinQueryAnchorBlock(hwnd), (PSWBLOCK) 0,
915 0));
916 sprintf(s, " %s%s", GetPString(IDS_TASKSTITLETEXT), szQty);
917 WinSetDlgItemText(hwnd, MINI_PROC, s);
[2]918 }
[136]919 }
920 return 0;
[2]921
[136]922 case UM_SETUP6: // Uptime
923 {
924 ULONG val = 0, numdays, nummins;
925 CHAR s[128];
926
927 if (!DosQuerySysInfo(QSV_MS_COUNT,
928 QSV_MS_COUNT,
[551]929 (PVOID) & val, (ULONG) sizeof(val))) {
[136]930 val /= 60000L;
931 numdays = val / (60L * 24L);
932 strcpy(s, GetPString(IDS_ELAPSEDTITLETEXT));
933 if (numdays)
934 sprintf(s + strlen(s),
935 " %lu %s%s, ",
[551]936 numdays, GetPString(IDS_DAYTEXT), &"s"[numdays == 1L]);
[136]937 nummins = val % (60L * 24L);
[551]938 sprintf(s + strlen(s), " %lu:%02lu", nummins / 60, nummins % 60);
939 WinSetDlgItemText(hwnd, MINI_TIME, s);
[2]940 }
[136]941 }
942 return 0;
[2]943
[136]944 case WM_SAVEAPPLICATION:
945 {
946 SWP swp;
[2]947
[136]948 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
[551]949 PrfWriteProfileData(fmprof, appname, "DataMinPos", &swp, sizeof(SWP));
[136]950 }
951 break;
[2]952
[136]953 case WM_CLOSE:
[551]954 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[136]955 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
956 return 0;
[2]957
[136]958 case WM_DESTROY:
[551]959 if (DataHwnd == WinQueryWindow(hwnd, QW_PARENT)) {
960 DataHwnd = (HWND) 0;
[136]961 if (hwndMenu)
962 WinDestroyWindow(hwndMenu);
[551]963 hwndMenu = (HWND) 0;
[136]964 }
[551]965 if (hwndMain) {
[2]966
[136]967 SWP swp;
968 ULONG fl = SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE, ofl;
[2]969
[136]970 ofl = WinQueryWindowULong(hwnd, QWL_USER);
971 WinQueryWindowPos(WinQueryWindow(hwndMain, QW_PARENT), &swp);
972 if (swp.fl & SWP_MINIMIZE)
973 fl |= ((ofl & SWP_MAXIMIZE) ? SWP_MAXIMIZE : SWP_RESTORE);
974 WinSetWindowPos(WinQueryWindow(hwndMain, QW_PARENT),
[551]975 HWND_TOP, 0, 0, 0, 0, fl);
[136]976 }
[551]977 else if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
978 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[136]979 break;
980 }
981 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]982
[551]983} // DataProc
[2]984
[136]985//=== CreateDataBar - create databar windows ===
[2]986
[136]987HWND CreateDataBar(HWND hwndParent, ULONG fl)
988{
[551]989 HWND hwndClient = (HWND) 0;
[136]990 ULONG FrameFlags = 0;
[2]991
[136]992 if (WinCreateStdWindow(hwndParent,
993 WS_VISIBLE,
994 &FrameFlags,
[593]995 WC_DATABAR,
[551]996 NULL, WS_VISIBLE, 0, MINI_FRAME, &hwndClient)) {
997 WinSendMsg(hwndClient, UM_RESTORE, MPFROMLONG(fl), MPVOID);
[136]998 }
999 return hwndClient;
[2]1000
[551]1001} // CreateDataBar
[2]1002
[136]1003//=== dataminThread - drive status thread ===
[2]1004
[551]1005static VOID dataminThread(VOID * pv)
[136]1006{
[551]1007 HAB hab = NULLHANDLE;
1008 HMQ hmq = NULLHANDLE;
1009 HWND hwndParent = (HWND) pv;
1010 HWND hwnd;
1011 HENUM henum;
[136]1012 BOOL busy = TRUE;
1013 APIRET rc;
1014 USHORT id;
1015
[1038]1016# ifdef FORTIFY
1017 Fortify_EnterScope();
[1063]1018# endif
[551]1019 if (G_hevDataMin == NULLHANDLE) {
[136]1020 // Create just once for any thread that might use it
1021 // Kernel will clean up on exit
[551]1022 rc = DosCreateEventSem(NULL, (PHEV) & G_hevDataMin, 0L, FALSE);
[136]1023 if (rc) {
[1335]1024 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1025 GetPString(IDS_CREATESEMFAILED));
[136]1026 busy = FALSE;
1027 }
1028 }
1029
[179]1030 // fixme to report errors
[136]1031 hab = WinInitialize(0);
1032 if (hab == NULLHANDLE)
1033 busy = FALSE;
[551]1034 else {
1035 hmq = WinCreateMsgQueue(hab, 0);
[136]1036 if (hmq == NULLHANDLE)
1037 busy = FALSE;
1038 else
[551]1039 WinCancelShutdown(hmq, TRUE);
[136]1040 }
1041
[551]1042 while (busy) {
[136]1043 HWND hwndSingle = G_hwndSingle;
[551]1044
[136]1045 G_hwndSingle = NULLHANDLE;
1046
1047 busy = FALSE;
1048
[551]1049 if (!WinIsWindow(hab, hwndParent))
[2]1050 break;
1051
[136]1052 henum = WinBeginEnumWindows(hwndParent);
[551]1053 while (henum && (hwnd = WinGetNextWindow(henum)) != NULLHANDLE) {
1054 if (!WinIsWindow(hab, hwnd))
[136]1055 continue;
1056 if (hwndSingle && hwndSingle != hwnd)
1057 continue;
[551]1058 id = WinQueryWindowUShort(hwnd, QWS_ID);
1059 if (id > MINI_DRIVEA) {
[136]1060 ULONG dskNum = id - MINI_DRIVEA + 1;
1061 tDataMin *pDM = WinQueryWindowPtr(hwnd, QWL_DATAMIN_PTR);
1062 SWP swp;
1063 CHAR szPath[] = " :";
[551]1064
[136]1065 if (!pDM)
1066 continue;
1067 busy = TRUE;
1068 if (!WinQueryWindowPos(hwnd, &swp))
1069 continue;
[2]1070
[136]1071 DosError(FERR_DISABLEHARDERR);
[551]1072 pDM->qfsi_rc = DosQueryFSInfo(dskNum,
1073 FSIL_ALLOC,
1074 &pDM->fsa, sizeof(FSALLOCATE));
[2]1075
[551]1076 if (!pDM->qfsi_rc) {
[136]1077 *szPath = (CHAR) dskNum + 'A' - 1;
[551]1078 pDM->qfsa_cb = sizeof(FSQBUFFER2) + 256; // se tDataMin
[136]1079 DosError(FERR_DISABLEHARDERR);
[551]1080 pDM->qfsa_rc = DosQueryFSAttach(szPath, 0, /* Ordinal */
1081 FSAIL_QUERYNAME,
1082 &pDM->fsqb2, &pDM->qfsa_cb);
[136]1083 }
1084 WinInvalidateRect(hwnd, NULL, FALSE);
[551]1085 } // if drive window
1086 } // while henum
[136]1087 WinEndEnumWindows(henum);
[2]1088
[551]1089 if (busy) {
[136]1090 ULONG clPosted;
[551]1091
1092 rc = DosWaitEventSem(G_hevDataMin, 20000L);
1093 if (rc && rc != ERROR_TIMEOUT) {
[1335]1094 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1095 GetPString(IDS_POSTSEMFAILED));
[2]1096 }
1097
[551]1098 rc = DosResetEventSem(G_hevDataMin, &clPosted);
1099 if (rc && rc != ERROR_ALREADY_RESET) {
[1335]1100 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1101 GetPString(IDS_POSTSEMFAILED));
[136]1102 }
1103 }
[2]1104
[551]1105 } // while
[2]1106
[136]1107 if (hmq != NULLHANDLE)
1108 WinDestroyMsgQueue(hmq);
[2]1109
[136]1110 if (hab != NULLHANDLE)
1111 WinTerminate(hab);
[1063]1112# ifdef FORTIFY
[1038]1113 Fortify_LeaveScope();
[1063]1114# endif
[551]1115} // dataminThread
[793]1116
1117#pragma alloc_text(DATAMIN,DataDlgProc,MiniTimeProc)
Note: See TracBrowser for help on using the repository browser.