source: trunk/dll/misc.c@ 1792

Last change on this file since 1792 was 1792, checked in by Gregg Young, 11 years ago

Fixed column allocation for drives that failed CheckDrive would always get subject and longname because the check "if (driveflags[x] & DRIVE_NOEASUPPORT)" was always false since x = -1. Found with cppcheck.

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