source: trunk/dll/datamin.c@ 1673

Last change on this file since 1673 was 1673, checked in by Gregg Young, 13 years ago

Update to Doxygen comment style Ticket 55. Also some minor code cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 29.8 KB
RevLine 
[30]1
2/***********************************************************************
3
4 $Id: datamin.c 1673 2012-12-30 18:51:01Z gyoung $
5
6 Minimized data bar
7
8 Copyright (c) 1993-98 M. Kimes
[1498]9 Copyright (c) 2001, 2010 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
[1395]27 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
28 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
[1400]29 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
[1480]30 12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory
[1482]31 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
32 profile calls for user settings that work and are setable in more than one
33 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
34 aren't user settable; realappname should be used for setting applicable to
35 one or more miniapp but not to FM/2
[1498]36 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
[1627]37 26 Aug 11 GKY Add a low mem version of xDosAlloc* wrappers; move error checking into all the
38 xDosAlloc* wrappers.
[30]39
40***********************************************************************/
41
[907]42#include <string.h>
43#include <ctype.h>
44#include <limits.h>
[1335]45// #include <process.h> // _beginthread
[907]46
[2]47#define INCL_DOS
[136]48#define INCL_DOSERRORS
[2]49#define INCL_WIN
50#define INCL_GPI
[162]51#define INCL_LONGLONG
[2]52
[1178]53#include "fm3dll.h"
[1222]54#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1206]55#include "info.h" // Data declaration(s)
56#include "notebook.h" // Data declaration(s)
57#include "inis.h" // Data declaration(s)
58#include "init.h" // Data declaration(s)
59#include "defview.h" // Data declaration(s)
[2]60#include "fm3dlg.h"
61#include "fm3str.h"
62#include "procstat.h"
[136]63#include "datamin.h"
[907]64#include "errutil.h" // Dos_Error...
65#include "strutil.h" // GetPString
[1400]66#include "i18nutil.h" // CommaFmtUL
[1156]67#include "killproc.h" // KillDlgProc
68#include "sysinfo.h" // SysInfoDlgProc
69#include "mainwnd.h" // TopWindowName
[1178]70#include "common.h" // OpenDirCnr
71#include "shadow.h" // OpenObject
72#include "chklist.h" // PopupMenu
73#include "presparm.h" // SetPresParams
74#include "undel.h" // UndeleteDlgProc
75#include "misc.h" // GetCmdSpec
76#include "wrappers.h" // xDosFindFirst
77#include "systemf.h" // runemf2
[1038]78#include "fortify.h"
[1335]79#include "excputil.h" // 06 May 08 SHL added
[2]80
[136]81APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
[2]82
[136]83static volatile HEV G_hevDataMin = NULLHANDLE;
84static volatile HWND G_hwndSingle = NULLHANDLE;
[2]85
[551]86static VOID dataminThread(VOID * pv);
[2]87
[1206]88// Data definitions
89#pragma data_seg(GLOBAL1)
90HWND DataHwnd;
91BOOL fDataInclRemote;
92BOOL fDataShowDrives;
93BOOL fDataToFore;
94BOOL fDullMin;
95
96#pragma data_seg(DATA2)
97
98static PSZ pszSrcFile = __FILE__;
99
[136]100long MINI_X = 208, MINI_Y = 16;
[2]101
[136]102//=== MiniTimeProc - time, swap and drive status mini windows procedure ===
[2]103
[136]104MRESULT EXPENTRY MiniTimeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
105{
106 APIRET rc;
[551]107
108 switch (msg) {
[136]109 case WM_CREATE:
110 {
[551]111 PVOID pv = xmalloc(sizeof(tDataMin), pszSrcFile, __LINE__);
[959]112 if (pv)
[1335]113 WinSetWindowPtr(hwnd, QWL_DATAMIN_PTR, pv);
[136]114 }
115 break;
[2]116
[136]117 case WM_BUTTON1CLICK:
118 {
119 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
120
[551]121 if (id >= MINI_DRIVEA) {
122 if (G_hevDataMin != NULLHANDLE) {
[136]123 G_hwndSingle = hwnd;
124 rc = DosPostEventSem(G_hevDataMin);
[551]125 if (rc) {
[1335]126 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
127 GetPString(IDS_POSTSEMFAILED));
[136]128 }
129 }
130 }
131 else if (id == MINI_TIME)
[551]132 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP6, // Up time
133 MPVOID, MPVOID);
[136]134 else if (id == MINI_PROC)
135 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]136 WM_SYSCOMMAND, MPFROM2SHORT(SC_TASKMANAGER, 0), MPVOID);
[136]137 }
138 break;
[2]139
[136]140 case WM_BUTTON1DBLCLK:
141 {
142 USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
[2]143
[551]144 if (id >= MINI_DRIVEA && !hwndMain) {
[136]145 CHAR s[] = " :\\";
[2]146
[136]147 *s = (CHAR) (id - MINI_DRIVEA) + 'A';
[551]148 OpenDirCnr((HWND) 0, HWND_DESKTOP, (HWND) 0, FALSE, s);
[136]149 return MRFROMLONG(1L);
150 }
[551]151 else if (id == MINI_TIME) {
[136]152 OpenObject("<WP_CLOCK>",
[551]153 (SHORT2FROMMP(mp2) & KC_SHIFT) ? Default : Settings, hwnd);
[136]154 return MRFROMLONG(1L);
155 }
[2]156
157#ifdef NEVER
[551]158 else if (id == MINI_MEM) {
[136]159 WinDlgBox(HWND_DESKTOP,
160 HWND_DESKTOP,
[551]161 SysInfoDlgProc, FM3ModHandle, SYS_FRAME, NULL);
[136]162 return MRFROMLONG(1L);
163 }
[2]164#endif
165
[551]166 else if (id == MINI_PROC || id == MINI_MEM) {
[136]167 WinDlgBox(HWND_DESKTOP,
[551]168 hwnd, KillDlgProc, FM3ModHandle, KILL_FRAME, NULL);
[136]169 return MRFROMLONG(1L);
170 }
[551]171 else if (id == MINI_SWAP && *SwapperDat) {
[2]172
[136]173 char s[5];
[2]174
[136]175 strncpy(s, SwapperDat, 4);
176 s[3] = 0;
177 WinDlgBox(HWND_DESKTOP,
178 hwndMain,
[551]179 UndeleteDlgProc, FM3ModHandle, UNDEL_FRAME, MPFROMP(s));
[136]180 return MRFROMLONG(1L);
[2]181 }
[136]182 }
183 break;
[2]184
[136]185 case WM_BUTTON1MOTIONSTART:
186 PostMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]187 UM_BUTTON1MOTIONSTART, MPVOID, MPVOID);
[136]188 break;
[2]189
[136]190 case WM_CONTEXTMENU:
[551]191 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_CONTEXTMENU, MPVOID, MPVOID);
[136]192 break;
[2]193
[136]194 case WM_PAINT:
195 {
196 MRESULT mr = 0;
197 USHORT id;
198
199 id = WinQueryWindowUShort(hwnd, QWS_ID);
[551]200 if (id >= MINI_DRIVEA) {
[136]201 HPS hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
[551]202
203 if (hps) {
[136]204 mr = WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
[551]205 UM_PAINT, MPFROM2SHORT(id, 0), MPFROMLONG(hps));
[136]206 WinEndPaint(hps);
[551]207 return mr; // Bypass default paint
[136]208 }
209 }
210 }
211 break;
[2]212
[551]213 case WM_DESTROY:
214 {
215 PVOID pv = WinQueryWindowPtr(hwnd, QWL_DATAMIN_PTR);
216
[1009]217 xfree(pv, pszSrcFile, __LINE__);
[551]218 }
219 break;
[2]220 }
[136]221 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]222
[551]223} // MiniTimeProc
[2]224
[136]225//=== DataProc - databar client window procedure ===
[2]226
[136]227MRESULT EXPENTRY DataProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
228{
229 APIRET rc;
230
[2]231 static ULONG counter;
[136]232 static BOOL NoFloat, noqproc = FALSE, Positioned;
[551]233 static HWND hwndMenu = (HWND) 0;
[2]234
[551]235 switch (msg) {
[136]236 case WM_CREATE:
[377]237 if (DataHwnd) {
[551]238 WinSetWindowPos(DataHwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_SHOW);
[136]239 return MRFROMLONG(1L);
240 }
241 DataHwnd = WinQueryWindow(hwnd, QW_PARENT);
242 NoFloat = FALSE;
243 Positioned = FALSE;
[1391]244 //fixme to allow user to change presparams 1-10-09 GKY
[136]245 SetPresParams(hwnd,
[1391]246 &RGBGREY, &RGBBLACK, &RGBBLACK, FNT_8HELVETICA);
[136]247 {
248 int c;
249 long x = 3;
[551]250 USHORT ids[] = { MINI_TIME, MINI_MEM, MINI_SWAP, MINI_PROC, 0 };
[136]251 POINTL aptl[TXTBOX_COUNT];
252 HPS hps;
253
254 hps = WinGetPS(hwnd);
[551]255 if (hps) {
[136]256 GpiQueryTextBox(hps,
257 34,
258 " -=03:08:22 SMW 1998/08/02=- ",
[551]259 TXTBOX_COUNT, aptl);
[136]260 WinReleasePS(hps);
261 MINI_X = aptl[TXTBOX_TOPRIGHT].x + 6;
262 MINI_Y = aptl[TXTBOX_TOPRIGHT].y + 6;
[2]263 }
[551]264 for (c = 0; ids[c]; c++) {
[377]265 if (!WinCreateWindow(hwnd,
[1498]266 (CHAR *) WC_MINITIME,
[551]267 NullStr,
268 SS_TEXT | DT_CENTER | DT_VCENTER | WS_VISIBLE,
269 x,
270 3,
271 MINI_X,
272 MINI_Y, hwnd, HWND_TOP, ids[c], NULL, NULL)) {
[1395]273 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
274 PCSZ_WINCREATEWINDOW);
[377]275 }
[136]276 x += (MINI_X + 4);
[2]277 }
[136]278 }
[551]279 if (!hwndMain) {
[136]280 SWCNTRL swctl;
[2]281
[136]282 memset(&swctl, 0, sizeof(swctl));
283 swctl.hwnd = WinQueryWindow(hwnd, QW_PARENT);
284 swctl.uchVisibility = SWL_VISIBLE;
285 swctl.fbJump = (fDataToFore) ? SWL_NOTJUMPABLE : SWL_JUMPABLE;
286 swctl.bProgType = PROG_PM;
[551]287 strcpy(swctl.szSwtitle, GetPString(IDS_DATABARTITLETEXT));
288 WinCreateSwitchEntry(WinQueryAnchorBlock(hwnd), &swctl);
[136]289 }
[551]290 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
[136]291 return 0;
[2]292
[136]293 case WM_MENUEND:
294 NoFloat = FALSE;
[551]295 if (hwndMenu == (HWND) mp2) {
[136]296 WinDestroyWindow(hwndMenu);
[551]297 hwndMenu = (HWND) 0;
[136]298 }
299 break;
300
301 case UM_RESTORE:
302 WinSetWindowPtr(hwnd, QWL_USER, mp1);
303 return 0;
304
305 case UM_SETUP:
306 {
307 long x, y;
308 SWP swp, swpD;
309 int c;
310 ULONG size = sizeof(SWP);
311 ULONG numdrives = 0;
312 ULONG drivestyle = (DRIVE_REMOVABLE | DRIVE_INVALID |
[553]313 DRIVE_IGNORE | DRIVE_ZIPSTREAM | DRIVE_NOSTATS);
[136]314 ULONG ulDriveNum, ulDriveMap;
315
316 if (!fDataInclRemote)
[553]317 drivestyle |= DRIVE_REMOTE || DRIVE_VIRTUAL || DRIVE_RAMDISK;
[551]318 if (fDataShowDrives) {
[136]319 DosError(FERR_DISABLEHARDERR);
320 DosQCurDisk(&ulDriveNum, &ulDriveMap);
321 x = 3;
322 y = MINI_Y + 4;
323 // Drive status windows
[551]324 for (c = 2; c < 26; c++) {
325 if ((ulDriveMap & (1L << c)) && !(driveflags[c] & drivestyle)) {
[377]326 if (!WinCreateWindow(hwnd,
[1498]327 (CHAR *) WC_MINITIME,
[551]328 NullStr,
329 SS_TEXT | DT_CENTER | DT_VCENTER |
330 WS_VISIBLE, x, y, MINI_X, MINI_Y, hwnd,
331 HWND_TOP, MINI_DRIVEA + c, NULL, NULL)) {
[1395]332 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
333 PCSZ_WINCREATEWINDOW);
[377]334 }
[136]335 numdrives++;
336 x += (MINI_X + 4);
[551]337 if ((numdrives % 4) == 0) {
[136]338 y += (MINI_Y + 4);
339 x = 3;
340 }
341 }
342 }
[2]343 }
[136]344 x = (MINI_X * 4) + 18;
345 y = (MINI_Y + 4) + ((numdrives / 4) * (MINI_Y + 4)) +
346 (((numdrives % 4) != 0) * (MINI_Y + 4));
[551]347 if (!Positioned) {
348 if (PrfQueryProfileData(fmprof, appname, "DataMinPos", &swp, &size)) {
[136]349 WinQueryWindowPos(HWND_DESKTOP, &swpD);
350 if (swp.x > swpD.cx - 16)
351 swp.x = swpD.cx - 16;
352 if (swp.y > swpD.cy - 16)
353 swp.y = swpD.cy - 16;
354 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
355 HWND_TOP,
356 swp.x,
357 swp.y,
[551]358 x, y, SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER);
[136]359 }
360 else
361 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
362 HWND_TOP,
363 0,
364 0,
[551]365 x, y, SWP_SHOW | SWP_SIZE | SWP_MOVE | SWP_ZORDER);
[136]366 Positioned = TRUE;
367 }
368 else
369 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
370 HWND_TOP,
[551]371 0, 0, x, y, SWP_SHOW | SWP_SIZE | SWP_ZORDER);
372 WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
[136]373 if (numdrives) {
[1335]374 if (xbeginthread(dataminThread,
375 32768,
376 (PVOID)hwnd,
377 pszSrcFile,
378 __LINE__) == -1)
379 {
[551]380 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[136]381 }
382 }
383 counter = 0;
[551]384 PostMsg(hwnd, UM_TIMER, MPVOID, MPVOID);
[136]385 }
[551]386 return 0; // UM_SETUP
[136]387
388 case WM_BUTTON1DBLCLK:
389 if (hwndMain)
[551]390 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[136]391 break;
392
393 case UM_CONTEXTMENU:
394 case WM_CONTEXTMENU:
395 if (!hwndMenu)
[551]396 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MINI_FRAME);
397 if (hwndMenu) {
398 WinCheckMenuItem(hwndMenu, MINI_FLOAT, fDataToFore);
399 WinCheckMenuItem(hwndMenu, MINI_SHOW, fDataShowDrives);
400 WinCheckMenuItem(hwndMenu, MINI_BORING, fDullMin);
401 WinCheckMenuItem(hwndMenu, MINI_INCLREMOTE, fDataInclRemote);
[1369]402 if (fProtectOnly) {
403 WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
404 WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
405 }
[136]406 NoFloat = TRUE;
[551]407 if (!PopupMenu(hwnd, hwnd, hwndMenu))
[136]408 NoFloat = FALSE;
409 }
410 if (msg == UM_CONTEXTMENU)
[2]411 return 0;
[136]412 break;
[2]413
[136]414 case WM_BUTTON2DBLCLK:
[551]415 if (!(SHORT2FROMMP(mp2) & KC_SHIFT)) {
416 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_FLOAT, 0), MPVOID);
[2]417 break;
[136]418 }
[1673]419 // else intentional fallthru
[136]420 case WM_CHORD:
421 case WM_BUTTON3DBLCLK:
[551]422 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(MINI_SHOW, 0), MPVOID);
[136]423 break;
[2]424
[136]425 case UM_BUTTON1MOTIONSTART:
426 case WM_BUTTON1MOTIONSTART:
427 {
428 TRACKINFO TrackInfo;
429 SWP Position;
[2]430
[136]431 memset(&TrackInfo, 0, sizeof(TrackInfo));
432 TrackInfo.cxBorder = 1;
433 TrackInfo.cyBorder = 1;
434 TrackInfo.cxGrid = 1;
435 TrackInfo.cyGrid = 1;
436 TrackInfo.cxKeyboard = 8;
437 TrackInfo.cyKeyboard = 8;
438 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &Position);
439 TrackInfo.rclTrack.xLeft = Position.x;
440 TrackInfo.rclTrack.xRight = Position.x + Position.cx;
441 TrackInfo.rclTrack.yBottom = Position.y;
442 TrackInfo.rclTrack.yTop = Position.y + Position.cy;
443 WinQueryWindowPos(HWND_DESKTOP, &Position);
444 TrackInfo.rclBoundary.xLeft = Position.x;
445 TrackInfo.rclBoundary.xRight = Position.x + Position.cx;
446 TrackInfo.rclBoundary.yBottom = Position.y;
447 TrackInfo.rclBoundary.yTop = Position.y + Position.cy;
448 TrackInfo.ptlMinTrackSize.x = 0;
449 TrackInfo.ptlMinTrackSize.y = 0;
450 TrackInfo.ptlMaxTrackSize.x = Position.cx;
451 TrackInfo.ptlMaxTrackSize.y = Position.cy;
452 TrackInfo.fs = TF_MOVE | TF_STANDARD | TF_ALLINBOUNDARY;
[551]453 if (WinTrackRect(HWND_DESKTOP, (HPS) 0, &TrackInfo)) {
[136]454 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
455 HWND_TOP, TrackInfo.rclTrack.xLeft,
456 TrackInfo.rclTrack.yBottom, 0, 0, SWP_MOVE);
457 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
458 }
459 }
460 break;
[2]461
[136]462 case WM_HELP:
463 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
464 break;
465
466 case WM_COMMAND:
[551]467 switch (SHORT1FROMMP(mp1)) {
[136]468 case IDM_COMMANDLINE:
469 case IDM_DOSCOMMANDLINE:
470 case IDM_WINFULLSCREEN:
471 {
472 CHAR *env = GetCmdSpec(FALSE), path[CCHMAXPATH];
473 INT type = SEPARATE | WINDOWED;
474
475 *path = 0;
[551]476 TopWindowName(hwnd, (HWND) 0, path);
[136]477 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
478 env = GetCmdSpec(TRUE);
[551]479 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
[136]480 env = "WINOS2.COM";
481 type = SEPARATE | FULLSCREEN;
482 }
[1335]483 runemf2(type, hwnd, pszSrcFile, __LINE__,
484 path, NULL, "%s", env);
[2]485 }
[136]486 break;
[2]487
[136]488 case IDM_HELP:
489 if (hwndHelp)
490 WinSendMsg(hwndHelp,
491 HM_DISPLAY_HELP,
[551]492 MPFROM2SHORT(HELP_DATABAR, 0), MPFROMSHORT(HM_RESOURCEID));
[2]493 break;
494
[136]495 case MINI_CLOSE:
[551]496 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]497 break;
498
[136]499 case MINI_BORING:
500 fDullMin = (fDullMin) ? FALSE : TRUE;
[1482]501 PrfWriteProfileData(fmprof, appname, "DullDatabar", &fDullMin, sizeof(BOOL));
[551]502 if (G_hevDataMin != NULLHANDLE) {
[136]503 rc = DosPostEventSem(G_hevDataMin);
504 if (rc) {
[1335]505 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
506 GetPString(IDS_POSTSEMFAILED));
[136]507 }
[2]508 }
[136]509
[2]510 break;
511
[136]512 case MINI_INCLREMOTE:
513 case MINI_SHOW:
[551]514 if (SHORT1FROMMP(mp1) == MINI_SHOW) {
[136]515 fDataShowDrives = (fDataShowDrives) ? FALSE : TRUE;
[1482]516 PrfWriteProfileData(fmprof, appname, "DataShowDrives",
517 &fDataShowDrives, sizeof(BOOL));
[136]518 }
[551]519 else {
[136]520 fDataInclRemote = (fDataInclRemote) ? FALSE : TRUE;
[1482]521 PrfWriteProfileData(fmprof, appname, "DataInclRemote",
522 &fDataInclRemote, sizeof(BOOL));
[136]523 }
524 {
525 HENUM henum;
526 HWND hwndChild;
527 USHORT id;
[2]528
[136]529 henum = WinBeginEnumWindows(hwnd);
[551]530 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]531 id = WinQueryWindowUShort(hwndChild, QWS_ID);
532 if (id >= MINI_DRIVEA)
533 WinDestroyWindow(hwndChild);
534 }
535 WinEndEnumWindows(henum);
[2]536 }
[136]537 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
[2]538 break;
539
[136]540 case MINI_FLOAT:
541 fDataToFore = (fDataToFore) ? FALSE : TRUE;
[1482]542 PrfWriteProfileData(fmprof, appname, "DataToFore", &fDataToFore, sizeof(BOOL));
[551]543 if (!hwndMain) {
[136]544
545 SWCNTRL swcntrl;
546 HSWITCH hswitch;
547
548 hswitch = (HSWITCH) WinQuerySwitchHandle(hwnd, (PID) 0);
[551]549 if (hswitch) {
[136]550 memset(&swcntrl, 0, sizeof(SWCNTRL));
[551]551 if (!WinQuerySwitchEntry(hswitch, &swcntrl)) {
[136]552 swcntrl.fbJump = (fDataToFore) ? SWL_NOTJUMPABLE : SWL_JUMPABLE;
[551]553 WinChangeSwitchEntry(hswitch, &swcntrl);
[136]554 }
555 }
556 }
[2]557 break;
[136]558 }
559 return 0;
[2]560
[136]561 case WM_SIZE:
562 WinSetWindowPos(hwnd,
563 HWND_TOP,
564 0,
565 0,
566 SHORT1FROMMP(mp2),
[551]567 SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE);
[136]568 break;
[2]569
[136]570 case WM_PAINT:
571 {
572 HPS hps;
573 POINTL ptl;
574 SWP swp;
575 RECTL rcl;
[2]576
[551]577 hps = WinBeginPaint(hwnd, (HPS) 0, &rcl);
578 if (hps) {
579 WinFillRect(hps, (PRECTL) & rcl, CLR_PALEGRAY);
[136]580 GpiSetMix(hps, FM_OVERPAINT);
581 GpiSetColor(hps, CLR_WHITE);
582 WinQueryWindowPos(hwnd, &swp);
583 ptl.x = 0;
584 ptl.y = 0;
585 GpiMove(hps, &ptl);
586 ptl.y = swp.cy - 1;
587 GpiLine(hps, &ptl);
588 ptl.x = swp.cx - 1;
589 GpiLine(hps, &ptl);
590 GpiSetColor(hps, CLR_DARKGRAY);
591 ptl.y = 0;
592 GpiLine(hps, &ptl);
593 ptl.x = 0;
594 GpiLine(hps, &ptl);
595 {
596 HENUM henum;
597 HWND hwndTemp;
[2]598
[136]599 henum = WinBeginEnumWindows(hwnd);
[551]600 while ((hwndTemp = WinGetNextWindow(henum)) != NULLHANDLE) {
[136]601 PaintRecessedWindow(hwndTemp,
[551]602 hps, (WinQueryWindowUShort(hwndTemp, QWS_ID)
603 != MINI_TIME), FALSE);
[136]604 }
605 WinEndEnumWindows(henum);
606 }
607 WinEndPaint(hps);
608 }
609 }
610 return 0;
[2]611
[136]612 case UM_PAINT:
613 {
614 CHAR s[90];
615 CHAR szFreeQty[38];
616 CHAR szDrvLtr[] = " :";
617 CHAR *pszFSystem;
[162]618 ULONGLONG ullFreeQty;
[136]619 ULONG ulPercentFree;
620 ULONG wasx;
621 HPS hps = (HPS) mp2;
622 HWND hwndChild;
623 USHORT id;
624 SWP swp;
625 POINTL ptl;
626 tDataMin *pDM;
[2]627
[136]628 id = SHORT1FROMMP(mp1);
[551]629 if (id >= MINI_DRIVEA) {
[136]630 hwndChild = WinWindowFromID(hwnd, id);
631 if (!hwndChild)
632 return 0;
633 if (!WinQueryWindowPos(hwndChild, &swp))
634 return 0;
635 pDM = WinQueryWindowPtr(hwndChild, QWL_DATAMIN_PTR);
[551]636 if (!pDM || pDM->qfsi_rc) {
[162]637 ullFreeQty = 0;
[136]638 ulPercentFree = 0;
639 }
[551]640 else {
641 ullFreeQty = (ULONGLONG) pDM->fsa.cUnitAvail *
642 (pDM->fsa.cSectorUnit * pDM->fsa.cbSector);
[2]643
[551]644 ulPercentFree = (pDM->fsa.cUnit && pDM->fsa.cUnitAvail) ?
645 (pDM->fsa.cUnitAvail * 100) / pDM->fsa.cUnit : 0;
[136]646 }
[2]647
[551]648 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
649 *szDrvLtr = (CHAR) (id - MINI_DRIVEA) + 'A';
[2]650
[551]651 if (!pDM || pDM->qfsi_rc || pDM->qfsa_rc)
[136]652 pszFSystem = "N/A";
[551]653 else {
[689]654 pszFSystem = (PCHAR)(pDM->fsqb2.szName) + pDM->fsqb2.cbName + 1;
[136]655 pszFSystem[15] = 0;
656 }
657 sprintf(s,
[549]658 "%s %13s %lu%%-%s %6s ",
[136]659 szDrvLtr,
660 szFreeQty,
[551]661 ulPercentFree, GetPString(IDS_FREETEXT), pszFSystem);
[136]662 if (!hps)
663 hps = WinGetPS(hwndChild);
[551]664 if (hps) {
665 if (!fDullMin) {
[136]666 ptl.x = 0;
667 ptl.y = 0;
[551]668 GpiMove(hps, &ptl);
669 GpiSetColor(hps, CLR_BLACK);
[136]670 ptl.x = swp.cx - 1;
671 ptl.y = swp.cy - 1;
[551]672 GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
[136]673 ptl.x = 1;
674 ptl.y = 1;
[551]675 if (ulPercentFree) {
[136]676 GpiMove(hps, &ptl);
677 GpiSetColor(hps,
678 (ulPercentFree < 11) ? CLR_DARKRED :
679 (ulPercentFree < 26) ? CLR_DARKBLUE :
680 CLR_DARKGREEN);
681 ptl.y = swp.cy - 2;
682 ptl.x = ((swp.cx - 2) * ulPercentFree) / 100;
683 wasx = ptl.x;
[551]684 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]685 GpiSetColor(hps,
686 (ulPercentFree < 11) ? CLR_RED :
687 (ulPercentFree < 26) ? CLR_BLUE : CLR_GREEN);
688 ptl.x = wasx;
689 ptl.y = swp.cy - 2;
[551]690 GpiMove(hps, &ptl);
[136]691 ptl.x = 1;
[551]692 GpiLine(hps, &ptl);
[136]693 ptl.y = 2;
694 ptl.x = 1;
[551]695 GpiLine(hps, &ptl);
[136]696 ptl.x = wasx;
697 }
[551]698 if (ulPercentFree < 99) {
699 GpiSetColor(hps, CLR_DARKGRAY);
[136]700 wasx = ptl.x;
701 ptl.y = 2;
702 GpiMove(hps, &ptl);
703 ptl.y = swp.cy - 2;
704 ptl.x = swp.cx - 2;
[551]705 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]706 ptl.x = wasx;
[551]707 GpiMove(hps, &ptl);
708 GpiSetColor(hps, CLR_PALEGRAY);
[136]709 ptl.x = swp.cx - 3;
710 GpiLine(hps, &ptl);
711 ptl.x = wasx;
712 ptl.y = 1;
713 GpiMove(hps, &ptl);
[551]714 GpiSetColor(hps, CLR_BLACK);
[136]715 ptl.x = swp.cx - 2;
716 GpiLine(hps, &ptl);
717 ptl.y = swp.cy - 3;
718 GpiLine(hps, &ptl);
719 }
[551]720 GpiSetColor(hps, CLR_WHITE);
[136]721 }
[551]722 else {
723 GpiSetColor(hps, CLR_PALEGRAY);
[136]724 ptl.x = 0;
725 ptl.y = 0;
[551]726 GpiMove(hps, &ptl);
[136]727 ptl.x = swp.cx - 1;
728 ptl.y = swp.cy - 1;
[551]729 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
[136]730 GpiSetColor(hps,
[551]731 (ulPercentFree < 11) ? CLR_DARKRED : CLR_DARKBLUE);
[136]732 }
[551]733 GpiSetBackMix(hps, BM_LEAVEALONE);
734 GpiSetMix(hps, FM_OVERPAINT);
[136]735 {
736 POINTL aptl[TXTBOX_COUNT];
[2]737
[551]738 GpiQueryTextBox(hps, strlen(s), s, TXTBOX_COUNT, aptl);
[136]739 ptl.y = ((swp.cy / 2) -
740 ((aptl[TXTBOX_TOPRIGHT].y +
741 aptl[TXTBOX_BOTTOMLEFT].y) / 2));
742 ptl.y++;
743 ptl.x = (swp.cx / 2) - (aptl[TXTBOX_TOPRIGHT].x / 2);
744 if (ptl.x < 2)
745 ptl.x = 2;
[551]746 GpiCharStringAt(hps, &ptl, strlen(s), s);
[136]747 }
748 if (!mp2)
749 WinReleasePS(hps);
750 }
[551]751 } // if drive window
[136]752 }
753 return 0;
754
755 case UM_TIMER:
756 {
[1397]757 CHAR s[134], szDate[DATE_BUF_BYTES];
[136]758 DATETIME dt;
759
760 if (fDataToFore && !NoFloat)
761 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
762 HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
[551]763 if (counter && (counter % 19) && (counter % 20)) {
[1395]764 if (!DosGetDateTime(&dt)) {
765 DTDateFormat(szDate, dt);
[136]766 sprintf(s,
[1395]767 " %02hu%s%02hu%s%02hu %s %s",
768 dt.hours, TimeSeparator,
769 dt.minutes, TimeSeparator,
[136]770 dt.seconds,
771 GetPString(IDS_SUNDAY + dt.weekday),
[1395]772 szDate);
[551]773 WinSetDlgItemText(hwnd, MINI_TIME, s);
[136]774 }
[2]775 }
[136]776 else if (!counter || !(counter % 19))
777 PostMsg(hwnd, UM_SETUP6, MPVOID, MPVOID); // Uptime
[551]778 if (!(counter % 4)) {
[136]779 PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); // Memory utilization
[551]780 if (!(counter % 10)) {
[136]781 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); // Process status
[551]782 if (!(counter % 20)) {
[136]783 PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); // Swapper
784 }
785 }
786 }
787 }
788 counter++;
789 return 0;
[2]790
[136]791 case UM_SETUP2:
792 {
[204]793 CHAR s[134], szFileQty[38], szFreeQty[38];
[841]794 FILEFINDBUF3L ffb;
[761]795 ULONG nm = 1;
[162]796 ULONGLONG ullFreeQty;
[136]797 HDIR hdir = HDIR_CREATE;
798 FSALLOCATE fsa;
[2]799
[551]800 if (*SwapperDat) {
[136]801 DosError(FERR_DISABLEHARDERR);
[838]802 if (!xDosFindFirst(SwapperDat, &hdir, FILE_NORMAL | FILE_HIDDEN |
803 FILE_SYSTEM | FILE_ARCHIVED | FILE_READONLY,
[841]804 &ffb, sizeof(ffb), &nm, FIL_STANDARDL)) {
[136]805 priority_bumped();
806 DosFindClose(hdir);
807 DosError(FERR_DISABLEHARDERR);
808 if (!DosQueryFSInfo(toupper(*SwapperDat) - '@', FSIL_ALLOC,
[551]809 &fsa, sizeof(FSALLOCATE))) {
810 ullFreeQty =
811 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
812 CommaFmtULL(szFreeQty, sizeof(szFreeQty), ullFreeQty, ' ');
[136]813 }
814 else
[162]815 *szFreeQty = 0;
816
[551]817 CommaFmtULL(szFileQty, sizeof(szFileQty), ffb.cbFile, ' ');
[162]818 sprintf(s, " %s %s%s%s",
[136]819 GetPString(IDS_SWAPTITLETEXT),
[551]820 szFileQty, *szFreeQty ? "/" : NullStr, szFreeQty);
821 WinSetDlgItemText(hwnd, MINI_SWAP, s);
[136]822 }
823 }
824 }
825 return 0;
[2]826
[136]827 case UM_SETUP3: // Memory utilization
828 {
[162]829 CHAR s[134], tm[38], szQty[38];
[136]830 ULONG amem = 0;
[2]831
[136]832 if (!DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM,
[551]833 (PVOID) & amem, (ULONG) sizeof(amem))) {
834 CommaFmtUL(tm, sizeof(tm), amem, 'M');
[162]835 if (!Dos16MemAvail(&amem))
[551]836 CommaFmtUL(szQty, sizeof(szQty), amem, 'M');
[136]837 else
[162]838 *szQty = 0;
839 sprintf(s, " %s%s%s%s",
[136]840 GetPString(IDS_MEMTITLETEXT),
[551]841 szQty, (*szQty) ? "/" : NullStr, tm);
842 WinSetDlgItemText(hwnd, MINI_MEM, s);
[2]843 }
[136]844 }
845 return 0;
[2]846
[551]847 case UM_SETUP5: // Process status
[136]848 {
[828]849 CHAR s[134], tm[38], szQty[38];
[136]850
[828]851 if (fUseQProcStat && !noqproc) {
[2]852
[136]853 PROCESSINFO *ppi;
854 BUFFHEADER *pbh = NULL;
855 MODINFO *pmi;
856 ULONG numprocs = 0, numthreads = 0;
857
[1628]858 if (!xDosAllocMem((PVOID)&pbh, USHRT_MAX + 4096, pszSrcFile, __LINE__)) {
[829]859 if (DosQProcStatus((ULONG *)pbh, USHRT_MAX))
[346]860 noqproc = TRUE;
861 else {
[551]862 ppi = pbh->ppi;
863 while (ppi->ulEndIndicator != PROCESS_END_INDICATOR) {
864 pmi = pbh->pmi;
865 while (pmi && ppi->hModRef != pmi->hMod)
866 pmi = pmi->pNext;
867 if (pmi) {
[136]868 numprocs++;
[551]869 numthreads += ppi->usThreadCount;
[136]870 }
[551]871 ppi = (PPROCESSINFO) (ppi->ptiFirst + ppi->usThreadCount);
[36]872 }
[136]873 commafmt(szQty, sizeof(szQty), numprocs);
874 commafmt(tm, sizeof(tm), numthreads);
875 sprintf(s,
876 " %s%s %s%s",
877 GetPString(IDS_PROCSTITLETEXT),
[551]878 szQty, GetPString(IDS_THRDSTITLETEXT), tm);
879 WinSetDlgItemText(hwnd, MINI_PROC, s);
[136]880 }
881 DosFreeMem(pbh);
882 }
[2]883 }
[828]884 else if (fUseQSysState && !noqproc) {
885
886 QSPREC *ppi;
887 QSPTRREC *pbh = NULL;
888 QSLREC *pmi;
889 ULONG numprocs = 0, numthreads = 0;
890
[1628]891 if (!xDosAllocMem((PVOID) & pbh, USHRT_MAX + 4096, pszSrcFile, __LINE__)) {
[1627]892 //2 Sep 07 GKY 0x05 = process & Mod data only
[828]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);
[1395]944 sprintf(s + strlen(s), " %lu%s%02lu", nummins / 60, TimeSeparator, nummins % 60);
[551]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,
[1498]1001 (CHAR *) 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);
[1673]1086 pDM->qfsa_rc = DosQueryFSAttach(szPath, 0, // Ordinal
[551]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.