source: trunk/dll/datamin.c@ 1397

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

Some clean up of the date formatting code

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