source: trunk/dll/datamin.c@ 1498

Last change on this file since 1498 was 1498, checked in by Gregg Young, 16 years ago

Changes to get FM2 to compile with the latest watcom 1.9 beta (mostly type casts of CHAR CONSTANT * to CHAR *). Changes to get the environment settings working everywhere again (broken by the change that moved commands to the INI); Added an environment size variable (set to 2048 which was the largest I found hard coded). Still need to find everywhere the environment size is set and use this variable.

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