source: trunk/dll/misc.c@ 1627

Last change on this file since 1627 was 1627, checked in by Gregg Young, 14 years ago

Add a low mem version of xDosAlloc* wrappers; move error checking into all the xDosAlloc* wrappers. Ticket 471

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