Changeset 1077 for trunk/dll/misc.c
- Timestamp:
- Jul 18, 2008, 8:11:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/misc.c
r1065 r1077 42 42 29 Feb 08 GKY Use xfree where appropriate 43 43 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 44 44 keys using a "DirCnr." prefix 45 45 19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details 46 46 switches are set correctly. 47 47 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 48 all the details view settings (both the global variables and those in the 49 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 48 all the details view settings (both the global variables and those in the 49 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 50 17 Jul 08 SHL Add GetTidForWindow for Fortify support 50 51 51 52 ***********************************************************************/ … … 55 56 #include <ctype.h> 56 57 #include <share.h> 57 #include <malloc.h> 58 #include <malloc.h> // _heapmin 58 59 59 60 #define INCL_DOS … … 64 65 #include "fm3dlg.h" 65 66 #include "fm3str.h" 66 #include "pathutil.h" 67 #include "errutil.h" 68 #include "strutil.h" 69 #include "command.h" 67 #include "pathutil.h" // BldQuotedFileName 68 #include "errutil.h" // Dos_Error... 69 #include "strutil.h" // GetPString 70 #include "command.h" // LINKCMDS 70 71 #include "fm3dll.h" 72 #include "misc.h" 71 73 #include "fortify.h" 72 74 … … 112 114 return yes; 113 115 } 116 117 #ifdef FORTIFY 118 119 /** 120 * Return tid for fm/2 window 121 * window must exist and must be created by fm/2 122 * @param hwnd is window handle 123 * @returns tid or -1 if error 124 */ 125 126 INT GetTidForWindow(HWND hwnd) 127 { 128 PIB *ppib; 129 TIB *ptib; 130 LONG tid = -1; 131 APIRET rc = DosGetInfoBlocks(&ptib, &ppib); 132 133 if (rc) { 134 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 135 "DosGetInfoBlocks"); 136 } 137 else { 138 PID pid; 139 TID tid; 140 if (!WinQueryWindowProcess(hwnd, &pid, &tid)) 141 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd); 142 else if (pid != ppib->pib_ulpid) 143 Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd); 144 else 145 tid = ptib->tib_ptib2->tib2_ultid; 146 } 147 return tid; 148 } 149 150 #endif // FORTIFY 114 151 115 152 VOID SetShiftState(VOID) … … 710 747 USHORT len; 711 748 CHAR *eaval; 712 713 749 LONG retlen; 750 PSZ psz; 714 751 715 752 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject); 716 753 szSubject[retlen + 1] = 0; 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 754 bstrip(szSubject); 755 if (pci->pszSubject != NullStr) { 756 if (retlen == 0) { 757 psz = pci->pszSubject; 758 pci->pszSubject = NullStr; 759 xfree(psz, pszSrcFile, __LINE__); 760 } 761 else 762 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__); 763 } 764 else { 765 pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__); 766 if (!pci->pszSubject) 767 return FALSE; 768 } 732 769 len = strlen(szSubject); 733 770 if (len) … … 772 809 773 810 CHAR longname[CCHMAXPATHCOMP]; 774 775 811 LONG retlen; 812 PSZ psz; 776 813 777 814 *longname = 0; 778 815 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname); 779 816 longname[retlen + 1] = 0; 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 817 chop_at_crnl(longname); 818 bstrip(longname); 819 WinSetWindowText(hwndMLE, longname); 820 if (pci->pszLongName != NullStr) { 821 if (retlen == 0) { 822 psz = pci->pszLongName; 823 pci->pszLongName = NullStr; 824 xfree(psz, pszSrcFile, __LINE__); 825 } 826 else 827 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 828 } 829 else { 830 pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__); 831 if (!pci->pszLongName) 832 return FALSE; 833 } 797 834 return (MRESULT) WriteLongName(pci->pszFileName, longname); 798 835 } … … 980 1017 *ex.environment = 0; 981 1018 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 982 1019 EXEC_FRAME, &ex); 983 1020 if (ret == 1) { 984 1021 lastflags = ex.flags; 985 1022 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 986 987 1023 *ex.environment ? ex.environment : NULL, 1024 "%s", pszCmdLine) != -1; 988 1025 } 989 1026 else if (ret != 0) … … 2157 2194 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window) 2158 2195 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom) 2196 2197 #ifdef FORTIFY 2198 #pragma alloc_text(MISC1,GetTidForWindow) 2199 #endif // FORTIFY 2200 2159 2201 #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType) 2160 2202 #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
Note:
See TracChangeset
for help on using the changeset viewer.