source: trunk/dll/datamin.c@ 1375

Last change on this file since 1375 was 1375, checked in by Gregg Young, 17 years ago

Updated history; comments minor code cleanup for recent changes

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