source: trunk/dll/datamin.c@ 1391

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

Move nontranslated strings to init.c and codepage.c; use those strings in place of GetPString calls. Move other strings to a StringTable; minor cleanup and code changes to codepage.c to use a string array instead of GetPString calls. Ticket 340

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