source: trunk/dll/datamin.c@ 1369

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

Add check for p-rotectonly system to gray out dos/win commandline choices etc. Ticket 325 It also fixes problem with some drives not being scanned on startup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.7 KB
RevLine 
[30]1
2/***********************************************************************
3
4 $Id: datamin.c 1369 2009-01-03 18:43:34Z 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
[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);
[1369]386 if (fProtectOnly) {
387 WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
388 WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
389 }
[136]390 NoFloat = TRUE;
[551]391 if (!PopupMenu(hwnd, hwnd, hwndMenu))
[136]392 NoFloat = FALSE;
393 }
394 if (msg == UM_CONTEXTMENU)
[2]395 return 0;
[136]396 break;
[2]397
[136]398 case WM_BUTTON2DBLCLK:
[551]399 if (!(SHORT2FROMMP(mp2) & KC_SHIFT)) {
400 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_FLOAT, 0), MPVOID);
[2]401 break;
[136]402 }
403 /* else intentional fallthru */
404 case WM_CHORD:
405 case WM_BUTTON3DBLCLK:
[551]406 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_SHOW, 0), MPVOID);
[136]407 break;
[2]408
[136]409 case UM_BUTTON1MOTIONSTART:
410 case WM_BUTTON1MOTIONSTART:
411 {
412 TRACKINFO TrackInfo;
413 SWP Position;
[2]414
[136]415 memset(&TrackInfo, 0, sizeof(TrackInfo));
416 TrackInfo.cxBorder = 1;
417 TrackInfo.cyBorder = 1;
418 TrackInfo.cxGrid = 1;
419 TrackInfo.cyGrid = 1;
420 TrackInfo.cxKeyboard = 8;
421 TrackInfo.cyKeyboard = 8;
422 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &Position);
423 TrackInfo.rclTrack.xLeft = Position.x;
424 TrackInfo.rclTrack.xRight = Position.x + Position.cx;
425 TrackInfo.rclTrack.yBottom = Position.y;
426 TrackInfo.rclTrack.yTop = Position.y + Position.cy;
427 WinQueryWindowPos(HWND_DESKTOP, &Position);
428 TrackInfo.rclBoundary.xLeft = Position.x;
429 TrackInfo.rclBoundary.xRight = Position.x + Position.cx;
430 TrackInfo.rclBoundary.yBottom = Position.y;
431 TrackInfo.rclBoundary.yTop = Position.y + Position.cy;
432 TrackInfo.ptlMinTrackSize.x = 0;
433 TrackInfo.ptlMinTrackSize.y = 0;
434 TrackInfo.ptlMaxTrackSize.x = Position.cx;
435 TrackInfo.ptlMaxTrackSize.y = Position.cy;
436 TrackInfo.fs = TF_MOVE | TF_STANDARD | TF_ALLINBOUNDARY;
[551]437 if (WinTrackRect(HWND_DESKTOP, (HPS) 0, &TrackInfo)) {
[136]438 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
439 HWND_TOP, TrackInfo.rclTrack.xLeft,
440 TrackInfo.rclTrack.yBottom, 0, 0, SWP_MOVE);
441 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
442 }
443 }
444 break;
[2]445
[136]446 case WM_HELP:
447 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
448 break;
449
450 case WM_COMMAND:
[551]451 switch (SHORT1FROMMP(mp1)) {
[136]452 case IDM_COMMANDLINE:
453 case IDM_DOSCOMMANDLINE:
454 case IDM_WINFULLSCREEN:
455 {
456 CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
457 INT type = SEPARATE | WINDOWED;
458
459 *path = 0;
[551]460 TopWindowName(hwnd, (HWND) 0, path);
[136]461 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
462 env = GetCmdSpec(TRUE);
[551]463 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
[136]464 env = "WINOS2.COM";
465 type = SEPARATE | FULLSCREEN;
466 }
[1335]467 runemf2(type, hwnd, pszSrcFile, __LINE__,
468 path, NULL, "%s", env);
[2]469 }
[136]470 break;
[2]471
[136]472 case IDM_HELP:
473 if (hwndHelp)
474 WinSendMsg(hwndHelp,
475 HM_DISPLAY_HELP,
[551]476 MPFROM2SHORT(HELP_DATABAR, 0), MPFROMSHORT(HM_RESOURCEID));
[2]477 break;
478
[136]479 case MINI_CLOSE:
[551]480 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]481 break;
482
[136]483 case MINI_BORING:
484 fDullMin = (fDullMin) ? FALSE : TRUE;
485 PrfWriteProfileData(fmprof,
[551]486 FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
487 if (G_hevDataMin != NULLHANDLE) {
[136]488 rc = DosPostEventSem(G_hevDataMin);
489 if (rc) {
[1335]490 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
491 GetPString(IDS_POSTSEMFAILED));
[136]492 }
[2]493 }
[136]494
[2]495 break;
496
[136]497 case MINI_INCLREMOTE:
498 case MINI_SHOW:
[551]499 if (SHORT1FROMMP(mp1) == MINI_SHOW) {
[136]500 fDataShowDrives = (fDataShowDrives) ? FALSE : TRUE;
501 PrfWriteProfileData(fmprof,
502 appname,
[551]503 "DataShowDrives", &fDataShowDrives, sizeof(BOOL));
[136]504 }
[551]505 else {
[136]506 fDataInclRemote = (fDataInclRemote) ? FALSE : TRUE;
507 PrfWriteProfileData(fmprof,
508 appname,
[551]509 "DataInclRemote", &fDataInclRemote, sizeof(BOOL));
[136]510 }
511 {
512 HENUM henum;
513 HWND hwndChild;
514 USHORT id;
[2]515
[136]516 henum = WinBeginEnumWindows(hwnd);
[551]517 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]518 id = WinQueryWindowUShort(hwndChild, QWS_ID);
519 if (id >= MINI_DRIVEA)
520 WinDestroyWindow(hwndChild);
521 }
522 WinEndEnumWindows(henum);
[2]523 }
[136]524 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
[2]525 break;
526
[136]527 case MINI_FLOAT:
528 fDataToFore = (fDataToFore) ? FALSE : TRUE;
529 PrfWriteProfileData(fmprof,
[551]530 appname, "DataToFore", &fDataToFore, sizeof(BOOL));
531 if (!hwndMain) {
[136]532
533 SWCNTRL swcntrl;
534 HSWITCH hswitch;
535
536 hswitch = (HSWITCH) WinQuerySwitchHandle(hwnd, (PID) 0);
[551]537 if (hswitch) {
[136]538 memset(&swcntrl, 0, sizeof(SWCNTRL));
[551]539 if (!WinQuerySwitchEntry(hswitch, &swcntrl)) {
[136]540 swcntrl.fbJump = (fDataToFore) ? SWL_NOTJUMPABLE : SWL_JUMPABLE;
[551]541 WinChangeSwitchEntry(hswitch, &swcntrl);
[136]542 }
543 }
544 }
[2]545 break;
[136]546 }
547 return 0;
[2]548
[136]549 case WM_SIZE:
550 WinSetWindowPos(hwnd,
551 HWND_TOP,
552 0,
553 0,
554 SHORT1FROMMP(mp2),
[551]555 SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE);
[136]556 break;
[2]557
[136]558 case WM_PAINT:
559 {
560 HPS hps;
561 POINTL ptl;
562 SWP swp;
563 RECTL rcl;
[2]564
[551]565 hps = WinBeginPaint(hwnd, (HPS) 0, &rcl);
566 if (hps) {
567 WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
[136]568 GpiSetMix(hps, FM_OVERPAINT);
569 GpiSetColor(hps, CLR_WHITE);
570 WinQueryWindowPos(hwnd, &swp);
571 ptl.x = 0;
572 ptl.y = 0;
573 GpiMove(hps, &ptl);
574 ptl.y = swp.cy - 1;
575 GpiLine(hps, &ptl);
576 ptl.x = swp.cx - 1;
577 GpiLine(hps, &ptl);
578 GpiSetColor(hps, CLR_DARKGRAY);
579 ptl.y = 0;
580 GpiLine(hps, &ptl);
581 ptl.x = 0;
582 GpiLine(hps, &ptl);
583 {
584 HENUM henum;
585 HWND hwndTemp;
[2]586
[136]587 henum = WinBeginEnumWindows(hwnd);
[551]588 while ((hwndTemp = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]589 PaintRecessedWindow(hwndTemp,
[551]590 hps, (WinQueryWindowUShort(hwndTemp, QWS_ID)
591 != MINI_TIME), FALSE);
[136]592 }
593 WinEndEnumWindows(henum);
594 }
595 WinEndPaint(hps);
596 }
597 }
598 return 0;
[2]599
[136]600 case UM_PAINT:
601 {
602 CHAR s[90];
603 CHAR szFreeQty[38];
604 CHAR szDrvLtr[] = " :";
605 CHAR *pszFSystem;
[162]606 ULONGLONG ullFreeQty;
[136]607 ULONG ulPercentFree;
608 ULONG wasx;
609 HPS hps = (HPS) mp2;
610 HWND hwndChild;
611 USHORT id;
612 SWP swp;
613 POINTL ptl;
614 tDataMin *pDM;
[2]615
[136]616 id = SHORT1FROMMP(mp1);
[551]617 if (id >= MINI_DRIVEA) {
[136]618 hwndChild = WinWindowFromID(hwnd, id);
619 if (!hwndChild)
620 return 0;
621 if (!WinQueryWindowPos(hwndChild, &swp))
622 return 0;
623 pDM = WinQueryWindowPtr(hwndChild, QWL_DATAMIN_PTR);
[551]624 if (!pDM || pDM->qfsi_rc) {
[162]625 ullFreeQty = 0;
[136]626 ulPercentFree = 0;
627 }
[551]628 else {
629 ullFreeQty = (ULONGLONG) pDM->fsa.cUnitAvail *
630 (pDM->fsa.cSectorUnit * pDM->fsa.cbSector);
[2]631
[551]632 ulPercentFree = (pDM->fsa.cUnit && pDM->fsa.cUnitAvail) ?
633 (pDM->fsa.cUnitAvail * 100) / pDM->fsa.cUnit : 0;
[136]634 }
[2]635
[551]636 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
637 *szDrvLtr = (CHAR) (id - MINI_DRIVEA) + 'A';
[2]638
[551]639 if (!pDM || pDM->qfsi_rc || pDM->qfsa_rc)
[136]640 pszFSystem = "N/A";
[551]641 else {
[689]642 pszFSystem = (PCHAR)(pDM->fsqb2.szName) + pDM->fsqb2.cbName + 1;
[136]643 pszFSystem[15] = 0;
644 }
645 sprintf(s,
[549]646 "%s %13s %lu%%-%s %6s ",
[136]647 szDrvLtr,
648 szFreeQty,
[551]649 ulPercentFree, GetPString(IDS_FREETEXT), pszFSystem);
[136]650 if (!hps)
651 hps = WinGetPS(hwndChild);
[551]652 if (hps) {
653 if (!fDullMin) {
[136]654 ptl.x = 0;
655 ptl.y = 0;
[551]656 GpiMove(hps, &ptl);
657 GpiSetColor(hps, CLR_BLACK);
[136]658 ptl.x = swp.cx - 1;
659 ptl.y = swp.cy - 1;
[551]660 GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
[136]661 ptl.x = 1;
662 ptl.y = 1;
[551]663 if (ulPercentFree) {
[136]664 GpiMove(hps, &ptl);
665 GpiSetColor(hps,
666 (ulPercentFree < 11) ? CLR_DARKRED :
667 (ulPercentFree < 26) ? CLR_DARKBLUE :
668 CLR_DARKGREEN);
669 ptl.y = swp.cy - 2;
670 ptl.x = ((swp.cx - 2) * ulPercentFree) / 100;
671 wasx = ptl.x;
[551]672 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]673 GpiSetColor(hps,
674 (ulPercentFree < 11) ? CLR_RED :
675 (ulPercentFree < 26) ? CLR_BLUE : CLR_GREEN);
676 ptl.x = wasx;
677 ptl.y = swp.cy - 2;
[551]678 GpiMove(hps, &ptl);
[136]679 ptl.x = 1;
[551]680 GpiLine(hps, &ptl);
[136]681 ptl.y = 2;
682 ptl.x = 1;
[551]683 GpiLine(hps, &ptl);
[136]684 ptl.x = wasx;
685 }
[551]686 if (ulPercentFree < 99) {
687 GpiSetColor(hps, CLR_DARKGRAY);
[136]688 wasx = ptl.x;
689 ptl.y = 2;
690 GpiMove(hps, &ptl);
691 ptl.y = swp.cy - 2;
692 ptl.x = swp.cx - 2;
[551]693 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]694 ptl.x = wasx;
[551]695 GpiMove(hps, &ptl);
696 GpiSetColor(hps, CLR_PALEGRAY);
[136]697 ptl.x = swp.cx - 3;
698 GpiLine(hps, &ptl);
699 ptl.x = wasx;
700 ptl.y = 1;
701 GpiMove(hps, &ptl);
[551]702 GpiSetColor(hps, CLR_BLACK);
[136]703 ptl.x = swp.cx - 2;
704 GpiLine(hps, &ptl);
705 ptl.y = swp.cy - 3;
706 GpiLine(hps, &ptl);
707 }
[551]708 GpiSetColor(hps, CLR_WHITE);
[136]709 }
[551]710 else {
711 GpiSetColor(hps, CLR_PALEGRAY);
[136]712 ptl.x = 0;
713 ptl.y = 0;
[551]714 GpiMove(hps, &ptl);
[136]715 ptl.x = swp.cx - 1;
716 ptl.y = swp.cy - 1;
[551]717 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]718 GpiSetColor(hps,
[551]719 (ulPercentFree < 11) ? CLR_DARKRED : CLR_DARKBLUE);
[136]720 }
[551]721 GpiSetBackMix(hps, BM_LEAVEALONE);
722 GpiSetMix(hps, FM_OVERPAINT);
[136]723 {
724 POINTL aptl[TXTBOX_COUNT];
[2]725
[551]726 GpiQueryTextBox(hps, strlen(s), s, TXTBOX_COUNT, aptl);
[136]727 ptl.y = ((swp.cy / 2) -
728 ((aptl[TXTBOX_TOPRIGHT].y +
729 aptl[TXTBOX_BOTTOMLEFT].y) / 2));
730 ptl.y++;
731 ptl.x = (swp.cx / 2) - (aptl[TXTBOX_TOPRIGHT].x / 2);
732 if (ptl.x < 2)
733 ptl.x = 2;
[551]734 GpiCharStringAt(hps, &ptl, strlen(s), s);
[136]735 }
736 if (!mp2)
737 WinReleasePS(hps);
738 }
[551]739 } // if drive window
[136]740 }
741 return 0;
742
743 case UM_TIMER:
744 {
745 CHAR s[134];
746 DATETIME dt;
747
748 if (fDataToFore && !NoFloat)
749 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
750 HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
[551]751 if (counter && (counter % 19) && (counter % 20)) {
752 if (!DosGetDateTime(&dt)) {
[136]753 sprintf(s,
754 " %02hu:%02hu:%02hu %s %04u/%02u/%02u",
755 dt.hours,
756 dt.minutes,
757 dt.seconds,
758 GetPString(IDS_SUNDAY + dt.weekday),
[551]759 dt.year, dt.month, dt.day);
760 WinSetDlgItemText(hwnd, MINI_TIME, s);
[136]761 }
[2]762 }
[136]763 else if (!counter || !(counter % 19))
764 PostMsg(hwnd, UM_SETUP6, MPVOID, MPVOID); // Uptime
[551]765 if (!(counter % 4)) {
[136]766 PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); // Memory utilization
[551]767 if (!(counter % 10)) {
[136]768 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); // Process status
[551]769 if (!(counter % 20)) {
[136]770 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); // Swapper
771 }
772 }
773 }
774 }
775 counter++;
776 return 0;
[2]777
[136]778 case UM_SETUP2:
779 {
[204]780 CHAR s[134], szFileQty[38], szFreeQty[38];
[841]781 FILEFINDBUF3L ffb;
[761]782 ULONG nm = 1;
[162]783 ULONGLONG ullFreeQty;
[136]784 HDIR hdir = HDIR_CREATE;
785 FSALLOCATE fsa;
[2]786
[551]787 if (*SwapperDat) {
[136]788 DosError(FERR_DISABLEHARDERR);
[838]789 if (!xDosFindFirst(SwapperDat, &hdir, FILE_NORMAL | FILE_HIDDEN |
790 FILE_SYSTEM | FILE_ARCHIVED | FILE_READONLY,
[841]791 &ffb, sizeof(ffb), &nm, FIL_STANDARDL)) {
[136]792 priority_bumped();
793 DosFindClose(hdir);
794 DosError(FERR_DISABLEHARDERR);
795 if (!DosQueryFSInfo(toupper(*SwapperDat) - '@', FSIL_ALLOC,
[551]796 &fsa, sizeof(FSALLOCATE))) {
797 ullFreeQty =
798 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
799 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
[136]800 }
801 else
[162]802 *szFreeQty = 0;
803
[551]804 CommaFmtULL(szFileQty, sizeof(szFileQty), ffb.cbFile, ' ');
[162]805 sprintf(s, " %s %s%s%s",
[136]806 GetPString(IDS_SWAPTITLETEXT),
[551]807 szFileQty, *szFreeQty ? "/" : NullStr, szFreeQty);
808 WinSetDlgItemText(hwnd, MINI_SWAP, s);
[136]809 }
810 }
811 }
812 return 0;
[2]813
[136]814 case UM_SETUP3: // Memory utilization
815 {
[162]816 CHAR s[134], tm[38], szQty[38];
[136]817 ULONG amem = 0;
[2]818
[136]819 if (!DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM,
[551]820 (PVOID) & amem, (ULONG) sizeof(amem))) {
821 CommaFmtUL(tm, sizeof(tm), amem, 'M');
[162]822 if (!Dos16MemAvail(&amem))
[551]823 CommaFmtUL(szQty, sizeof(szQty), amem, 'M');
[136]824 else
[162]825 *szQty = 0;
826 sprintf(s, " %s%s%s%s",
[136]827 GetPString(IDS_MEMTITLETEXT),
[551]828 szQty, (*szQty) ? "/" : NullStr, tm);
829 WinSetDlgItemText(hwnd, MINI_MEM, s);
[2]830 }
[136]831 }
832 return 0;
[2]833
[551]834 case UM_SETUP5: // Process status
[136]835 {
[828]836 CHAR s[134], tm[38], szQty[38];
[136]837
[828]838 if (fUseQProcStat && !noqproc) {
[2]839
[136]840 PROCESSINFO *ppi;
841 BUFFHEADER *pbh = NULL;
842 MODINFO *pmi;
843 ULONG numprocs = 0, numthreads = 0;
[346]844 APIRET rc;
[136]845
[829]846 rc = DosAllocMem((PVOID)&pbh, USHRT_MAX + 4096,
[551]847 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
[346]848 if (rc)
[551]849 Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
850 GetPString(IDS_OUTOFMEMORY));
851 else {
[829]852 if (DosQProcStatus((ULONG *)pbh, USHRT_MAX))
[346]853 noqproc = TRUE;
854 else {
[551]855 ppi = pbh->ppi;
856 while (ppi->ulEndIndicator != PROCESS_END_INDICATOR) {
857 pmi = pbh->pmi;
858 while (pmi && ppi->hModRef != pmi->hMod)
859 pmi = pmi->pNext;
860 if (pmi) {
[136]861 numprocs++;
[551]862 numthreads += ppi->usThreadCount;
[136]863 }
[551]864 ppi = (PPROCESSINFO) (ppi->ptiFirst + ppi->usThreadCount);
[36]865 }
[136]866 commafmt(szQty, sizeof(szQty), numprocs);
867 commafmt(tm, sizeof(tm), numthreads);
868 sprintf(s,
869 " %s%s %s%s",
870 GetPString(IDS_PROCSTITLETEXT),
[551]871 szQty, GetPString(IDS_THRDSTITLETEXT), tm);
872 WinSetDlgItemText(hwnd, MINI_PROC, s);
[136]873 }
874 DosFreeMem(pbh);
875 }
[2]876 }
[828]877 else if (fUseQSysState && !noqproc) {
878
879 QSPREC *ppi;
880 QSPTRREC *pbh = NULL;
881 QSLREC *pmi;
882 ULONG numprocs = 0, numthreads = 0;
883 APIRET rc;
884
885 rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
886 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
887 if (rc)
888 Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
889 GetPString(IDS_OUTOFMEMORY));
890 else { //2 Sep 07 GKY 0x05 = process & Mod data only
891 if (DosQuerySysState(QS_PROCESS | QS_MTE, 0, 0, 0, pbh, USHRT_MAX))
892 noqproc = TRUE;
893 else {
894 ppi = pbh->pProcRec;
895 while (ppi->RecType == 1) {
896 pmi = pbh->pLibRec;
897 while (pmi && ppi->hMte != pmi->hmte)
898 pmi = pmi->pNextRec;
899 if (pmi) {
900 numprocs++;
901 numthreads += ppi->cTCB;
902 }
903 ppi = (QSPREC *) (ppi->pThrdRec + ppi->cTCB);
904 }
905 commafmt(szQty, sizeof(szQty), numprocs);
906 commafmt(tm, sizeof(tm), numthreads);
907 sprintf(s,
908 " %s%s %s%s",
909 GetPString(IDS_PROCSTITLETEXT),
910 szQty, GetPString(IDS_THRDSTITLETEXT), tm);
911 WinSetDlgItemText(hwnd, MINI_PROC, s);
912 }
913 DosFreeMem(pbh);
914 }
915 }
[551]916 else {
[136]917 commafmt(szQty, sizeof(szQty),
[551]918 WinQuerySwitchList(WinQueryAnchorBlock(hwnd), (PSWBLOCK) 0,
919 0));
920 sprintf(s, " %s%s", GetPString(IDS_TASKSTITLETEXT), szQty);
921 WinSetDlgItemText(hwnd, MINI_PROC, s);
[2]922 }
[136]923 }
924 return 0;
[2]925
[136]926 case UM_SETUP6: // Uptime
927 {
928 ULONG val = 0, numdays, nummins;
929 CHAR s[128];
930
931 if (!DosQuerySysInfo(QSV_MS_COUNT,
932 QSV_MS_COUNT,
[551]933 (PVOID) & val, (ULONG) sizeof(val))) {
[136]934 val /= 60000L;
935 numdays = val / (60L * 24L);
936 strcpy(s, GetPString(IDS_ELAPSEDTITLETEXT));
937 if (numdays)
938 sprintf(s + strlen(s),
939 " %lu %s%s, ",
[551]940 numdays, GetPString(IDS_DAYTEXT), &"s"[numdays == 1L]);
[136]941 nummins = val % (60L * 24L);
[551]942 sprintf(s + strlen(s), " %lu:%02lu", nummins / 60, nummins % 60);
943 WinSetDlgItemText(hwnd, MINI_TIME, s);
[2]944 }
[136]945 }
946 return 0;
[2]947
[136]948 case WM_SAVEAPPLICATION:
949 {
950 SWP swp;
[2]951
[136]952 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
[551]953 PrfWriteProfileData(fmprof, appname, "DataMinPos", &swp, sizeof(SWP));
[136]954 }
955 break;
[2]956
[136]957 case WM_CLOSE:
[551]958 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
[136]959 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
960 return 0;
[2]961
[136]962 case WM_DESTROY:
[551]963 if (DataHwnd == WinQueryWindow(hwnd, QW_PARENT)) {
964 DataHwnd = (HWND) 0;
[136]965 if (hwndMenu)
966 WinDestroyWindow(hwndMenu);
[551]967 hwndMenu = (HWND) 0;
[136]968 }
[551]969 if (hwndMain) {
[2]970
[136]971 SWP swp;
972 ULONG fl = SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE, ofl;
[2]973
[136]974 ofl = WinQueryWindowULong(hwnd, QWL_USER);
975 WinQueryWindowPos(WinQueryWindow(hwndMain, QW_PARENT), &swp);
976 if (swp.fl & SWP_MINIMIZE)
977 fl |= ((ofl & SWP_MAXIMIZE) ? SWP_MAXIMIZE : SWP_RESTORE);
978 WinSetWindowPos(WinQueryWindow(hwndMain, QW_PARENT),
[551]979 HWND_TOP, 0, 0, 0, 0, fl);
[136]980 }
[551]981 else if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
982 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
[136]983 break;
984 }
985 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]986
[551]987} // DataProc
[2]988
[136]989//=== CreateDataBar - create databar windows ===
[2]990
[136]991HWND CreateDataBar(HWND hwndParent, ULONG fl)
992{
[551]993 HWND hwndClient = (HWND) 0;
[136]994 ULONG FrameFlags = 0;
[2]995
[136]996 if (WinCreateStdWindow(hwndParent,
997 WS_VISIBLE,
998 &FrameFlags,
[593]999 WC_DATABAR,
[551]1000 NULL, WS_VISIBLE, 0, MINI_FRAME, &hwndClient)) {
1001 WinSendMsg(hwndClient, UM_RESTORE, MPFROMLONG(fl), MPVOID);
[136]1002 }
1003 return hwndClient;
[2]1004
[551]1005} // CreateDataBar
[2]1006
[136]1007//=== dataminThread - drive status thread ===
[2]1008
[551]1009static VOID dataminThread(VOID * pv)
[136]1010{
[551]1011 HAB hab = NULLHANDLE;
1012 HMQ hmq = NULLHANDLE;
1013 HWND hwndParent = (HWND) pv;
1014 HWND hwnd;
1015 HENUM henum;
[136]1016 BOOL busy = TRUE;
1017 APIRET rc;
1018 USHORT id;
1019
[1038]1020# ifdef FORTIFY
1021 Fortify_EnterScope();
[1063]1022# endif
[551]1023 if (G_hevDataMin == NULLHANDLE) {
[136]1024 // Create just once for any thread that might use it
1025 // Kernel will clean up on exit
[551]1026 rc = DosCreateEventSem(NULL, (PHEV) & G_hevDataMin, 0L, FALSE);
[136]1027 if (rc) {
[1335]1028 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1029 GetPString(IDS_CREATESEMFAILED));
[136]1030 busy = FALSE;
1031 }
1032 }
1033
[179]1034 // fixme to report errors
[136]1035 hab = WinInitialize(0);
1036 if (hab == NULLHANDLE)
1037 busy = FALSE;
[551]1038 else {
1039 hmq = WinCreateMsgQueue(hab, 0);
[136]1040 if (hmq == NULLHANDLE)
1041 busy = FALSE;
1042 else
[551]1043 WinCancelShutdown(hmq, TRUE);
[136]1044 }
1045
[551]1046 while (busy) {
[136]1047 HWND hwndSingle = G_hwndSingle;
[551]1048
[136]1049 G_hwndSingle = NULLHANDLE;
1050
1051 busy = FALSE;
1052
[551]1053 if (!WinIsWindow(hab, hwndParent))
[2]1054 break;
1055
[136]1056 henum = WinBeginEnumWindows(hwndParent);
[551]1057 while (henum && (hwnd = WinGetNextWindow(henum)) != NULLHANDLE) {
1058 if (!WinIsWindow(hab, hwnd))
[136]1059 continue;
1060 if (hwndSingle && hwndSingle != hwnd)
1061 continue;
[551]1062 id = WinQueryWindowUShort(hwnd, QWS_ID);
1063 if (id > MINI_DRIVEA) {
[136]1064 ULONG dskNum = id - MINI_DRIVEA + 1;
1065 tDataMin *pDM = WinQueryWindowPtr(hwnd, QWL_DATAMIN_PTR);
1066 SWP swp;
1067 CHAR szPath[] = " :";
[551]1068
[136]1069 if (!pDM)
1070 continue;
1071 busy = TRUE;
1072 if (!WinQueryWindowPos(hwnd, &swp))
1073 continue;
[2]1074
[136]1075 DosError(FERR_DISABLEHARDERR);
[551]1076 pDM->qfsi_rc = DosQueryFSInfo(dskNum,
1077 FSIL_ALLOC,
1078 &pDM->fsa, sizeof(FSALLOCATE));
[2]1079
[551]1080 if (!pDM->qfsi_rc) {
[136]1081 *szPath = (CHAR) dskNum + 'A' - 1;
[551]1082 pDM->qfsa_cb = sizeof(FSQBUFFER2) + 256; // se tDataMin
[136]1083 DosError(FERR_DISABLEHARDERR);
[551]1084 pDM->qfsa_rc = DosQueryFSAttach(szPath, 0, /* Ordinal */
1085 FSAIL_QUERYNAME,
1086 &pDM->fsqb2, &pDM->qfsa_cb);
[136]1087 }
1088 WinInvalidateRect(hwnd, NULL, FALSE);
[551]1089 } // if drive window
1090 } // while henum
[136]1091 WinEndEnumWindows(henum);
[2]1092
[551]1093 if (busy) {
[136]1094 ULONG clPosted;
[551]1095
1096 rc = DosWaitEventSem(G_hevDataMin, 20000L);
1097 if (rc && rc != ERROR_TIMEOUT) {
[1335]1098 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1099 GetPString(IDS_POSTSEMFAILED));
[2]1100 }
1101
[551]1102 rc = DosResetEventSem(G_hevDataMin, &clPosted);
1103 if (rc && rc != ERROR_ALREADY_RESET) {
[1335]1104 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1105 GetPString(IDS_POSTSEMFAILED));
[136]1106 }
1107 }
[2]1108
[551]1109 } // while
[2]1110
[136]1111 if (hmq != NULLHANDLE)
1112 WinDestroyMsgQueue(hmq);
[2]1113
[136]1114 if (hab != NULLHANDLE)
1115 WinTerminate(hab);
[1063]1116# ifdef FORTIFY
[1038]1117 Fortify_LeaveScope();
[1063]1118# endif
[551]1119} // dataminThread
[793]1120
1121#pragma alloc_text(DATAMIN,DataDlgProc,MiniTimeProc)
Note: See TracBrowser for help on using the repository browser.