source: trunk/dll/misc.c@ 1533

Last change on this file since 1533 was 1533, checked in by Gregg Young, 15 years ago

Fixed possible loss of precision compiler warnings by casting the variables in question.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 78.3 KB
Line 
1/***********************************************************************
2
3 $Id: misc.c 1533 2010-05-30 17:34:46Z gyoung $
4
5 Misc GUI support functions
6
7 Copyright (c) 1993-98 M. Kimes
8 Copyright (c) 2003, 2010 Steven H. Levine
9
10 11 Jun 03 SHL Add JFS and FAT32 support
11 01 Aug 04 SHL Rework lstrip/rstrip usage
12 01 Aug 04 SHL LoadLibPath: avoid buffer overflow
13 07 Jun 05 SHL Drop obsoletes
14 24 Jul 05 SHL Beautify
15 24 Jul 05 SHL Correct longname display option
16 17 Jul 06 SHL Use Runtime_Error
17 26 Jul 06 SHL Use chop_at_crnl
18 27 Jul 06 SHL Comments, apply indent
19 29 Jul 06 SHL Use xfgets_bstripcr
20 16 Aug 06 SHL Comments
21 31 Aug 06 SHL disable_menuitem: rework args to match name - sheesh
22 10 Oct 06 GKY Add NDFS32 support
23 18 Feb 07 GKY More drive type and drive icon support
24 10 Jun 07 GKY Add IsFm2Window as part of work around PM drag limit
25 05 Jul 07 GKY Fix menu removals for WORKPLACE_PROCESS=YES
26 23 Jul 07 SHL Sync with CNRITEM updates (ticket#24)
27 31 Jul 07 SHL Clean up and report errors (ticket#24)
28 03 Aug 07 GKY Direct editting fixed (ticket#24)
29 06 Aug 07 SHL Use BldQuotedFileName
30 06 Aug 07 GKY Increase Subject EA to 1024
31 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
32 14 Aug 07 SHL Delete obsoletes
33 14 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
34 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
35 05 Nov 07 GKY Use commafmtULL to display file sizes for large file support
36 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
37 12 Jan 08 SHL Document SetConditionalCascade
38 13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector.
39 19 Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
40 21 Jan 08 GKY Stop reallocating NullStr by direct editing of empty subject and longname strings.
41 29 Feb 08 GKY Use xfree where appropriate
42 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
43 keys using a "DirCnr." prefix
44 19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details
45 switches are set correctly.
46 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
47 all the details view settings (both the global variables and those in the
48 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
49 17 Jul 08 SHL Add GetTidForWindow for Fortify support
50 20 Jul 08 GKY Add save/append filename to clipboard.
51 Change menu wording to make these easier to find
52 23 Aug 08 GKY Add CheckDriveSpaceAvail To pre check drive space to prevent failures
53 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
54 28 Dec 08 GKY Check for LVM.EXE and remove Refresh removable media menu item as appropriate
55 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
56 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
57 08 Mar 09 GKY Additional strings move to PCSZs in init.c
58 08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code
59 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
60 28 Mar 09 GKY Add RemoveOldCnrSwitches to remove pre 3.16 style ini keys;
61 add State.version key for check
62 12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory
63 22 Jul 09 GKY Check if drives support EAs add driveflag for this
64 22 Jul 09 GKY Allow .LONGNAME to be displayed for FAT drives.
65 21 Dec 09 GKY Allow command menu reorder without changing the "ID" or hot key for a command.
66 Added load_inicommand to load the IDs from the ini file.
67 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
68
69***********************************************************************/
70
71#include <stdlib.h>
72#include <string.h>
73#include <ctype.h>
74#include <share.h>
75#include <malloc.h> // _heapmin
76
77#define INCL_DOS
78#define INCL_WIN
79#define INCL_GPI
80#define INCL_LONGLONG
81
82#include "fm3dll.h"
83#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
84#include "misc.h"
85#include "killproc.h" // Data declaration(s)
86#include "comp.h" // Data declaration(s)
87#include "treecnr.h" // Data declaration(s)
88#include "mainwnd.h" // Data declaration(s)
89#include "init.h" // Data declaration(s)
90#include "dircnrs.h" // Data declaration(s)
91#include "newview.h" // Data declarations
92#include "collect.h" // data declaration(s)
93#include "notebook.h" // data declaration(s)
94#include "arccnrs.h"
95#include "fm3dlg.h"
96#include "fm3str.h"
97#include "pathutil.h" // BldQuotedFileName
98#include "errutil.h" // Dos_Error...
99#include "strutil.h" // GetPString
100#include "command.h" // LINKCMDS
101#include "cmdline.h" // CmdLineDlgProc
102#include "defview.h" // QuickView
103#include "copyf.h" // WriteLongName
104#include "strips.h" // chop_at_crnl
105#include "valid.h" // CheckDrive
106#include "presparm.h" // CopyPresParams
107#include "systemf.h" // ExecOnList
108#include "viewer.h" // StartMLEEditor
109#include "subj.h" // Subject
110#include "wrappers.h" // xDosSetPathInfo
111#include "i18nutil.h" // CommaFmtULL
112#include "fortify.h"
113#include "info.h" // driveflags
114
115#define CONTAINER_COLUMNS 13 /* Number of columns in details view */
116#define MS_POPUP 0x00000010L
117
118// Data definitions
119#pragma data_seg(GLOBAL1)
120HWND CollectorDirMenu;
121HWND CollectorFileMenu;
122HWND DirMenu;
123HWND FileMenu;
124HWND TreeMenu;
125BOOL fDefaultDeletePerm;
126BOOL fWorkPlace;
127
128#pragma data_seg(GLOBAL4)
129ULONG numswitches;
130HSWITCH switches[499];
131
132#pragma data_seg(DATA1)
133static PSZ pszSrcFile = __FILE__;
134
135#ifndef BEGIN_LIBPATH
136#define BEGIN_LIBPATH 1
137#endif
138
139#ifndef END_LIBPATH
140#define END_LIBPATH 2
141#endif
142
143#ifndef ORD_DOS32QUERYEXTLIBPATH
144#define ORD_DOS32QUERYEXTLIBPATH 874
145#endif
146
147BOOL IsFm2Window(HWND hwnd, BOOL chkTid)
148{
149 PIB *ppib;
150 TIB *ptib;
151 BOOL yes;
152 APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
153
154 if (rc) {
155 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
156 PCSZ_DOSGETINFOBLOCKS);
157 yes = FALSE;
158 }
159 else {
160 PID pid;
161 TID tid;
162
163 // Check window owned by FM2 process
164 // Check say same thread too, if requested
165 // OK for window to be dead - just return FALSE
166 yes = WinQueryWindowProcess(hwnd, &pid, &tid) &&
167 pid == ppib->pib_ulpid &&
168 (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
169 }
170 return yes;
171}
172
173#ifdef FORTIFY
174
175/**
176 * Return thread ordinal for fm/2 window
177 * window must exist and must be created by fm/2
178 * @param hwnd is window handle
179 * @returns thread ordinal or -1 if error
180 */
181
182INT GetTidForWindow(HWND hwnd)
183{
184 PIB *ppib;
185 TIB *ptib;
186 LONG ordinal = -1;
187 APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
188
189 if (rc) {
190 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
191 PCSZ_DOSGETINFOBLOCKS);
192 }
193 else {
194 PID pid;
195 TID tid;
196 if (!WinQueryWindowProcess(hwnd, &pid, &tid))
197 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
198 else if (pid != ppib->pib_ulpid)
199 Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
200 else
201 ordinal = ptib->tib_ptib2->tib2_ultid;
202 }
203 return ordinal;
204}
205
206/**
207 * Return thread ordinal for current thread
208 * @returns thread ordinal or -1 if error
209 */
210
211INT GetTidForThread(VOID)
212{
213 PIB *ppib;
214 TIB *ptib;
215 LONG ordinal = -1;
216 APIRET rc = DosGetInfoBlocks(&ptib, &ppib);
217
218 if (rc) {
219 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
220 PCSZ_DOSGETINFOBLOCKS);
221 }
222 else
223 ordinal = ptib->tib_ptib2->tib2_ultid;
224
225 return ordinal;
226}
227
228#endif // FORTIFY
229
230VOID SetShiftState(VOID)
231{
232 shiftstate = 0;
233 if (WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
234 shiftstate |= KC_CTRL;
235 if (WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
236 shiftstate |= KC_SHIFT;
237 if (WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000)
238 shiftstate |= KC_ALT;
239}
240
241void EmphasizeButton(HWND hwnd, BOOL on)
242{
243 HPS hps = DrgGetPS(hwnd);
244
245 // fixme to complain?
246 if (hps) {
247 POINTL ptl;
248 SWP swp;
249
250 WinQueryWindowPos(hwnd, &swp);
251 ptl.x = 1;
252 ptl.y = 1;
253 GpiMove(hps, &ptl);
254 GpiSetColor(hps, on ? CLR_BLACK : CLR_PALEGRAY);
255 ptl.x = swp.cx - 2;
256 ptl.y = swp.cy - 2;
257 GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
258 DrgReleasePS(hps);
259 if (remove) //fixme always true
260 WinInvalidateRect(hwnd, NULL, FALSE);
261 }
262}
263
264void DrawTargetEmphasis(HWND hwnd, BOOL on)
265{
266 HPS hps = DrgGetPS(WinQueryWindow(hwnd, QW_PARENT));
267
268 if (hps) {
269 BoxWindow(hwnd, hps, on ? CLR_BLACK : CLR_PALEGRAY);
270 DrgReleasePS(hps);
271 }
272}
273
274void BoxWindow(HWND hwnd, HPS hps, LONG color)
275{
276 POINTL ptl;
277 SWP swp;
278 BOOL releaseme = FALSE;
279
280 if (!hps) {
281 hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
282 releaseme = TRUE;
283 }
284 if (hps && WinQueryWindowPos(hwnd, &swp)) {
285 ptl.x = swp.x - 2;
286 ptl.y = swp.y - 2;
287 GpiMove(hps, &ptl);
288 GpiSetColor(hps, color);
289 ptl.x = swp.x + swp.cx + 1;
290 ptl.y = swp.y + swp.cy + 1;
291 GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0);
292 }
293 if (releaseme && hps)
294 WinReleasePS(hps);
295}
296
297void PaintSTextWindow(HWND hwnd, HPS hps)
298{
299 /*
300 * paint a text window such that the rightmost part of the text is
301 * always visible even if the text length exceeds the length of the
302 * window -- otherwise, paint the window so that it is left-justified
303 * and vertically centered.
304 */
305
306 char *s = NULL;
307 long len;
308 POINTL aptl[TXTBOX_COUNT], ptl;
309 RECTL rcl;
310 char *p;
311 BOOL releaseme = FALSE;
312
313 if (!hps) {
314 releaseme = TRUE;
315 hps = WinGetPS(hwnd);
316 }
317 if (hps) {
318 WinQueryWindowRect(hwnd, &rcl);
319 WinFillRect(hps, &rcl, CLR_PALEGRAY);
320 len = WinQueryWindowTextLength(hwnd);
321 if (len)
322 s = xmalloc(len + 1, pszSrcFile, __LINE__);
323 if (s) {
324 *s = 0;
325 WinQueryWindowText(hwnd, CCHMAXPATH, s);
326 if (*s) {
327 rcl.xRight -= 3;
328 p = s;
329 GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
330 len = aptl[TXTBOX_TOPRIGHT].x;
331 do {
332 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
333 if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
334 p++;
335 else
336 break;
337 }
338 while (*p);
339 if (*p) {
340 GpiSetMix(hps, FM_OVERPAINT);
341 GpiSetColor(hps, CLR_BLACK);
342 ptl.x = 3;
343 ptl.y = ((rcl.yTop / 2) -
344 ((aptl[TXTBOX_TOPRIGHT].y +
345 aptl[TXTBOX_BOTTOMLEFT].y) / 2));
346 GpiMove(hps, &ptl);
347 if (p != s)
348 GpiCharString(hps, 3, "...");
349 GpiCharString(hps, strlen(p), p);
350 }
351 }
352 free(s);
353 }
354 if (releaseme)
355 WinReleasePS(hps);
356 }
357}
358
359VOID PaintRecessedWindow(HWND hwnd, HPS hps, BOOL outtie, BOOL dbl)
360{
361 /*
362 * paint a recessed box around the window
363 * two pixels width required around window for painting...
364 */
365 BOOL releaseme = FALSE;
366
367 if (!hps) {
368 hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT));
369 releaseme = TRUE;
370 }
371 if (hps) {
372
373 POINTL ptl;
374 SWP swp;
375
376 WinQueryWindowPos(hwnd, &swp);
377 ptl.x = swp.x - 1;
378 ptl.y = swp.y - 1;
379 GpiMove(hps, &ptl);
380 if (!outtie)
381 GpiSetColor(hps, CLR_WHITE);
382 else
383 GpiSetColor(hps, CLR_DARKGRAY);
384 ptl.x = swp.x + swp.cx;
385 GpiLine(hps, &ptl);
386 ptl.y = swp.y + swp.cy;
387 GpiLine(hps, &ptl);
388 if (dbl) {
389 ptl.x = swp.x - 2;
390 ptl.y = swp.y - 2;
391 GpiMove(hps, &ptl);
392 ptl.x = swp.x + swp.cx + 1;
393 GpiLine(hps, &ptl);
394 ptl.y = swp.y + swp.cy + 1;
395 GpiLine(hps, &ptl);
396 }
397 if (!outtie)
398 GpiSetColor(hps, CLR_DARKGRAY);
399 else
400 GpiSetColor(hps, CLR_WHITE);
401 if (dbl) {
402 ptl.x = swp.x - 2;
403 GpiLine(hps, &ptl);
404 ptl.y = swp.y - 2;
405 GpiLine(hps, &ptl);
406 ptl.x = swp.x + swp.cx;
407 ptl.y = swp.y + swp.cy;
408 GpiMove(hps, &ptl);
409 }
410 ptl.x = swp.x - 1;
411 GpiLine(hps, &ptl);
412 ptl.y = swp.y - 1;
413 GpiLine(hps, &ptl);
414 GpiSetColor(hps, CLR_PALEGRAY);
415 ptl.x = swp.x - (2 + (dbl != FALSE));
416 ptl.y = swp.y - (2 + (dbl != FALSE));
417 GpiMove(hps, &ptl);
418 ptl.x = swp.x + swp.cx + (1 + (dbl != FALSE));
419 GpiLine(hps, &ptl);
420 ptl.y = swp.y + swp.cy + (1 + (dbl != FALSE));
421 GpiLine(hps, &ptl);
422 ptl.x = swp.x - (2 + (dbl != FALSE));
423 GpiLine(hps, &ptl);
424 ptl.y = swp.y - (2 + (dbl != FALSE));
425 GpiLine(hps, &ptl);
426 if (releaseme)
427 WinReleasePS(hps);
428 }
429}
430
431BOOL AdjustCnrColVis(HWND hwndCnr, PCSZ title, BOOL visible, BOOL toggle)
432{
433 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
434 CM_QUERYDETAILFIELDINFO,
435 MPVOID, MPFROMSHORT(CMA_FIRST));
436
437 while (pfi) {
438 if (!strcmp(pfi->pTitleData, title)) {
439 if (toggle) {
440 if (pfi->flData & CFA_INVISIBLE)
441 pfi->flData &= (~CFA_INVISIBLE);
442 else
443 pfi->flData |= CFA_INVISIBLE;
444 return !(pfi->flData & CFA_INVISIBLE);
445 }
446 else {
447 if (visible)
448 pfi->flData &= (~CFA_INVISIBLE);
449 else
450 pfi->flData |= CFA_INVISIBLE;
451 }
452 return TRUE;
453 }
454 pfi = pfi->pNextFieldInfo;
455 }
456 return FALSE;
457}
458
459BOOL AdjustCnrColRO(HWND hwndCnr, PCSZ title, BOOL readonly, BOOL toggle)
460{
461 PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
462 CM_QUERYDETAILFIELDINFO,
463 MPVOID, MPFROMSHORT(CMA_FIRST));
464
465 while (pfi) {
466 if (!strcmp(pfi->pTitleData, title)) {
467 if (toggle) {
468 if (pfi->flData & CFA_FIREADONLY)
469 pfi->flData &= (~CFA_FIREADONLY);
470 else
471 pfi->flData |= CFA_FIREADONLY;
472 return (pfi->flData & CFA_FIREADONLY);
473 }
474 else {
475 if (!readonly)
476 pfi->flData &= (~CFA_FIREADONLY);
477 else
478 pfi->flData |= CFA_FIREADONLY;
479 }
480 return TRUE;
481 }
482 pfi = pfi->pNextFieldInfo;
483 }
484 return FALSE;
485}
486
487VOID AdjustCnrColsForFSType(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS *pds, BOOL compare)
488{
489 CHAR FileSystem[CCHMAXPATH];
490 INT x;
491 BOOL hasCreateDT;
492 BOOL hasAccessDT;
493 BOOL hasLongNames;
494 BOOL hasSubjects;
495
496 if (!directory || !*directory)
497 return;
498 x = CheckDrive(toupper(*directory), FileSystem, NULL);
499 if (x != -1) {
500 x = toupper(*directory) - 'A';
501 if (!stricmp(FileSystem, HPFS) ||
502 !stricmp(FileSystem, JFS) ||
503 !stricmp(FileSystem, FAT32) ||
504 !stricmp(FileSystem, RAMFS) ||
505 !stricmp(FileSystem, NDFS32) ||
506 !stricmp(FileSystem, NTFS) ||
507 !stricmp(FileSystem, HPFS386)) {
508 hasCreateDT = TRUE;
509 hasAccessDT = TRUE;
510 if (driveflags[x] & DRIVE_NOEASUPPORT) {
511 hasSubjects = FALSE;
512 hasLongNames = FALSE;
513 }
514 else {
515 hasSubjects = TRUE;
516 hasLongNames = TRUE;
517 }
518 }
519 else if (!strcmp(FileSystem, CDFS) || !strcmp(FileSystem, ISOFS)) {
520 hasCreateDT = TRUE;
521 hasAccessDT = FALSE;
522 if (driveflags[x] & DRIVE_NOEASUPPORT) {
523 hasSubjects = FALSE;
524 hasLongNames = FALSE;
525 }
526 else {
527 hasSubjects = TRUE;
528 hasLongNames = TRUE;
529 }
530 }
531 else {
532 // Assume FAT
533 hasCreateDT = FALSE;
534 hasAccessDT = FALSE;
535 if (driveflags[x] & DRIVE_NOEASUPPORT) {
536 hasSubjects = FALSE;
537 hasLongNames = FALSE;
538 }
539 else {
540 hasSubjects = TRUE;
541 hasLongNames = TRUE;
542 }
543 }
544 }
545 else {
546 // Assume FAT
547 hasCreateDT = FALSE;
548 hasAccessDT = FALSE;
549 if (driveflags[x] & DRIVE_NOEASUPPORT) {
550 hasSubjects = FALSE;
551 hasLongNames = FALSE;
552 }
553 else {
554 hasSubjects = TRUE;
555 hasLongNames = TRUE;
556 }
557 }
558 AdjustCnrColVis(hwndCnr,
559 GetPString(IDS_LADATE),
560 pds->detailsladate ? hasAccessDT : FALSE,
561 FALSE);
562 AdjustCnrColVis(hwndCnr,
563 GetPString(IDS_LATIME),
564 pds->detailslatime ? hasAccessDT : FALSE,
565 FALSE);
566 AdjustCnrColVis(hwndCnr,
567 GetPString(IDS_CRDATE),
568 pds->detailscrdate ? hasCreateDT : FALSE,
569 FALSE);
570 AdjustCnrColVis(hwndCnr,
571 GetPString(IDS_CRTIME),
572 pds->detailscrtime ? hasCreateDT : FALSE,
573 FALSE);
574 if (pds->detailslongname && !pds->detailssubject && hasSubjects) {
575 AdjustCnrColVis(hwndCnr,
576 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
577 TRUE,
578 FALSE);
579 AdjustCnrColVis(hwndCnr,
580 GetPString(IDS_LNAME),
581 pds->detailslongname ? hasLongNames : FALSE,
582 FALSE);
583 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
584 }
585 else
586 AdjustCnrColVis(hwndCnr,
587 GetPString(IDS_LNAME),
588 pds->detailslongname ? hasLongNames : FALSE,
589 FALSE);
590 AdjustCnrColVis(hwndCnr,
591 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
592 pds->detailssubject ? hasSubjects : FALSE,
593 FALSE);
594 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
595}
596
597VOID AdjustCnrColsForPref(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS *pds,
598 BOOL compare)
599{
600 AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE);
601 AdjustCnrColVis(hwndCnr, GetPString(IDS_ICON), pds->detailsicon, FALSE);
602 AdjustCnrColVis(hwndCnr, GetPString(IDS_LWDATE), pds->detailslwdate, FALSE);
603 AdjustCnrColVis(hwndCnr, GetPString(IDS_LWTIME), pds->detailslwtime, FALSE);
604 AdjustCnrColVis(hwndCnr, GetPString(IDS_EA), pds->detailsea, FALSE);
605 AdjustCnrColVis(hwndCnr, GetPString(IDS_SIZE), pds->detailssize, FALSE);
606
607 if (!directory) {
608 AdjustCnrColVis(hwndCnr,
609 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
610 pds->detailssubject,
611 FALSE);
612 AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), pds->detailsladate, FALSE);
613 AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), pds->detailslatime, FALSE);
614 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), pds->detailscrdate, FALSE);
615 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), pds->detailscrtime, FALSE);
616 AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), pds->detailslongname, FALSE);
617 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
618 }
619 else {
620 AdjustCnrColsForFSType(hwndCnr, directory, pds, compare);
621 }
622}
623
624BOOL SetCnrCols(HWND hwndCnr, BOOL isCompCnr)
625{
626 BOOL fSuccess = TRUE;
627 PFIELDINFO pfi, pfiLastLeftCol, pfiIconCol;
628
629 // Allocate storage for container column data
630
631 pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO,
632 MPFROMLONG(CONTAINER_COLUMNS), NULL);
633
634 if (!pfi) {
635 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCDETAILFIELDINFO");
636 fSuccess = FALSE;
637 }
638 else {
639
640 PFIELDINFO pfiFirst;
641 FIELDINFOINSERT fii;
642
643 // Store original value of pfi so we won't lose it when it changes.
644 // This will be needed on the CM_INSERTDETAILFIELDINFO message.
645
646 pfiFirst = pfi;
647
648 // Fill in column information for the icon column
649
650 pfi->flData = CFA_BITMAPORICON | CFA_CENTER | CFA_FIREADONLY;
651 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
652 pfi->pTitleData = (PSZ)GetPString(IDS_ICON);
653 pfi->offStruct = FIELDOFFSET(MINIRECORDCORE, hptrIcon);
654
655 pfiIconCol = pfi;
656
657 // Fill in column information for the file name. Note that we are
658 // using the pszDisplayName variable rather than pszFileName. We do this
659 // because the container does not always display the full path file name.
660
661 pfi = pfi->pNextFieldInfo;
662
663 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
664 pfi->flTitle = CFA_LEFT;
665 pfi->pTitleData = (PSZ)GetPString(IDS_FILENAME);
666 pfi->offStruct = FIELDOFFSET(CNRITEM, pszDisplayName);
667
668 // Fill in column information for the longname.
669
670 pfi = pfi->pNextFieldInfo;
671 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
672 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
673 pfi->pTitleData = (PSZ)GetPString(IDS_LNAME);
674 pfi->offStruct = FIELDOFFSET(CNRITEM, pszLongName);
675 pfiLastLeftCol = pfi;
676
677 // Store the current pfi value as that will be used to indicate the
678 // last column in the lefthand container window (we have a splitbar)
679 if (!dsDirCnrDefault.fSubjectInLeftPane)
680 pfiLastLeftCol = pfi;
681 else
682 pfiLastLeftCol = pfi->pNextFieldInfo;
683
684 // Fill in column info for subjects
685 pfi = pfi->pNextFieldInfo;
686 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
687 if (isCompCnr)
688 pfi->flData |= CFA_FIREADONLY;
689 pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
690 pfi->pTitleData = isCompCnr ? (PSZ)GetPString(IDS_STATUS) :
691 (PSZ)GetPString(IDS_SUBJ);
692 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
693 pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
694
695 // Fill in column information for the file size
696
697 pfi = pfi->pNextFieldInfo;
698 pfi->flData = CFA_STRING | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
699 pfi->flTitle = CFA_CENTER;
700 pfi->pTitleData = (PSZ)GetPString(IDS_SIZE);
701 pfi->offStruct = FIELDOFFSET(CNRITEM, pszFmtFileSize);
702
703
704 // Fill in the column information for the file's ea size
705
706 pfi = pfi->pNextFieldInfo;
707 pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
708 pfi->flTitle = CFA_CENTER;
709 pfi->pTitleData = (PSZ)GetPString(IDS_EA);
710 pfi->offStruct = FIELDOFFSET(CNRITEM, easize);
711
712 // Fill in the column information for the file attribute
713
714 pfi = pfi->pNextFieldInfo;
715 pfi->flData = CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
716 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
717 pfi->pTitleData = (PSZ)GetPString(IDS_ATTR);
718 pfi->offStruct = FIELDOFFSET(CNRITEM, pszDispAttr);
719
720 // Fill in column information for last write file date
721
722 pfi = pfi->pNextFieldInfo;
723 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
724 pfi->flTitle = CFA_CENTER;
725 pfi->pTitleData = (PSZ)GetPString(IDS_LWDATE);
726 pfi->offStruct = FIELDOFFSET(CNRITEM, date);
727
728 // Fill in column information for the last write file time
729
730 pfi = pfi->pNextFieldInfo;
731 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
732 pfi->flTitle = CFA_CENTER;
733 pfi->pTitleData = (PSZ)GetPString(IDS_LWTIME);
734 pfi->offStruct = FIELDOFFSET(CNRITEM, time);
735
736 // Fill in column information for last access file date
737
738 pfi = pfi->pNextFieldInfo;
739 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
740 pfi->flTitle = CFA_CENTER;
741 pfi->pTitleData = (PSZ)GetPString(IDS_LADATE);
742 pfi->offStruct = FIELDOFFSET(CNRITEM, ladate);
743
744 // Fill in column information for the last access file time
745
746 pfi = pfi->pNextFieldInfo;
747 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
748 pfi->flTitle = CFA_CENTER;
749 pfi->pTitleData = (PSZ)GetPString(IDS_LATIME);
750 pfi->offStruct = FIELDOFFSET(CNRITEM, latime);
751
752 // Fill in column information for create file date
753
754 pfi = pfi->pNextFieldInfo;
755 pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
756 pfi->flTitle = CFA_CENTER;
757 pfi->pTitleData = (PSZ)GetPString(IDS_CRDATE);
758 pfi->offStruct = FIELDOFFSET(CNRITEM, crdate);
759
760 // Fill in column information for the create file time
761
762 pfi = pfi->pNextFieldInfo;
763 pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
764 pfi->flTitle = CFA_CENTER;
765 pfi->pTitleData = (PSZ)GetPString(IDS_CRTIME);
766 pfi->offStruct = FIELDOFFSET(CNRITEM, crtime);
767
768 // Use the CM_INSERTDETAILFIELDINFO message to tell the container
769 // all the column information it needs to function properly. Place
770 // this column info first in the column list and update the display
771 // after they are inserted (fInvalidateFieldInfo = TRUE)
772
773 (void)memset(&fii, 0, sizeof(FIELDINFOINSERT));
774
775 fii.cb = sizeof(FIELDINFOINSERT);
776 fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
777 fii.cFieldInfoInsert = (SHORT) CONTAINER_COLUMNS;
778 fii.fInvalidateFieldInfo = TRUE;
779
780 if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst),
781 MPFROMP(&fii))) {
782 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO");
783 fSuccess = FALSE;
784 }
785 }
786
787 if (fSuccess) {
788
789 CNRINFO cnri;
790 ULONG size;
791
792 // Tell the container about the splitbar and where it goes
793
794 cnri.cb = sizeof(CNRINFO);
795 cnri.pFieldInfoLast = pfiLastLeftCol;
796 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
797 cnri.pFieldInfoObject = pfiIconCol;
798 size = sizeof(LONG);
799 PrfQueryProfileData(fmprof,
800 appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
801 if (cnri.xVertSplitbar <= 0)
802 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
803 if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri),
804 MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
805 CMA_XVERTSPLITBAR))) {
806 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO");
807 fSuccess = FALSE;
808 }
809 }
810
811 return fSuccess;
812}
813
814MRESULT CnrDirectEdit(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
815{
816 switch (SHORT2FROMMP(mp1)) {
817 case CN_BEGINEDIT:
818 if (mp2) {
819 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
820 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
821
822 if (pci &&
823 (INT) pci != -1 &&
824 !IsRoot(pci->pszFileName) &&
825 !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
826 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
827 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
828 }
829 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
830 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
831 else
832 PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
833 }
834 else
835 PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
836 }
837 break;
838
839 case CN_REALLOCPSZ:
840 if (mp2) {
841 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
842 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
843 CHAR szData[CCHMAXPATH], testname[CCHMAXPATH];
844 HWND hwndMLE = WinWindowFromID(hwnd, CID_MLE);
845 BOOL fResetVerify = FALSE;
846
847 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
848 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
849
850 APIRET rc;
851 EAOP2 eaop;
852 PFEA2LIST pfealist = NULL;
853 CHAR szSubject[1048];
854 ULONG ealen;
855 USHORT len;
856 CHAR *eaval;
857 LONG retlen;
858 PSZ psz;
859
860 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
861 szSubject[retlen + 1] = 0;
862 bstrip(szSubject);
863 if (pci->pszSubject != NullStr) {
864 if (retlen == 0) {
865 psz = pci->pszSubject;
866 pci->pszSubject = NullStr;
867 xfree(psz, pszSrcFile, __LINE__);
868 }
869 else
870 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
871 }
872 else {
873 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
874 if (!pci->pszSubject)
875 return FALSE;
876 }
877 len = strlen(szSubject);
878 if (len)
879 ealen = sizeof(FEA2LIST) + 9 + len + 4;
880 else
881 ealen = sizeof(FEALIST) + 9;
882 rc = xDosAllocMem((PPVOID) & pfealist, ealen + 64,
883 PAG_COMMIT | PAG_READ | PAG_WRITE, pszSrcFile, __LINE__);
884 if (rc)
885 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
886 __LINE__, GetPString(IDS_OUTOFMEMORY));
887 else {
888 memset(pfealist, 0, ealen + 1);
889 pfealist->cbList = ealen;
890 pfealist->list[0].oNextEntryOffset = 0;
891 pfealist->list[0].fEA = 0;
892 pfealist->list[0].cbName = 8;
893 strcpy(pfealist->list[0].szName, SUBJECT);
894 if (len) {
895 eaval = pfealist->list[0].szName + 9;
896 *(USHORT *) eaval = (USHORT) EAT_ASCII;
897 eaval += sizeof(USHORT);
898 *(USHORT *) eaval = (USHORT) len;
899 eaval += sizeof(USHORT);
900 memcpy(eaval, szSubject, len);
901 pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
902 }
903 else
904 pfealist->list[0].cbValue = 0;
905 eaop.fpGEA2List = (PGEA2LIST) 0;
906 eaop.fpFEA2List = pfealist;
907 eaop.oError = 0;
908 rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
909 &eaop, sizeof(eaop), DSPI_WRTTHRU);
910 DosFreeMem(pfealist);
911 if (rc)
912 return FALSE;
913 }
914 return (MRESULT) TRUE;
915 }
916 else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
917
918 CHAR longname[CCHMAXPATHCOMP];
919 LONG retlen;
920 PSZ psz;
921
922 *longname = 0;
923 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
924 longname[retlen + 1] = 0;
925 chop_at_crnl(longname);
926 bstrip(longname);
927 WinSetWindowText(hwndMLE, longname);
928 if (pci->pszLongName != NullStr) {
929 if (retlen == 0) {
930 psz = pci->pszLongName;
931 pci->pszLongName = NullStr;
932 xfree(psz, pszSrcFile, __LINE__);
933 }
934 else
935 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
936 }
937 else {
938 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
939 if (!pci->pszLongName)
940 return FALSE;
941 }
942 return (MRESULT) WriteLongName(pci->pszFileName, longname);
943 }
944 else {
945 WinQueryWindowText(hwndMLE, sizeof(szData), szData);
946 if (strchr(szData, '?') ||
947 strchr(szData, '*') || IsRoot(pci->pszFileName))
948 return (MRESULT) FALSE;
949 /* If the text changed, rename the file system object. */
950 chop_at_crnl(szData);
951 bstrip(szData);
952 if (!IsFullName(szData))
953 Runtime_Error(pszSrcFile, __LINE__, "bad name");
954 else {
955 if (DosQueryPathInfo(szData,
956 FIL_QUERYFULLNAME,
957 testname, sizeof(testname)))
958 return FALSE;
959 if (DosQueryPathInfo(pci->pszFileName,
960 FIL_QUERYFULLNAME,
961 szData,
962 sizeof(szData)))
963 {
964 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
965 strcpy(szData, pci->pszFileName);
966 }
967 WinSetWindowText(hwndMLE, szData);
968 if (strcmp(szData, testname)) {
969 if (stricmp(szData, testname) && IsFile(testname) != -1) {
970 if (!fAlertBeepOff)
971 DosBeep(50, 100); /* exists; disallow */
972 return (MRESULT) FALSE;
973 }
974 if (fVerify && (driveflags[toupper(*szData) - 'A'] & DRIVE_WRITEVERIFYOFF ||
975 driveflags[toupper(*testname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
976 DosSetVerify(FALSE);
977 fResetVerify = TRUE;
978 }
979 if (docopyf(MOVE, szData, testname))
980 Runtime_Error(pszSrcFile, __LINE__, "docopyf");
981 else {
982 CHAR *filename;
983
984 filename = xstrdup(testname, pszSrcFile, __LINE__);
985 if (filename) {
986 if (!PostMsg(hwnd,
987 UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
988 free(filename);
989 }
990 if (stricmp(testname, pci->pszFileName)) {
991 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
992 filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
993 if (filename) {
994 if (!PostMsg(hwnd,
995 UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
996 free(filename);
997 }
998 }
999 }
1000 if (fResetVerify) {
1001 DosSetVerify(fVerify);
1002 fResetVerify = FALSE;
1003 }
1004 }
1005 }
1006 }
1007 }
1008 }
1009 return FALSE;
1010
1011 case CN_ENDEDIT:
1012 if (mp2) {
1013 PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
1014 PCNRITEM pci = (PCNRITEM) ((PCNREDITDATA) mp2)->pRecord;
1015
1016 if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
1017 WinSendMsg(hwnd,
1018 CM_INVALIDATERECORD,
1019 MPFROMP(&pci),
1020 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
1021 if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
1022 PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
1023 }
1024 else {
1025 USHORT cmd = 0;
1026
1027 if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
1028 cmd = IDM_SORTSMARTNAME;
1029 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
1030 cmd = IDM_SORTSIZE;
1031 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
1032 cmd = IDM_SORTEASIZE;
1033 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
1034 cmd = IDM_SORTLWDATE;
1035 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
1036 cmd = IDM_SORTLWDATE;
1037 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
1038 cmd = IDM_SORTLADATE;
1039 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
1040 cmd = IDM_SORTLADATE;
1041 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
1042 cmd = IDM_SORTCRDATE;
1043 else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
1044 cmd = IDM_SORTCRDATE;
1045 if (cmd)
1046 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
1047 }
1048 }
1049 break;
1050 }
1051 return (MRESULT) - 1;
1052}
1053
1054BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle,
1055 PCSZ savename)
1056{
1057 if (toggle) {
1058 *bool = *bool ? FALSE : TRUE;
1059 if (savename && *savename)
1060 PrfWriteProfileData(fmprof, appname, (CHAR *) savename, bool, sizeof(BOOL));
1061 }
1062 WinSendMsg(hwndMenu, MM_SETITEMATTR,
1063 MPFROM2SHORT(id, 1),
1064 MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
1065 return *bool;
1066}
1067
1068//== disable_menuitem() disable or enable_menuitem ==
1069
1070VOID disable_menuitem(HWND hwndMenu, USHORT id, BOOL disable)
1071{
1072 WinSendMsg(hwndMenu, MM_SETITEMATTR,
1073 MPFROM2SHORT(id, TRUE),
1074 MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
1075}
1076
1077//== ViewHelp() invoke view.exe, return TRUE if OK ==
1078
1079BOOL ViewHelp(PCSZ filename)
1080{
1081 CHAR s[CCHMAXPATH + 81];
1082 CHAR szQuotedFileName[CCHMAXPATH];
1083 FILE *fp;
1084 INT ret = -1;
1085
1086 fp = _fsopen(filename, "rb", SH_DENYNO);
1087 if (fp) {
1088 *s = 0;
1089 fread(s, 1, 3, fp);
1090 if (*s != 'H' || s[1] != 'S' || s[2] != 'P') {
1091 fclose(fp);
1092 return FALSE;
1093 }
1094 fclose(fp);
1095 ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
1096 NULL, NULL,
1097 "VIEW.EXE \"%s\"",
1098 BldQuotedFileName(szQuotedFileName, filename));
1099 }
1100
1101 return (ret != -1);
1102}
1103
1104//== ExecFile() run file, return 1 if OK 0 if skipped -1 if can't run ==
1105
1106INT ExecFile(HWND hwnd, PCSZ filename)
1107{
1108 EXECARGS ex;
1109 CHAR path[CCHMAXPATH], *p;
1110 PSZ pszCmdLine;
1111 APIRET ret;
1112 static INT lastflags = 0;
1113
1114 strcpy(path, filename);
1115 p = strrchr(path, '\\');
1116 if (!p)
1117 p = strrchr(path, ':');
1118 if (p) {
1119 if (*p == ':') {
1120 p++;
1121 *p = '\\';
1122 p++;
1123 }
1124 *p = 0;
1125 }
1126 else
1127 *path = 0;
1128 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
1129 if (pszCmdLine) {
1130 BldQuotedFileName(pszCmdLine, filename);
1131 memset(&ex, 0, sizeof(ex));
1132 ex.flags = lastflags;
1133 ex.commandline = pszCmdLine;
1134 *ex.path = 0;
1135 *ex.environment = 0;
1136 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
1137 EXEC_FRAME, &ex);
1138 if (ret == 1) {
1139 lastflags = ex.flags;
1140 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path,
1141 *ex.environment ? ex.environment : NULL,
1142 "%s", pszCmdLine) != -1;
1143 }
1144 else if (ret != 0)
1145 return -1;
1146 free(pszCmdLine);
1147 }
1148 return 0;
1149}
1150
1151VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds)
1152{
1153 WinCheckMenuItem(hwnd, IDM_SHOWLNAMES, pds->detailslongname);
1154 WinCheckMenuItem(hwnd, IDM_SHOWSUBJECT, pds->detailssubject);
1155 WinCheckMenuItem(hwnd, IDM_SHOWEAS, pds->detailsea);
1156 WinCheckMenuItem(hwnd, IDM_SHOWSIZE, pds->detailssize);
1157 WinCheckMenuItem(hwnd, IDM_SHOWICON, pds->detailsicon);
1158 WinCheckMenuItem(hwnd, IDM_SHOWLWDATE, pds->detailslwdate);
1159 WinCheckMenuItem(hwnd, IDM_SHOWLWTIME, pds->detailslwtime);
1160 WinCheckMenuItem(hwnd, IDM_SHOWLADATE, pds->detailsladate);
1161 WinCheckMenuItem(hwnd, IDM_SHOWLATIME, pds->detailslatime);
1162 WinCheckMenuItem(hwnd, IDM_SHOWCRDATE, pds->detailscrdate);
1163 WinCheckMenuItem(hwnd, IDM_SHOWCRTIME, pds->detailscrtime);
1164 WinCheckMenuItem(hwnd, IDM_SHOWATTR, pds->detailsattr);
1165}
1166
1167VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
1168 PCSZ directory, PCSZ keyroot,
1169 DETAILS_SETTINGS * pds, BOOL compare)
1170{
1171 BOOL *bool = NULL;
1172
1173 switch (cmd) {
1174 case IDM_SHOWLNAMES:
1175 bool = &pds->detailslongname;
1176 break;
1177 case IDM_SHOWSUBJECT:
1178 bool = &pds->detailssubject;
1179 break;
1180 case IDM_SHOWEAS:
1181 bool = &pds->detailsea;
1182 break;
1183 case IDM_SHOWSIZE:
1184 bool = &pds->detailssize;
1185 break;
1186 case IDM_SHOWICON:
1187 bool = &pds->detailsicon;
1188 break;
1189 case IDM_SHOWLWDATE:
1190 bool = &pds->detailslwdate;
1191 break;
1192 case IDM_SHOWLWTIME:
1193 bool = &pds->detailslwtime;
1194 break;
1195 case IDM_SHOWLADATE:
1196 bool = &pds->detailsladate;
1197 break;
1198 case IDM_SHOWLATIME:
1199 bool = &pds->detailslatime;
1200 break;
1201 case IDM_SHOWCRDATE:
1202 bool = &pds->detailscrdate;
1203 break;
1204 case IDM_SHOWCRTIME:
1205 bool = &pds->detailscrtime;
1206 break;
1207 case IDM_SHOWATTR:
1208 bool = &pds->detailsattr;
1209 break;
1210 default:
1211 if (hwndMenu)
1212 SetDetailsSwitches(hwndMenu, pds);
1213 return;
1214 }
1215 if (bool)
1216 *bool = *bool ? FALSE : TRUE;
1217 if (hwnd)
1218 AdjustCnrColsForPref(hwnd, directory, pds, compare);
1219 if (hwndMenu)
1220 SetDetailsSwitches(hwndMenu, pds);
1221}
1222
1223/**
1224 * Set default menu item to invoke for top level conditional cascade menu
1225 * @param def is default menu id (i.e. IDM_...)
1226 */
1227
1228VOID SetConditionalCascade(HWND hwndMenu, USHORT id, USHORT def)
1229{
1230 MENUITEM mi;
1231
1232 mi.iPosition = MIT_END;
1233 mi.hItem = 0;
1234 mi.hwndSubMenu = (HWND)0;
1235 mi.afAttribute = 0;
1236 mi.afStyle = MIS_TEXT;
1237 if (WinSendMsg(hwndMenu,
1238 MM_QUERYITEM,
1239 MPFROM2SHORT(id, TRUE),
1240 MPFROMP(&mi)))
1241 {
1242 WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE,
1243 MS_CONDITIONALCASCADE);
1244 WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID);
1245 WinCheckMenuItem(mi.hwndSubMenu, def, TRUE);
1246 }
1247}
1248
1249VOID SetSortChecks(HWND hwndMenu, INT sortflags)
1250{
1251 WinCheckMenuItem(hwndMenu, IDM_SORTNONE, FALSE);
1252 WinCheckMenuItem(hwndMenu, IDM_SORTFIRST, FALSE);
1253 WinCheckMenuItem(hwndMenu, IDM_SORTLAST, FALSE);
1254 WinCheckMenuItem(hwndMenu, IDM_SORTSIZE, FALSE);
1255 WinCheckMenuItem(hwndMenu, IDM_SORTEASIZE, FALSE);
1256 WinCheckMenuItem(hwndMenu, IDM_SORTLWDATE, FALSE);
1257 WinCheckMenuItem(hwndMenu, IDM_SORTLADATE, FALSE);
1258 WinCheckMenuItem(hwndMenu, IDM_SORTCRDATE, FALSE);
1259 WinCheckMenuItem(hwndMenu, IDM_SORTFILENAME, FALSE);
1260 WinCheckMenuItem(hwndMenu, IDM_SORTNAME, FALSE);
1261 WinCheckMenuItem(hwndMenu, IDM_SORTSUBJECT, FALSE);
1262 WinCheckMenuItem(hwndMenu, IDM_SORTDIRSFIRST, FALSE);
1263 WinCheckMenuItem(hwndMenu, IDM_SORTDIRSLAST, FALSE);
1264 WinCheckMenuItem(hwndMenu, IDM_SORTREVERSE, FALSE);
1265 if (sortflags & SORT_FIRSTEXTENSION)
1266 WinCheckMenuItem(hwndMenu, IDM_SORTFIRST, TRUE);
1267 else if (sortflags & SORT_LASTEXTENSION)
1268 WinCheckMenuItem(hwndMenu, IDM_SORTLAST, TRUE);
1269 else if (sortflags & SORT_SIZE)
1270 WinCheckMenuItem(hwndMenu, IDM_SORTSIZE, TRUE);
1271 else if (sortflags & SORT_EASIZE)
1272 WinCheckMenuItem(hwndMenu, IDM_SORTEASIZE, TRUE);
1273 else if (sortflags & SORT_LWDATE)
1274 WinCheckMenuItem(hwndMenu, IDM_SORTLWDATE, TRUE);
1275 else if (sortflags & SORT_LADATE)
1276 WinCheckMenuItem(hwndMenu, IDM_SORTLADATE, TRUE);
1277 else if (sortflags & SORT_CRDATE)
1278 WinCheckMenuItem(hwndMenu, IDM_SORTCRDATE, TRUE);
1279 else if (sortflags & SORT_FILENAME)
1280 WinCheckMenuItem(hwndMenu, IDM_SORTFILENAME, TRUE);
1281 else if (sortflags & SORT_NOSORT)
1282 WinCheckMenuItem(hwndMenu, IDM_SORTNONE, TRUE);
1283 else if (sortflags & SORT_SUBJECT)
1284 WinCheckMenuItem(hwndMenu, IDM_SORTSUBJECT, TRUE);
1285 else
1286 WinCheckMenuItem(hwndMenu, IDM_SORTNAME, TRUE);
1287 if (sortflags & SORT_DIRSFIRST)
1288 WinCheckMenuItem(hwndMenu, IDM_SORTDIRSFIRST, TRUE);
1289 else if (sortflags & SORT_DIRSLAST)
1290 WinCheckMenuItem(hwndMenu, IDM_SORTDIRSLAST, TRUE);
1291 if (sortflags & SORT_REVERSE)
1292 WinCheckMenuItem(hwndMenu, IDM_SORTREVERSE, TRUE);
1293}
1294
1295VOID FcloseFile(FILE * fp)
1296{
1297 /* for use by apps that don't use the DLLs runtime library */
1298 fclose(fp);
1299}
1300
1301VOID SetupCommandMenu(HWND hwndMenu, HWND hwndCnr)
1302{
1303 MENUITEM mi, mit;
1304 INT x;
1305 SHORT numitems;
1306 LINKCMDS *info;
1307
1308 if (!cmdloaded)
1309 load_commands();
1310 mi.iPosition = MIT_END;
1311 mi.hwndSubMenu = (HWND) 0;
1312 mi.hItem = 0L;
1313 mi.afAttribute = 0;
1314 mi.afStyle = MIS_TEXT;
1315 memset(&mit, 0, sizeof(MENUITEM));
1316 if (WinQueryWindowUShort(hwndMenu, QWS_ID) == IDM_COMMANDSMENU)
1317 mit.hwndSubMenu = hwndMenu;
1318 else
1319 WinSendMsg(hwndMenu, MM_QUERYITEM,
1320 MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
1321 if (mit.hwndSubMenu) {
1322 numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT,
1323 MPVOID, MPVOID);
1324 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID);
1325 info = cmdhead;
1326 while (info) {
1327 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM,
1328 MPFROMSHORT((SHORT) (info->ID)), MPVOID);
1329 x++;
1330 info = info->next;
1331 }
1332 while (numitems != MIT_ERROR) { // Delete items that were deleted from commands since the ID is gone
1333 numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_ITEMIDFROMPOSITION,
1334 MPFROMSHORT((SHORT) 1), MPVOID);
1335 WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM,
1336 MPFROMSHORT(numitems), MPVOID);
1337 }
1338 if (hwndCnr && cmdhead) {
1339 x = 0;
1340 info = cmdhead;
1341 while (info) {
1342
1343 CHAR s[CCHMAXPATH + 24];
1344
1345 sprintf(s,
1346 "%s {%i} %s%s%s",
1347 info->title, info->ID,
1348 info->HotKeyID && info->HotKeyID < IDM_COMMANDNUM20 ? "\tCtrl + " : NullStr,
1349 info->HotKeyID && info->HotKeyID > IDM_COMMANDNUM19 ? "\tAlt + " : NullStr,
1350 info->HotKeyID && ((info->HotKeyID > IDM_COMMANDNUM9 &&
1351 info->HotKeyID < IDM_COMMANDNUM20) ||
1352 info->HotKeyID > IDM_COMMANDNUM29) ? "Shift + " : NullStr);
1353 if (info->HotKeyID)
1354 sprintf(&s[strlen(s)], "%d",
1355 (((info->HotKeyID - IDM_COMMANDNUM0) % 10) + 1) == 10 ? 0 :
1356 ((info->HotKeyID - IDM_COMMANDNUM0) % 10) + 1);
1357 mi.id = (USHORT) info->ID;
1358 mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
1359 (info->flags & PROMPT ? MIA_FRAMED : 0);
1360 mi.afStyle = MIS_TEXT;
1361 if (!(x % 20) && x && info->next)
1362 mi.afStyle |= MIS_BREAK;
1363 WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
1364 x++;
1365 info = info->next;
1366 }
1367 }
1368 }
1369}
1370
1371/**
1372 * Loads all the detail switches from the ini file
1373 * state if TRUE skips global only settings
1374 * keyroot shouldn't pass trailing dot
1375 */
1376VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state)
1377{
1378 ULONG size;
1379 CHAR s[CCHMAXPATH], *eos = s;
1380
1381 strcpy(s, keyroot);
1382 strcat(s, ".");
1383 eos = &s[strlen(s)];
1384 strcpy(eos, "DetailsLongname");
1385 pds->detailslongname = dsDirCnrDefault.detailslongname;
1386 size = sizeof(BOOL);
1387 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslongname, &size);
1388 strcpy(eos, "DetailsSubject");
1389 pds->detailssubject = dsDirCnrDefault.detailssubject;
1390 size = sizeof(BOOL);
1391 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssubject, &size);
1392 strcpy(eos, "DetailsEA");
1393 pds->detailsea = dsDirCnrDefault.detailsea;
1394 size = sizeof(BOOL);
1395 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsea, &size);
1396 strcpy(eos, "DetailsSize");
1397 pds->detailssize = dsDirCnrDefault.detailssize;
1398 size = sizeof(BOOL);
1399 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailssize, &size);
1400 strcpy(eos, "DetailsIcon");
1401 pds->detailsicon = dsDirCnrDefault.detailsicon;
1402 size = sizeof(BOOL);
1403 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsicon, &size);
1404 strcpy(eos, "DetailsAttr");
1405 pds->detailsattr = dsDirCnrDefault.detailsattr;
1406 size = sizeof(BOOL);
1407 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsattr, &size);
1408 strcpy(eos, "DetailsCRDate");
1409 pds->detailscrdate = dsDirCnrDefault.detailscrdate;
1410 size = sizeof(BOOL);
1411 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrdate, &size);
1412 strcpy(eos, "DetailsCRTime");
1413 pds->detailscrtime = dsDirCnrDefault.detailscrtime;
1414 size = sizeof(BOOL);
1415 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailscrtime, &size);
1416 strcpy(eos, "DetailsLWDate");
1417 pds->detailslwdate = dsDirCnrDefault.detailslwdate;
1418 size = sizeof(BOOL);
1419 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwdate, &size);
1420 strcpy(eos, "DetailsLWTime");
1421 pds->detailslwtime = dsDirCnrDefault.detailslwtime;
1422 size = sizeof(BOOL);
1423 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslwtime, &size);
1424 strcpy(eos, "DetailsLADate");
1425 pds->detailsladate = dsDirCnrDefault.detailsladate;
1426 size = sizeof(BOOL);
1427 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailsladate, &size);
1428 strcpy(eos, "DetailsLATime");
1429 pds->detailslatime = dsDirCnrDefault.detailslatime;
1430 size = sizeof(BOOL);
1431 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->detailslatime, &size);
1432 if (!state) {
1433 strcpy(eos, "SubjectInLeftPane");
1434 pds->fSubjectInLeftPane = dsDirCnrDefault.fSubjectInLeftPane;
1435 size = sizeof(BOOL);
1436 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectInLeftPane, &size);
1437 strcpy(eos, "SubjectLengthMax");
1438 pds->fSubjectLengthMax = dsDirCnrDefault.fSubjectLengthMax;
1439 size = sizeof(BOOL);
1440 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->fSubjectLengthMax, &size);
1441 if (pds->fSubjectLengthMax)
1442 pds->SubjectDisplayWidth = 0;
1443 else {
1444 strcpy(eos, "SubjectDisplayWidth");
1445 pds->SubjectDisplayWidth = dsDirCnrDefault.SubjectDisplayWidth;
1446 size = sizeof(ULONG);
1447 PrfQueryProfileData(fmprof, appname, s, (PVOID) &pds->SubjectDisplayWidth, &size);
1448 if (pds->SubjectDisplayWidth < 50)
1449 pds->SubjectDisplayWidth = 0;
1450 else if (pds->SubjectDisplayWidth > 1000)
1451 pds->SubjectDisplayWidth = 1000;
1452 }
1453 }
1454}
1455
1456/**
1457 * Writes all the detail switches to the ini file
1458 * state if TRUE skips global only settings
1459 * keyroot shouldn't pass trailing dot
1460 */
1461VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state)
1462{
1463 CHAR s[CCHMAXPATH], *eos = s;
1464
1465 strcpy(s, keyroot);
1466 strcat(s, ".");
1467 eos = &s[strlen(s)];
1468 strcpy(eos, "DetailsLongname");
1469 PrfWriteProfileData(fmprof, appname, s, &pds->detailslongname, sizeof(BOOL));
1470 strcpy(eos, "DetailsSubject");
1471 PrfWriteProfileData(fmprof, appname, s, &pds->detailssubject, sizeof(BOOL));
1472 strcpy(eos, "DetailsEA");
1473 PrfWriteProfileData(fmprof, appname, s, &pds->detailsea, sizeof(BOOL));
1474 strcpy(eos, "DetailsSize");
1475 PrfWriteProfileData(fmprof, appname, s, &pds->detailssize, sizeof(BOOL));
1476 strcpy(eos, "DetailsIcon");
1477 PrfWriteProfileData(fmprof, appname, s, &pds->detailsicon, sizeof(BOOL));
1478 strcpy(eos, "DetailsAttr");
1479 PrfWriteProfileData(fmprof, appname, s, &pds->detailsattr, sizeof(BOOL));
1480 strcpy(eos, "DetailsCRDate");
1481 PrfWriteProfileData(fmprof, appname, s, &pds->detailscrdate, sizeof(BOOL));
1482 strcpy(eos, "DetailsCRTime");
1483 PrfWriteProfileData(fmprof, appname, s, &pds->detailscrtime, sizeof(BOOL));
1484 strcpy(eos, "DetailsLWDate");
1485 PrfWriteProfileData(fmprof, appname, s, &pds->detailslwdate, sizeof(BOOL));
1486 strcpy(eos, "DetailsLWTime");
1487 PrfWriteProfileData(fmprof, appname, s, &pds->detailslwtime, sizeof(BOOL));
1488 strcpy(eos, "DetailsLADate");
1489 PrfWriteProfileData(fmprof, appname, s, &pds->detailsladate, sizeof(BOOL));
1490 strcpy(eos, "DetailsLATime");
1491 PrfWriteProfileData(fmprof, appname, s, &pds->detailslatime, sizeof(BOOL));
1492 if (!state) {
1493 strcpy(eos, "SubjectInLeftPane");
1494 PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectInLeftPane, sizeof(BOOL));
1495 strcpy(eos, "SubjectLengthMax");
1496 PrfWriteProfileData(fmprof, appname, s, &pds->fSubjectLengthMax, sizeof(BOOL));
1497 strcpy(eos, "SubjectDisplayWidth");
1498 PrfWriteProfileData(fmprof, appname, s, &pds->SubjectDisplayWidth, sizeof(ULONG));
1499 }
1500}
1501
1502/**
1503 * Removes the ini entries when a state is deleted
1504 * statename should be NULL for the shutdown state
1505 * (avoids removing global state settings like toolbar)
1506 * keyroot shouldn't pass the trailing dot
1507 */
1508VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename)
1509{
1510 CHAR s[CCHMAXPATH], *eos = s;
1511
1512 strcpy(s, keyroot);
1513 strcat(s, ".");
1514 eos = &s[strlen(s)];
1515 DeletePresParams(s);
1516 strcpy(eos, "DetailsLongname");
1517 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1518 strcpy(eos, "DetailsSubject");
1519 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1520 strcpy(eos, "DetailsEA");
1521 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1522 strcpy(eos, "DetailsSize");
1523 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1524 strcpy(eos, "DetailsIcon");
1525 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1526 strcpy(eos, "DetailsAttr");
1527 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1528 strcpy(eos, "DetailsCRDate");
1529 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1530 strcpy(eos, "DetailsCRTime");
1531 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1532 strcpy(eos, "DetailsLWDate");
1533 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1534 strcpy(eos, "DetailsLWTime");
1535 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1536 strcpy(eos, "DetailsLADate");
1537 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1538 strcpy(eos, "DetailsLATime");
1539 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1540
1541#ifdef NEVER
1542 // activate this code if we ever allow setting of subject location/length per container GKY 3-28-09
1543 strcpy(eos, "SubjectInLeftPane");
1544 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1545 strcpy(eos, "SubjectLengthMax");
1546 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1547 strcpy(eos, "SubjectDisplayWidth");
1548 PrfWriteProfileData(fmprof, appname, s, NULL, 0);
1549#endif
1550
1551 strcpy(eos, "Pos");;
1552 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1553 strcpy(eos, "Sort");
1554 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1555 strcpy(eos, "Filter");
1556 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1557 strcpy(eos, "View");
1558 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1559 strcpy(eos, "Dir");
1560 PrfWriteProfileString(fmprof, FM3Str, s, NULL);
1561 if (statename && strstr(s, ".0.")) {
1562 strcpy(s, statename);
1563 strcat(s, ".");
1564 eos = &s[strlen(s)];
1565 strcpy(eos, "LastTreePos");
1566 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1567 strcpy(eos, "MySizeLastTime");
1568 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
1569 strcpy(eos, "Toolbar");
1570 PrfWriteProfileString(fmprof, FM3Str, s, NULL);
1571 strcpy(eos, "TargetDir");
1572 PrfWriteProfileString(fmprof, FM3Str, s, NULL);
1573 }
1574
1575}
1576
1577/**
1578 * Removes the pre 3.16 style ini entries when a state is deleted
1579 */
1580VOID RemoveOldCnrSwitches(PCSZ szPrefix, ULONG ulTemp)
1581{
1582 CHAR szKey[STATE_NAME_MAX_BYTES + 80];
1583
1584 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
1585 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
1586 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
1587 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
1588 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
1589 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
1590 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
1591 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
1592 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
1593 PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
1594 sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
1595}
1596
1597HWND FindDirCnr(HWND hwndParent)
1598{
1599 HWND found, hwndDir = (HWND) 0;
1600 HENUM henum;
1601
1602 henum = WinBeginEnumWindows(hwndParent);
1603 while ((found = WinGetNextWindow(henum)) != NULLHANDLE) {
1604 hwndDir = WinWindowFromID(found, FID_CLIENT);
1605 if (hwndDir) {
1606 hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
1607 if (hwndDir)
1608 break;
1609 hwndDir = (HWND) 0;
1610 }
1611 }
1612 WinEndEnumWindows(henum);
1613
1614 return hwndDir;
1615}
1616
1617VOID HeapThread(VOID * dummy)
1618{
1619 ULONG postcount;
1620 APIRET rc;
1621
1622 rc = DosCreateEventSem(NULL, &CompactSem, 0L, FALSE);
1623 if (rc)
1624 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
1625 "DosCreateEventSem");
1626 else {
1627 priority_normal();
1628 for (;;) {
1629 if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT))
1630 break;
1631 _heapmin();
1632 DosResetEventSem(CompactSem, &postcount);
1633 }
1634 }
1635}
1636
1637VOID FixSwitchList(HWND hwnd, PCSZ text)
1638{
1639 HSWITCH hswitch;
1640 SWCNTRL swctl;
1641
1642 hswitch = WinQuerySwitchHandle(hwnd, 0);
1643 if (hswitch) {
1644 if (!WinQuerySwitchEntry(hswitch, &swctl)) {
1645 strcpy(swctl.szSwtitle, "FM/2");
1646 WinChangeSwitchEntry(hswitch, &swctl);
1647 }
1648 }
1649}
1650
1651VOID QuickPopup(HWND hwnd, DIRCNRDATA * dcd, HWND hwndMenu, USHORT id)
1652{
1653 dcd->hwndLastMenu = hwndMenu;
1654 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
1655 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1656 MPFROM2SHORT(TRUE, CRA_SOURCE));
1657 dcd->cnremphasized = TRUE;
1658 }
1659 if (dcd->flWindowAttr & CV_MINI)
1660 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
1661 if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu,
1662 8, 8, 0,
1663 PU_HCONSTRAIN | PU_VCONSTRAIN |
1664 PU_KEYBOARD | PU_MOUSEBUTTON1)) {
1665 if (dcd->cnremphasized) {
1666 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1667 MPFROM2SHORT(FALSE, CRA_SOURCE));
1668 dcd->cnremphasized = FALSE;
1669 }
1670 }
1671 else
1672 WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM,
1673 MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
1674}
1675
1676PMINIRECORDCORE CurrentRecord(HWND hwndCnr)
1677{
1678 SHORT attrib = fSelectedAlways ? CRA_SELECTED : CRA_CURSORED;
1679 PMINIRECORDCORE pmi;
1680
1681 for (;;) {
1682 pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
1683 MPFROMLONG(CMA_FIRST),
1684 MPFROMSHORT(attrib));
1685 if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED) /* punt */
1686 attrib = CRA_CURSORED;
1687 else
1688 break;
1689 }
1690 return ((INT)pmi == -1) ? NULL : pmi;
1691}
1692
1693BOOL PostMsg(HWND h, ULONG msg, MPARAM mp1, MPARAM mp2)
1694{
1695 BOOL rc = WinPostMsg(h, msg, mp1, mp2);
1696
1697 if (!rc) {
1698
1699 // If window owned by some other process or some other thread?
1700 if (!IsFm2Window(h, 1)) {
1701 QMSG qmsg;
1702 for (;;) {
1703 DosSleep(1);
1704 rc = WinPostMsg(h, msg, mp1, mp2);
1705 if (rc)
1706 break; // OK
1707 if (!WinIsWindow((HAB) 0, h))
1708 break; // Window gone
1709 if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
1710 break; // Queue has message(s)
1711 } // for
1712 }
1713 }
1714 return rc;
1715}
1716
1717VOID OpenEdit(HWND hwnd)
1718{
1719 CNREDITDATA ced;
1720 PCNRITEM pci;
1721 PFIELDINFO pfi;
1722
1723 pci = (PCNRITEM) WinSendMsg(hwnd,
1724 CM_QUERYRECORDEMPHASIS,
1725 MPFROMLONG(CMA_FIRST),
1726 MPFROMSHORT(CRA_CURSORED));
1727 if (pci && (INT) pci != -1) {
1728 memset(&ced, 0, sizeof(ced));
1729 ced.cb = sizeof(ced);
1730 ced.hwndCnr = hwnd;
1731 ced.id = WinQueryWindowUShort(hwnd, QWS_ID);
1732 ced.pRecord = (PRECORDCORE) pci;
1733 pfi = (PFIELDINFO) WinSendMsg(hwnd,
1734 CM_QUERYDETAILFIELDINFO,
1735 MPVOID, MPFROMSHORT(CMA_FIRST));
1736 if (!pfi)
1737 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
1738 else {
1739 while (pfi && (INT) pfi != -1 &&
1740 pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
1741 pfi = (PFIELDINFO) WinSendMsg(hwnd,
1742 CM_QUERYDETAILFIELDINFO,
1743 MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
1744 if (pfi && (INT) pfi != -1) {
1745 ced.pFieldInfo = pfi;
1746 {
1747 CNRINFO cnri;
1748
1749 memset(&cnri, 0, sizeof(CNRINFO));
1750 cnri.cb = sizeof(CNRINFO);
1751 WinSendMsg(hwnd,
1752 CM_QUERYCNRINFO,
1753 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1754 if (cnri.flWindowAttr & CV_DETAIL)
1755 ced.id = CID_LEFTDVWND;
1756 }
1757 WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
1758 }
1759 }
1760 }
1761}
1762
1763#ifdef NEVER
1764VOID QuickView(HWND hwnd, PCSZ filename)
1765{
1766 if (filename && IsFile(filename) == 1) {
1767 if (TestBinary(filename) && *binview) {
1768
1769 CHAR *list[2];
1770
1771 list[0] = filename;
1772 list[1] = NULL;
1773 ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, NULL, list, NULL,
1774 pszSrcFile, __LINE__);
1775 return;
1776 }
1777 else if (*viewer) {
1778
1779 CHAR *list[2];
1780
1781 list[0] = filename;
1782 list[1] = NULL;
1783 ExecOnList(hwnd, viewer,
1784 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
1785 NULL, NULL, list, NULL, pszSrcFile, __LINE__);
1786 return;
1787 }
1788 StartMLEEditor(HWND_DESKTOP, 5, filename, (HWND) 0);
1789 }
1790}
1791
1792VOID QuickEdit(HWND hwnd, CHAR * filename)
1793{
1794 if (filename && IsFile(filename) == 1) {
1795 if (TestBinary(filename) && *bined) {
1796
1797 CHAR *list[2];
1798
1799 list[0] = filename;
1800 list[1] = NULL;
1801 ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, NULL, list, NULL,
1802 pszSrcFile, __LINE__);
1803 return;
1804 }
1805 else if (*editor) {
1806
1807 CHAR *list[2];
1808
1809 list[0] = filename;
1810 list[1] = NULL;
1811 ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, NULL, list, NULL,
1812 pszSrcFile, __LINE__);
1813 return;
1814 }
1815 StartMLEEditor(HWND_DESKTOP, 4, filename, (HWND) 0);
1816 }
1817}
1818#endif
1819
1820VOID PortholeInit(HWND hwndNew, MPARAM mp1, MPARAM mp2)
1821{
1822 static HWND DefMenu = (HWND) 0;
1823 HWND hwndMenu = (HWND) mp2;
1824
1825 {
1826 ULONG style;
1827
1828 style = WinQueryWindowULong(hwndMenu, QWL_STYLE);
1829 if (!(style & MS_ACTIONBAR))
1830 return;
1831 }
1832
1833 switch (SHORT1FROMMP(mp1)) {
1834 case 0:
1835 {
1836 HWND hwndNow;
1837 MENUITEM mi;
1838 ULONG ulStyle;
1839
1840 memset(&mi, 0, sizeof(mi));
1841 mi.iPosition = MIT_END;
1842 mi.afStyle = MIS_TEXT;
1843 WinSendMsg(hwndMenu, MM_QUERYITEM,
1844 MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
1845 if (!DefMenu)
1846 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
1847 hwndNow = mi.hwndSubMenu;
1848 mi.hwndSubMenu = hwndNew;
1849 if (!mi.hwndSubMenu)
1850 mi.hwndSubMenu = DefMenu;
1851 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
1852 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
1853 WinSetOwner(mi.hwndSubMenu, hwndMenu);
1854 WinSetParent(mi.hwndSubMenu, hwndMenu, FALSE);
1855 WinSetWindowUShort(mi.hwndSubMenu, QWS_ID, IDM_FILESMENU);
1856 mi.afStyle = MIS_SUBMENU;
1857 ulStyle = WinQueryWindowULong(mi.hwndSubMenu, QWL_STYLE);
1858 ulStyle &= -WS_SAVEBITS;
1859 ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
1860 WinSetWindowULong(mi.hwndSubMenu, QWL_STYLE, ulStyle);
1861 WinSendMsg(hwndMenu, MM_SETITEM, MPFROM2SHORT(0, TRUE), MPFROMP(&mi));
1862 }
1863 break;
1864
1865 case 1:
1866 {
1867 HWND hwndNow;
1868 MENUITEM mi;
1869 ULONG ulStyle;
1870
1871 memset(&mi, 0, sizeof(mi));
1872 mi.iPosition = MIT_END;
1873 mi.afStyle = MIS_TEXT;
1874 WinSendMsg(hwndMenu, MM_QUERYITEM,
1875 MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
1876 if (!DefMenu)
1877 DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
1878 hwndNow = mi.hwndSubMenu;
1879 mi.hwndSubMenu = hwndNew;
1880 if (!mi.hwndSubMenu)
1881 mi.hwndSubMenu = DefMenu;
1882 WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
1883 WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
1884 WinSetOwner(mi.hwndSubMenu, hwndMenu);
1885 WinSetParent(mi.hwndSubMenu, hwndMenu, FALSE);
1886 WinSetWindowUShort(mi.hwndSubMenu, QWS_ID, IDM_VIEWSMENU);
1887 mi.afStyle = MIS_SUBMENU;
1888 ulStyle = WinQueryWindowULong(mi.hwndSubMenu, QWL_STYLE);
1889 ulStyle &= -WS_SAVEBITS;
1890 ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
1891 WinSetWindowULong(mi.hwndSubMenu, QWL_STYLE, ulStyle);
1892 WinSendMsg(hwndMenu, MM_SETITEM, MPFROM2SHORT(0, TRUE), MPFROMP(&mi));
1893 }
1894 break;
1895 }
1896}
1897
1898HWND CheckMenu(HWND hwnd, HWND * hwndMenu, USHORT id)
1899{
1900 /* load and adjust menus as required */
1901 if (!*hwndMenu || !WinIsWindow((HAB) 0, *hwndMenu)) {
1902 *hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
1903 CopyPresParams(*hwndMenu, hwnd);
1904 if (hwndMenu == &DirMenu) {
1905 WinSetWindowUShort(DirMenu, QWS_ID, IDM_FILESMENU);
1906 SetConditionalCascade(DirMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
1907 SetConditionalCascade(DirMenu, IDM_COPYMENU, IDM_COPY);
1908 SetConditionalCascade(DirMenu, IDM_MOVEMENU, IDM_MOVE);
1909 SetConditionalCascade(DirMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
1910 SetConditionalCascade(DirMenu, IDM_VIEWSUBMENU, IDM_INFO);
1911 SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
1912 SetConditionalCascade(DirMenu, IDM_DELETESUBMENU,
1913 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
1914 SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES);
1915 SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
1916 if (fWorkPlace) {
1917 WinSendMsg(DirMenu, MM_DELETEITEM,
1918 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
1919 WinSendMsg(DirMenu, MM_DELETEITEM,
1920 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
1921 }
1922 }
1923 else if (hwndMenu == &TreeMenu) {
1924 WinSetWindowUShort(TreeMenu, QWS_ID, IDM_FILESMENU);
1925 SetConditionalCascade(TreeMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
1926 SetConditionalCascade(TreeMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
1927 SetConditionalCascade(TreeMenu, IDM_EDITSUBMENU, IDM_ATTRS);
1928 SetConditionalCascade(TreeMenu, IDM_EXPANDSUBMENU, IDM_EXPAND);
1929 SetConditionalCascade(TreeMenu, IDM_MISCSUBMENU, IDM_SIZES);
1930 SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
1931 if (fWorkPlace) {
1932 WinSendMsg(TreeMenu, MM_DELETEITEM,
1933 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
1934 WinSendMsg(TreeMenu, MM_DELETEITEM,
1935 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
1936 }
1937 if (!fLVM)
1938 WinSendMsg(TreeMenu, MM_DELETEITEM,
1939 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
1940 }
1941 else if (hwndMenu == &ArcMenu) {
1942 WinSetWindowUShort(ArcMenu, QWS_ID, IDM_FILESMENU);
1943 SetConditionalCascade(ArcMenu, IDM_EXTRACTSUBMENU, IDM_EXTRACT);
1944 SetConditionalCascade(ArcMenu, IDM_EDITSUBMENU, IDM_EDIT);
1945 SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW);
1946 if (fWorkPlace)
1947 WinSendMsg(ArcMenu, MM_DELETEITEM,
1948 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
1949 }
1950 else if (hwndMenu == &FileMenu) {
1951 WinSetWindowUShort(FileMenu, QWS_ID, IDM_FILESMENU);
1952 SetConditionalCascade(FileMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
1953 SetConditionalCascade(FileMenu, IDM_COPYMENU, IDM_COPY);
1954 SetConditionalCascade(FileMenu, IDM_MOVEMENU, IDM_MOVE);
1955 SetConditionalCascade(FileMenu, IDM_SAVESUBMENU, IDM_SAVETOCLIP);
1956 SetConditionalCascade(FileMenu, IDM_VIEWSUBMENU, IDM_VIEW);
1957 SetConditionalCascade(FileMenu, IDM_EDITSUBMENU, IDM_EDIT);
1958 SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT);
1959 SetConditionalCascade(FileMenu, IDM_DELETESUBMENU,
1960 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
1961 SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
1962 SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
1963 if (fWorkPlace) {
1964 WinSendMsg(FileMenu, MM_DELETEITEM,
1965 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
1966 WinSendMsg(FileMenu, MM_DELETEITEM,
1967 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
1968 }
1969 if (!fLVM)
1970 WinSendMsg(FileMenu, MM_DELETEITEM,
1971 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
1972 }
1973 else if (hwndMenu == &DirCnrMenu) {
1974 WinSetWindowUShort(DirCnrMenu, QWS_ID, IDM_VIEWSMENU);
1975 SetConditionalCascade(DirCnrMenu, IDM_MISCSUBMENU, IDM_SIZES);
1976 SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME);
1977 if (fWorkPlace)
1978 WinSendMsg(DirCnrMenu, MM_DELETEITEM,
1979 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
1980 }
1981 else if (hwndMenu == &TreeCnrMenu) {
1982 WinSetWindowUShort(TreeCnrMenu, QWS_ID, IDM_VIEWSMENU);
1983 if (!fLVM)
1984 WinSendMsg(TreeCnrMenu, MM_DELETEITEM,
1985 MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
1986 }
1987 else if (hwndMenu == &ArcCnrMenu) {
1988 WinSetWindowUShort(ArcCnrMenu, QWS_ID, IDM_VIEWSMENU);
1989 SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT);
1990 if (fWorkPlace)
1991 WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
1992 MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
1993 }
1994 else if (hwndMenu == &CollectorCnrMenu) {
1995 WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU);
1996 SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU,
1997 IDM_COLLECTFROMCLIP);
1998 }
1999 else if (hwndMenu == &CollectorFileMenu) {
2000 WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU);
2001 SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU,
2002 IDM_DOITYOURSELF);
2003 SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY);
2004 SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE);
2005 SetConditionalCascade(CollectorFileMenu, IDM_SAVESUBMENU,
2006 IDM_SAVETOCLIP);
2007 SetConditionalCascade(CollectorFileMenu, IDM_VIEWSUBMENU, IDM_VIEW);
2008 SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT);
2009 SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU,
2010 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
2011 SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU,
2012 IDM_OPENDEFAULT);
2013 SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
2014 if (fWorkPlace) {
2015 WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
2016 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
2017 WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
2018 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
2019 }
2020 }
2021 else if (hwndMenu == &CollectorDirMenu) {
2022 WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU);
2023 SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU,
2024 IDM_DOITYOURSELF);
2025 SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY);
2026 SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE);
2027 SetConditionalCascade(CollectorDirMenu, IDM_SAVESUBMENU,
2028 IDM_SAVETOCLIP);
2029 SetConditionalCascade(CollectorDirMenu, IDM_VIEWSUBMENU, IDM_INFO);
2030 SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
2031 SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU,
2032 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
2033 SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES);
2034 SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU,
2035 IDM_OPENWINDOW);
2036 if (fWorkPlace) {
2037 WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
2038 MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
2039 WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
2040 MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
2041 }
2042 }
2043 else if (hwndMenu == &MainPopupMenu) {
2044 WinSetWindowUShort(MainPopupMenu, QWS_ID, IDM_MAINPOPUP);
2045 SetConditionalCascade(MainPopupMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
2046 SetConditionalCascade(MainPopupMenu, IDM_AUTOVIEWSUBMENU, IDM_AUTOVIEW);
2047 }
2048 }
2049 CopyPresParams(*hwndMenu, hwnd);
2050 return *hwndMenu;
2051}
2052
2053SHORT AddToListboxBottom(HWND hwnd, PCSZ str)
2054{
2055 SHORT ln;
2056
2057 ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
2058 MPFROMP(str));
2059 if (ln)
2060 WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID);
2061 return ln;
2062}
2063
2064VOID SetSysMenu(HWND hwndSysMenu)
2065{
2066 CHAR s[128], *p;
2067
2068 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
2069 MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
2070 p = strchr(s, '\t');
2071 if (p) {
2072 p++;
2073 strcpy(p, "Ctrl+Alt+F5");
2074 WinSetMenuItemText(hwndSysMenu, SC_RESTORE, s);
2075 }
2076 }
2077 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
2078 MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
2079 p = strchr(s, '\t');
2080 if (p) {
2081 p++;
2082 strcpy(p, "Ctrl+Alt+F4");
2083 WinSetMenuItemText(hwndSysMenu, SC_CLOSE, s);
2084 }
2085 }
2086 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
2087 MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
2088 p = strchr(s, '\t');
2089 if (p) {
2090 p++;
2091 strcpy(p, "Ctrl+Alt+F7");
2092 WinSetMenuItemText(hwndSysMenu, SC_MOVE, s);
2093 }
2094 }
2095 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
2096 MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
2097 p = strchr(s, '\t');
2098 if (p) {
2099 p++;
2100 strcpy(p, "Ctrl+Alt+F8");
2101 WinSetMenuItemText(hwndSysMenu, SC_SIZE, s);
2102 }
2103 }
2104 if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
2105 MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
2106 p = strchr(s, '\t');
2107 if (p) {
2108 p++;
2109 strcpy(p, "Ctrl+Alt+F9");
2110 WinSetMenuItemText(hwndSysMenu, SC_MINIMIZE, s);
2111 }
2112 }
2113 if (WinSendMsg(hwndSysMenu,
2114 MM_QUERYITEMTEXT,
2115 MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
2116 p = strchr(s, '\t');
2117 if (p) {
2118 p++;
2119 strcpy(p, "Ctrl+Alt+F10");
2120 WinSetMenuItemText(hwndSysMenu, SC_MAXIMIZE, s);
2121 }
2122 }
2123 if (WinSendMsg(hwndSysMenu,
2124 MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
2125 p = strchr(s, '\t');
2126 if (p) {
2127 p++;
2128 strcpy(p, "Ctrl+Alt+F11");
2129 WinSetMenuItemText(hwndSysMenu, SC_HIDE, s);
2130 }
2131 }
2132}
2133
2134VOID LoadLibPath(PSZ str, LONG len)
2135{
2136 ULONG ver[2];
2137 CHAR configsys[] = "C:\\CONFIG.SYS";
2138 static CHAR var[8192], beg[16384], end[16384];
2139 BOOL warp;
2140 FILE *fp;
2141 PFN DQELIBPATH = NULL;
2142 HMODULE hmod;
2143
2144 if (str && len) {
2145 *str = 0;
2146 if (DosQuerySysInfo(QSV_BOOT_DRIVE,
2147 QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
2148 ver[0] = 3L;
2149 *configsys = (CHAR) ver[0] + '@';
2150 if (!DosQuerySysInfo(QSV_VERSION_MAJOR,
2151 QSV_VERSION_MINOR,
2152 (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
2153 warp = TRUE;
2154 *var = *beg = *end = 0;
2155 if (warp) {
2156 if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) {
2157 if (!DosQueryProcAddr(hmod,
2158 ORD_DOS32QUERYEXTLIBPATH,
2159 NULL, (PFN *) &DQELIBPATH)) {
2160 DQELIBPATH(beg, BEGIN_LIBPATH);
2161 DQELIBPATH(end, END_LIBPATH);
2162 }
2163 DosFreeModule(hmod);
2164 }
2165 *var = 0;
2166 }
2167 fp = xfopen(configsys, "r", pszSrcFile, __LINE__);
2168 if (fp) {
2169 while (!feof(fp)) {
2170 if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
2171 break;
2172 if (!strnicmp(var, "LIBPATH=", 8)) {
2173 memmove(var, var + 8, strlen(var + 8) + 1);
2174 lstrip(var);
2175 break;
2176 }
2177 }
2178 fclose(fp);
2179 }
2180 strncpy(str, beg, len);
2181 strncat(str, var, len - strlen(str));
2182 strncat(str, end, len - strlen(str));
2183 str[len - 1] = 0;
2184 }
2185}
2186
2187void SetViewMenu(HWND hwndMenu, ULONG flWindowAttr)
2188{
2189 WinCheckMenuItem(hwndMenu, IDM_MINIICONS, ((flWindowAttr & CV_MINI)));
2190 WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT)));
2191 WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) &&
2192 !(flWindowAttr & CV_TREE)));
2193 WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE)));
2194 WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL)));
2195 WinCheckMenuItem(hwndMenu, IDM_NAME, ((flWindowAttr & CV_NAME)));
2196}
2197
2198void SaySort(HWND hwnd, INT sortflags, BOOL archive)
2199{
2200 char *s = NULL;
2201
2202 s = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
2203 if (s) {
2204 sprintf(s, "S:%s%s",
2205 sortflags & SORT_REVERSE ? "^" : NullStr,
2206 (sortflags & SORT_FIRSTEXTENSION) ?
2207 GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
2208 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
2209 "Size" : (sortflags & SORT_EASIZE) ?
2210 (archive == 0) ?
2211 GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
2212 (sortflags & SORT_LWDATE) ?
2213 (archive == 0) ?
2214 GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
2215 (sortflags & SORT_LADATE) ?
2216 GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
2217 GetPString(IDS_CRDATE) :
2218 (sortflags & SORT_PATHNAME) ?
2219 GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
2220 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
2221 GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
2222 WinSetWindowText(hwnd, s);
2223 free(s);
2224 }
2225}
2226
2227void SayView(HWND hwnd, ULONG flWindowAttr)
2228{
2229 char *s = NULL;
2230
2231 s = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
2232 if (s) {
2233 sprintf(s, "V:%s%s",
2234 (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
2235 (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
2236 (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
2237 (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
2238 GetPString(IDS_ICON),
2239 ((flWindowAttr & CV_MINI) &&
2240 !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
2241 WinSetWindowText(hwnd, s);
2242 free(s);
2243 }
2244}
2245
2246void SayFilter(HWND hwnd, MASK * mask, BOOL archive)
2247{
2248 char *s = NULL;
2249
2250 s = xmalloc(CCHMAXPATH * 2, pszSrcFile, __LINE__);
2251 if (s) {
2252 sprintf(s, "F:%s%s",
2253 mask->szMask,
2254 (!archive && (mask->attrFile != ALLATTRS ||
2255 mask->antiattr != 0)) ? " " : NullStr,
2256 (!archive && (mask->attrFile != ALLATTRS ||
2257 mask->antiattr !=
2258 0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
2259 if (!s[2])
2260 sprintf(s, "F:%s", GetPString(IDS_ALLTEXT));
2261 WinSetWindowText(hwnd, s);
2262 free(s);
2263 }
2264}
2265
2266char *GetCmdSpec(BOOL dos)
2267{
2268 char *cmspec;
2269
2270 if (!dos) {
2271 cmspec = getenv("OS2_SHELL");
2272 if (!cmspec)
2273 cmspec = getenv("COMSPEC");
2274 if (!cmspec)
2275 cmspec = "CMD.EXE";
2276 }
2277 else {
2278 cmspec = getenv("DOS_SHELL");
2279 if (!cmspec)
2280 cmspec = "COMMAND.COM";
2281 }
2282 return cmspec;
2283}
2284
2285void Broadcast(HAB hab, HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
2286{
2287 if (hwndMain)
2288 WinBroadcastMsg(hwndMain, msg, mp1, mp2, BMSG_SEND | BMSG_FRAMEONLY);
2289 if (hwnd &&
2290 hwnd != HWND_DESKTOP &&
2291 hwnd != hwndMain &&
2292 hwnd != WinQueryDesktopWindow(hab, NULLHANDLE) &&
2293 WinIsWindow(hab, hwnd) && (!hwndMain || !WinIsChild(hwnd, hwndMain)))
2294 WinSendMsg(hwnd, msg, mp1, mp2);
2295}
2296
2297void SetupWinList(HWND hwndMenu, HWND hwndTop, HWND hwndFrame)
2298{
2299 /*
2300 * add switchlist entries to end of pulldown menu
2301 */
2302
2303 SHORT sItemCount, x = 0, y = 0;
2304 MENUITEM mi;
2305
2306 sItemCount = (SHORT) WinSendMsg(hwndMenu,
2307 MM_QUERYITEMCOUNT, MPVOID, MPVOID);
2308
2309 /* clean out old additions */
2310 while ((SHORT) WinSendMsg(hwndMenu,
2311 MM_DELETEITEM,
2312 MPFROM2SHORT(IDM_SWITCHSTART + x++,
2313 TRUE), MPVOID) < sItemCount)
2314 sItemCount--;
2315 x = 0;
2316 while ((SHORT) WinSendMsg(hwndMenu,
2317 MM_DELETEITEM,
2318 MPFROM2SHORT(IDM_WINDOWSTART + x++,
2319 TRUE), MPVOID) < sItemCount)
2320 sItemCount--;
2321
2322 x = 0;
2323 if (hwndTop) {
2324
2325 char wtext[CCHMAXPATH + 8];
2326 HENUM henum;
2327 HWND hwndChild;
2328
2329 /* add children of the main FM/2 client */
2330 henum = WinBeginEnumWindows(hwndTop);
2331 memset(&mi, 0, sizeof(mi));
2332 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
2333 if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) {
2334 *wtext = 0;
2335 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
2336 if (*wtext) {
2337 wtext[CCHMAXPATH + 7] = 0;
2338 mi.afStyle = MIS_TEXT;
2339 if (!((x + sItemCount) % 28))
2340 mi.afStyle |= MIS_BREAK;
2341 mi.id = IDM_WINDOWSTART + x;
2342 mi.iPosition = MIT_END;
2343 if ((SHORT) WinSendMsg(hwndMenu,
2344 MM_INSERTITEM,
2345 MPFROMP(&mi), MPFROMP(wtext)) >= 0)
2346 x++;
2347 }
2348 }
2349 }
2350 WinEndEnumWindows(henum);
2351 }
2352
2353 /* add external FM/2 windows */
2354 {
2355 PSWBLOCK pswb;
2356 ULONG ulSize, ulcEntries;
2357 HWND hwndTopFrame;
2358 register INT i;
2359
2360 hwndTopFrame = hwndTop ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0;
2361 /* Get the switch list information */
2362 x = 0;
2363 ulcEntries = WinQuerySwitchList(0, NULL, 0);
2364 ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4L) *
2365 (LONG) sizeof(SWENTRY);
2366 /* Allocate memory for list */
2367 pswb = xmalloc(ulSize, pszSrcFile, __LINE__);
2368 if (pswb) {
2369 /* Put the info in the list */
2370 ulcEntries = WinQuerySwitchList(0, pswb, ulSize - sizeof(SWENTRY));
2371 /* do the dirty deed */
2372 memset(&mi, 0, sizeof(mi));
2373 for (i = 0; i < pswb->cswentry; i++) {
2374 if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
2375 pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
2376 (pswb->aswentry[i].swctl.idProcess != mypid ||
2377 !hwndFrame ||
2378 pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
2379 (pswb->aswentry[i].swctl.idProcess != mypid ||
2380 !hwndTopFrame ||
2381 pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
2382 !WinIsChild(hwndFrame, hwndTop))) {
2383 if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
2384 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
2385 || !stricmp(pswb->aswentry[i].swctl.szSwtitle, PCSZ_COLLECTOR)
2386 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
2387 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
2388 || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
2389 mi.afStyle = MIS_TEXT;
2390 if (x && !(x % 28))
2391 mi.afStyle |= MIS_BREAK;
2392 mi.id = IDM_SWITCHSTART + y;
2393 mi.iPosition = MIT_END;
2394 switches[y] = pswb->aswentry[i].hswitch;
2395 if ((SHORT) WinSendMsg(hwndMenu,
2396 MM_INSERTITEM,
2397 MPFROMP(&mi),
2398 MPFROMP(pswb->aswentry[i].
2399 swctl.szSwtitle)) >= 0) {
2400 y++;
2401 x++;
2402 }
2403 }
2404 }
2405 }
2406 numswitches = y;
2407 free(pswb);
2408 DosPostEventSem(CompactSem);
2409 }
2410 }
2411}
2412
2413BOOL SwitchCommand(HWND hwndMenu, USHORT cmd)
2414{
2415 BOOL ret = FALSE;
2416
2417 if (hwndMain && hwndMenu && cmd >= IDM_WINDOWSTART && cmd < IDM_SWITCHSTART) {
2418 /*
2419 * select a child window (of client)
2420 */
2421
2422 MENUITEM mi;
2423 HWND hwndSubMenu = (HWND) 0, hwndChild;
2424 CHAR s[CCHMAXPATH + 8];
2425
2426 if (WinQueryWindowUShort(hwndMenu, QWS_ID) != IDM_WINDOWSMENU) {
2427 memset(&mi, 0, sizeof(mi));
2428 mi.iPosition = MIT_END;
2429 mi.afStyle = MIS_TEXT;
2430 if (WinSendMsg(hwndMenu,
2431 MM_QUERYITEM,
2432 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
2433 hwndSubMenu = mi.hwndSubMenu;
2434 }
2435 else
2436 hwndSubMenu = hwndMenu;
2437 if (hwndSubMenu) {
2438 *s = 0;
2439 if (WinSendMsg(hwndSubMenu,
2440 MM_QUERYITEMTEXT,
2441 MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
2442
2443 HENUM henum;
2444 CHAR checkText[CCHMAXPATH + 8];
2445 SWP swp;
2446
2447 s[CCHMAXPATH + 7] = 0;
2448 henum = WinBeginEnumWindows(hwndMain);
2449 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
2450 if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
2451 *checkText = 0;
2452 WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
2453 checkText[CCHMAXPATH + 7] = 0;
2454 if (!stricmp(checkText, s)) {
2455 if (WinQueryWindowPos(hwndChild, &swp)) {
2456 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
2457 WinSetWindowPos(hwndChild,
2458 HWND_TOP,
2459 0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
2460 }
2461 WinSetActiveWindow(HWND_DESKTOP, hwndChild);
2462 ret = TRUE;
2463 break;
2464 }
2465 }
2466 }
2467 WinEndEnumWindows(henum);
2468 }
2469 }
2470 }
2471 else if (cmd >= IDM_SWITCHSTART && cmd < IDM_SWITCHSTART + 499) {
2472 if (cmd - IDM_SWITCHSTART < numswitches) {
2473 WinSwitchToProgram(switches[cmd - IDM_SWITCHSTART]);
2474 ret = TRUE;
2475 }
2476 }
2477
2478 return ret;
2479}
2480
2481/** CheckDriveSpaceAvail
2482 * Take space needed and checks that drive has at least 1000 bits in excess of the required space.
2483 * Returns 0 if sufficient space is available; 1 if the drive is full & 2 on abort of operation
2484 * when the drive would have less than ullFreeSpaceWhenComplete remaining or has insufficient space.
2485 */
2486
2487INT CheckDriveSpaceAvail(PCSZ pTargetPath, ULONGLONG ullSpaceNeeded,
2488 ULONGLONG ullFreeSpaceWhenComplete)
2489{
2490 FSALLOCATE fsa;
2491 ULONGLONG ullFreeQty;
2492 APIRET ret;
2493
2494 DosQueryFSInfo(toupper(*pTargetPath) - 'A' + 1, FSIL_ALLOC, &fsa, sizeof(FSALLOCATE));
2495 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector);
2496 if (ullFreeQty > ullSpaceNeeded + ullFreeSpaceWhenComplete)
2497 return 0;
2498 else if (ullFreeQty < ullSpaceNeeded + 1024) {
2499 CHAR szKB[20];
2500
2501 CommaFmtULL(szKB, sizeof(szKB),
2502 ullFreeQty - ullSpaceNeeded, ' ');
2503 if (ullFreeSpaceWhenComplete == 0) {
2504 saymsg(MB_OK,
2505 HWND_DESKTOP,
2506 NullStr,
2507 GetPString(IDS_DRIVESPACELIMITEDTMPSAVE),
2508 pTargetPath);
2509 return 0;
2510 }
2511 else {
2512 if (ullFreeQty > ullSpaceNeeded) {
2513 ret = saymsg(MB_YESNO,
2514 HWND_DESKTOP,
2515 NullStr,
2516 GetPString(IDS_DRIVESPACELIMITED),
2517 pTargetPath,
2518 szKB);
2519 if (ret == MBID_YES)
2520 return 0;
2521 else
2522 return 2;
2523 }
2524 else {
2525 saymsg(MB_OK,
2526 HWND_DESKTOP,
2527 NullStr,
2528 GetPString(IDS_DRIVESPACEEXCEEDED),
2529 pTargetPath);
2530 return 2;
2531 }
2532 }
2533 }
2534 else
2535 return 1;
2536}
2537
2538#pragma alloc_text(MAINWND5,SetSysMenu)
2539#pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)
2540#pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
2541#pragma alloc_text(MISC1,CheckDriveSpaceAvail)
2542
2543#ifdef FORTIFY
2544#pragma alloc_text(MISC1,GetTidForWindow)
2545#endif // FORTIFY
2546
2547#pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
2548#pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
2549#pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit)
2550#pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)
2551#pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)
2552#pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)
2553#pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)
2554#pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches,WriteDetailsSwitches)
2555#pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)
2556#pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)
2557#pragma alloc_text(MISC_LIBPATH,LoadLibPath)
2558#pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)
2559
Note: See TracBrowser for help on using the repository browser.