From ec18bc616c3aa6ee546928efdc29f81f15185514 Mon Sep 17 00:00:00 2001 From: Jochen Tucht Date: Sat, 30 Aug 2008 17:40:22 +0000 Subject: [PATCH] heksedit - First step towards UI translation --- Externals/heksedit/ChooseDiffDlg.cpp | 71 +- Externals/heksedit/CopyHexdumpDlg.cpp | 8 +- Externals/heksedit/DllProxies.cpp | 137 ++ Externals/heksedit/DllProxies.h | 65 + Externals/heksedit/FillWithDlg.cpp | 19 +- Externals/heksedit/FindDlg.cpp | 59 +- Externals/heksedit/History.txt | 2 +- Externals/heksedit/LangArray.cpp | 451 +++++++ Externals/heksedit/LangArray.h | 24 + .../Languages/20080825T174325.CreateMasterPotFile | 0 .../20080825T175125.UpdatePoFilesFromPotFile | 0 .../heksedit/Languages/CreateMasterPotFile.vbs | 331 +++++ Externals/heksedit/Languages/StringBlacklist.txt | 11 + .../Languages/UpdatePoFilesFromPotFile.vbs | 247 ++++ Externals/heksedit/Languages/heksedit.rc | 1314 ++++++++++++++++++++ Externals/heksedit/OpenPartiallyDlg.cpp | 2 +- Externals/heksedit/PDrive95.cpp | 71 +- Externals/heksedit/PDrive95.h | 44 +- Externals/heksedit/PDriveNT.cpp | 1 - Externals/heksedit/PhysicalDrive.cpp | 23 +- Externals/heksedit/PhysicalDrive.h | 4 +- Externals/heksedit/PreLink.bat | 12 + Externals/heksedit/ShortcutsDlg.cpp | 1 - Externals/heksedit/Simparr.cpp | 22 +- Externals/heksedit/Simparr.h | 63 +- Externals/heksedit/UpgradeDlg.cpp | 2 - Externals/heksedit/VersionData.h | 57 + Externals/heksedit/dllmain.cpp | 39 +- Externals/heksedit/frhed.dsp | 72 +- Externals/heksedit/frhed.rc | 65 +- Externals/heksedit/frhed.vcproj | 95 +- Externals/heksedit/gktools.cpp | 167 ++- Externals/heksedit/gtools.cpp | 333 +---- Externals/heksedit/gtools.h | 100 +- Externals/heksedit/heksedit.dsp | 36 +- Externals/heksedit/heksedit.h | 4 + Externals/heksedit/heksedit.rc | 295 ++--- Externals/heksedit/heksedit.vcproj | 230 ++-- Externals/heksedit/hexwnd.cpp | 905 +++++--------- Externals/heksedit/hexwnd.h | 64 +- Externals/heksedit/ido.cpp | 1 - Externals/heksedit/idt.cpp | 65 +- Externals/heksedit/main.cpp | 167 ++- Externals/heksedit/precomp.h | 7 +- Externals/heksedit/res/Toolbar.bmp | Bin 0 -> 1782 bytes Externals/heksedit/res/icon1.ico | Bin 0 -> 1078 bytes Externals/heksedit/resource.h | 6 +- Externals/heksedit/shtools.cpp | 1 - Externals/heksedit/toolbar.cpp | 17 - Externals/heksedit/version.h | 5 +- Externals/heksedit/version.rc | 45 + 51 files changed, 3808 insertions(+), 1952 deletions(-) create mode 100644 Externals/heksedit/DllProxies.cpp create mode 100644 Externals/heksedit/DllProxies.h create mode 100644 Externals/heksedit/LangArray.cpp create mode 100644 Externals/heksedit/LangArray.h create mode 100644 Externals/heksedit/Languages/20080825T174325.CreateMasterPotFile create mode 100644 Externals/heksedit/Languages/20080825T175125.UpdatePoFilesFromPotFile create mode 100644 Externals/heksedit/Languages/CreateMasterPotFile.vbs create mode 100644 Externals/heksedit/Languages/StringBlacklist.txt create mode 100644 Externals/heksedit/Languages/UpdatePoFilesFromPotFile.vbs create mode 100644 Externals/heksedit/Languages/heksedit.rc create mode 100644 Externals/heksedit/PreLink.bat create mode 100644 Externals/heksedit/VersionData.h create mode 100644 Externals/heksedit/res/Toolbar.bmp create mode 100644 Externals/heksedit/res/icon1.ico create mode 100644 Externals/heksedit/version.rc diff --git a/Externals/heksedit/ChooseDiffDlg.cpp b/Externals/heksedit/ChooseDiffDlg.cpp index 4f882f244..79c7f525a 100644 --- a/Externals/heksedit/ChooseDiffDlg.cpp +++ b/Externals/heksedit/ChooseDiffDlg.cpp @@ -1,6 +1,5 @@ #include "precomp.h" #include "resource.h" -#include #include "clipboard.h" #include "hexwnd.h" #include "hexwdlg.h" @@ -8,10 +7,12 @@ void ChooseDiffDlg::add_diff(HWND hwndList, int diff, int lower, int upper) { char buf[100]; - sprintf(buf, "%d) 0x%x=%d to 0x%x=%d (%d bytes)", diff, lower, lower, - upper, upper, upper - lower + 1); + sprintf(buf, "%d) 0x%x=%n%d to 0x%x=%n%d (%d bytes)", diff, + lower, &lower, lower, + upper, &upper, upper, + upper - lower + 1); int i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)buf); - SendMessage(hwndList, LB_SETITEMDATA, i, lower); + SendMessage(hwndList, LB_SETITEMDATA, i, MAKELONG(lower, upper)); } //------------------------------------------------------------------- @@ -59,7 +60,6 @@ int ChooseDiffDlg::get_diffs(HWND hwndList, char *ps, int sl, char *pd, int dl) BOOL ChooseDiffDlg::OnInitDialog(HWND hDlg) { char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szFileName[0] = '\0'; OPENFILENAME ofn; ZeroMemory(&ofn, sizeof ofn); @@ -68,22 +68,22 @@ BOOL ChooseDiffDlg::OnInitDialog(HWND hDlg) ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; ofn.lpstrTitle = "Choose file to compare with"; - if (GetOpenFileName(&ofn)) + if (!GetOpenFileName(&ofn)) + return FALSE; + int filehandle = _open(szFileName, _O_RDONLY|_O_BINARY); + if (filehandle == -1) { - int filehandle = _open(szFileName, _O_RDONLY|_O_BINARY,_S_IREAD|_S_IWRITE); - if (filehandle == -1) - { - MessageBox(hDlg, "Error while opening file.", "Compare", MB_ICONERROR); - EndDialog(hDlg, IDCANCEL); - } - else if (int filelen = _filelength(filehandle)) + MessageBox(hDlg, "Error while opening file.", "Compare", MB_ICONERROR); + return FALSE; + } + BOOL bDone = FALSE; + if (int filelen = _filelength(filehandle)) + { + int iDestFileLen = filelen; + int iSrcFileLen = DataArray.GetLength() - iCurByte; + if (char *cmpdata = new char[filelen]) { - int iDestFileLen = filelen; - int iSrcFileLen = DataArray.GetLength() - iCurByte; - char *cmpdata = new char[filelen]; // Read data. if (_read(filehandle, cmpdata, filelen) != -1) { @@ -96,28 +96,27 @@ BOOL ChooseDiffDlg::OnInitDialog(HWND hDlg) sprintf(buf, "Remaining loaded data size: %d, size of file on disk: %d.", iSrcFileLen, iDestFileLen); SetDlgItemText(hDlg, IDC_STATIC2, buf); SendMessage(hwndList, LB_SETCURSEL, 0, 0); + bDone = TRUE; } else { // No difference. MessageBox(hDlg, "Data matches exactly.", "Compare", MB_ICONINFORMATION); - EndDialog(hDlg, IDCANCEL); } } else { MessageBox(hDlg, "Error while reading from file.", "Compare", MB_ICONERROR); - EndDialog(hDlg, IDCANCEL); } delete[] cmpdata; } - _close(filehandle); - } - else - { - EndDialog(hDlg, IDCANCEL); + else + { + MessageBox(hDlg, "Not enough memory.", "Compare", MB_ICONERROR); + } } - return TRUE; + _close(filehandle); + return bDone; } //------------------------------------------------------------------- @@ -126,7 +125,9 @@ INT_PTR ChooseDiffDlg::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lPara switch (iMsg) { case WM_INITDIALOG: - return OnInitDialog(hDlg); + if (!OnInitDialog(hDlg)) + EndDialog(hDlg, IDCANCEL); + return TRUE; case WM_COMMAND: switch (wParam) { @@ -167,15 +168,13 @@ INT_PTR ChooseDiffDlg::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lPara if (i != -1) { SendMessage(hwndList, LB_GETTEXT, i, (LPARAM)buf); - if (LPTSTR p = StrRChr(buf, 0, '(')) - { - iCurByte += SendMessage(hwndList, LB_GETITEMDATA, i, 0); - iStartOfSelection = iCurByte; - iEndOfSelection = iCurByte + StrToInt(p + 1) - 1; - bSelected = TRUE; - adjust_view_for_selection(); - repaint(); - } + DWORD dw = SendMessage(hwndList, LB_GETITEMDATA, i, 0); + iStartOfSelection = iCurByte + StrToInt(buf + LOWORD(dw)); + iEndOfSelection = iCurByte + StrToInt(buf + HIWORD(dw)); + iCurByte = iStartOfSelection; + bSelected = TRUE; + adjust_view_for_selection(); + repaint(); } } // fall through diff --git a/Externals/heksedit/CopyHexdumpDlg.cpp b/Externals/heksedit/CopyHexdumpDlg.cpp index 9dd8a1db6..f5e567f62 100644 --- a/Externals/heksedit/CopyHexdumpDlg.cpp +++ b/Externals/heksedit/CopyHexdumpDlg.cpp @@ -19,12 +19,8 @@ BOOL CopyHexdumpDlg::OnInitDialog(HWND hDlg) { // Assume selected area is to be hexdumped. // Make sure end of selection is greater than start of selection. -//Pabs changed - line remove & insert - works better now for both exporting types - iCopyHexdumpDlgStart = iStartOfSelection ; - iCopyHexdumpDlgEnd = iEndOfSelection ; - if (iCopyHexdumpDlgEnd < iCopyHexdumpDlgStart) - swap(iCopyHexdumpDlgStart, iCopyHexdumpDlgEnd); -//end + iCopyHexdumpDlgStart = iGetStartOfSelection(); + iCopyHexdumpDlgEnd = iGetEndOfSelection(); } char buf[16]; sprintf(buf, "%x", iCopyHexdumpDlgStart); diff --git a/Externals/heksedit/DllProxies.cpp b/Externals/heksedit/DllProxies.cpp new file mode 100644 index 000000000..4e0888ad3 --- /dev/null +++ b/Externals/heksedit/DllProxies.cpp @@ -0,0 +1,137 @@ +/*/DllProxies.cpp + +[The MIT license] + +Copyright (c) Jochen Neubeck + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +[ChangeLog] + +DATE: BY: DESCRIPTION: +========== ================== ================================================ +2007-02-03 Jochen Neubeck Created +2008-08-24 Jochen Neubeck FormatMessage +*/ +#include "precomp.h" +#include "DllProxies.h" + +// If MFC is unavailable, resort to FatalAppExit for exceptions. +#ifndef _AFX +#define AfxThrowOleDispatchException FatalAppExit +#endif + +// TCHAR-aware function name decoration +#ifdef _UNICODE +#define AW "W" +#else +#define AW "A" +#endif + +/** + * @brief Load a dll and import a number of functions. + */ +LPVOID DllProxy::Load() +{ + if (Names[0]) + { + if (Names[1] == 0 || Names[1] == Names[0]) + return 0; + HMODULE handle = LoadLibraryA(Names[0]); + if (handle == 0) + { + Names[1] = 0; + return 0; + } + LPCSTR *export = Names; + *Names = 0; + while (LPCSTR name = *++export) + { + *export = (LPCSTR)GetProcAddress(handle, name); + if (*export == 0) + { + Names[0] = Names[1] = name; + Names[2] = (LPCSTR)handle; + return 0; + } + } + *export = (LPCSTR)handle; + } + return this + 1; +} + +/** + * @brief Load a dll and import a number of functions, or throw an exception. + */ +LPVOID DllProxy::EnsureLoad() +{ + if (!Load()) + { + TCHAR buf[1024]; + FormatMessage(buf); + AfxThrowOleDispatchException(0, buf); + } + return this + 1; +} + +/** + * @brief Format an appropriate error message. + */ +void DllProxy::FormatMessage(LPTSTR buf) +{ + int cch = wsprintf(buf, _T("%hs"), Names[0]); + DWORD error = ERROR_MOD_NOT_FOUND; + if (Names[1]) + { + buf[cch++] = '@'; + cch += ::GetModuleFileName((HMODULE)Names[2], buf + cch, MAX_PATH); + error = ERROR_PROC_NOT_FOUND; + } + buf[cch++] = ':'; + buf[cch++] = '\n'; + ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, error, 0, buf + cch, MAX_PATH, 0); +} + +/** + * @brief RAWIO32 dll proxy + */ +DllProxy::Instance RAWIO32 = +{ + "RAWIO32.DLL", + "ResetDisk", + "ReadPhysicalSector", + "WritePhysicalSector", + "ReadDiskGeometry", + "EI13GetDriveParameters", + "EI13ReadSector", + "EI13WriteSector", + (HMODULE)0 +}; + +/** + * @brief IMAGEHLP dll proxy + */ +DllProxy::Instance IMAGEHLP = +{ + "IMAGEHLP.DLL", + "UnMapAndLoad", + "ImageRvaToVa", + "MapAndLoad", + (HMODULE)0 +}; diff --git a/Externals/heksedit/DllProxies.h b/Externals/heksedit/DllProxies.h new file mode 100644 index 000000000..12e7e36ed --- /dev/null +++ b/Externals/heksedit/DllProxies.h @@ -0,0 +1,65 @@ +struct DllProxy +{ + LPCSTR Names[1]; + LPVOID Load() throw(); + LPVOID EnsureLoad(); + void FormatMessage(LPTSTR); + template struct Instance; +}; + +template struct DllProxy::Instance +{ + union + { + struct + { + LPCSTR Names[sizeof(T) / sizeof(LPCSTR)]; + } Names; + DllProxy Proxy; + }; + HMODULE H; + operator T *() throw() + { + return (T *)Proxy.Load(); + } + T *operator->() + { + return (T *)Proxy.EnsureLoad(); + } +}; + +/** + * @brief RAWIO32 dll proxy + */ +struct SectorInfo; +struct ExtDriveInfo; +struct BlockInfo; + +struct RAWIO32 +{ + DWORD(WINAPI*ResetDisk)(SectorInfo *); + DWORD(WINAPI*ReadPhysicalSector)(SectorInfo *, LPBYTE, DWORD); + DWORD(WINAPI*WritePhysicalSector)(SectorInfo *, LPBYTE, DWORD); + DWORD(WINAPI*ReadDiskGeometry)(SectorInfo *); + DWORD(WINAPI*EI13GetDriveParameters)(ExtDriveInfo *); + DWORD(WINAPI*EI13ReadSector)(BlockInfo *, LPBYTE, DWORD); + DWORD(WINAPI*EI13WriteSector)(BlockInfo *, LPBYTE, DWORD); + HMODULE H; +}; + +extern DllProxy::Instance RAWIO32; + +/** + * @brief IMAGEHLP dll proxy + */ +typedef struct _LOADED_IMAGE *PLOADED_IMAGE; + +struct IMAGEHLP +{ + BOOL(NTAPI*UnMapAndLoad)(PLOADED_IMAGE); + PVOID(NTAPI*ImageRvaToVa)(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER); + BOOL(NTAPI*MapAndLoad)(PSTR, PSTR, PLOADED_IMAGE, BOOL, BOOL); + HMODULE H; +}; + +extern DllProxy::Instance IMAGEHLP; diff --git a/Externals/heksedit/FillWithDlg.cpp b/Externals/heksedit/FillWithDlg.cpp index 05a0a42fe..4a051ab5e 100644 --- a/Externals/heksedit/FillWithDlg.cpp +++ b/Externals/heksedit/FillWithDlg.cpp @@ -260,9 +260,8 @@ INT_PTR FillWithDialog::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lPar if (bSelected) { - int x = swapxor(iStartOfSelection, iEndOfSelection); - iStartOfSelSetting = x ^ iStartOfSelection; - iEndOfSelSetting = x ^ iEndOfSelection; + iStartOfSelSetting = iGetStartOfSelection(); + iEndOfSelSetting = iGetEndOfSelection(); } else { @@ -332,23 +331,13 @@ INT_PTR FillWithDialog::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lPar //prepare OPENFILENAME for the file open common dlg box szFWFileName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hDlg; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFWFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = NULL; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; //show open dlgbox and if file good save name & path in edit box if (GetOpenFileName(&ofn)) SetDlgItemText(hDlg, IDC_FN, ofn.lpstrFile); diff --git a/Externals/heksedit/FindDlg.cpp b/Externals/heksedit/FindDlg.cpp index 46e9bb875..331c382c8 100644 --- a/Externals/heksedit/FindDlg.cpp +++ b/Externals/heksedit/FindDlg.cpp @@ -22,36 +22,16 @@ INT_PTR FindDlg::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) if (bSelected) { // Get start offset and length (is at least =1) of selection. - int sel_start, select_len; - if (iEndOfSelection < iStartOfSelection) - { - sel_start = iEndOfSelection; - select_len = iStartOfSelection - iEndOfSelection + 1; - } - else + int sel_start = iGetStartOfSelection(); + int select_len = iGetEndOfSelection() - sel_start + 1; + // Get the length of the bytecode representation of the selection (including zero-byte at end). + int findlen = Text2BinTranslator::iBytes2BytecodeDestLen((char *)&DataArray[sel_start], select_len); + if (findlen > iFindDlgBufLen) { - sel_start = iStartOfSelection; - select_len = iEndOfSelection - iStartOfSelection + 1; + MessageBox(hDlg, "Selection too large.", "Find", MB_ICONERROR); + EndDialog(hDlg, IDCANCEL); + return TRUE; } - - // Get the length of the bytecode representation of the selection (including zero-byte at end). - /*int findlen = */Text2BinTranslator::iBytes2BytecodeDestLen( (char*) &DataArray[sel_start], select_len ); - - // New buffer length is at least FINDDLG_BUFLEN = 64K, bigger if findstring is bigger than 64K. - // iFindDlgBufLen = max( FINDDLG_BUFLEN, findlen ); - - // Signal dialogue function to display the text in the edit box. - // iFindDlgLastLen = findlen; - - // Delete old buffer. - // if( pcFindDlgBuffer != NULL ) - // delete [] pcFindDlgBuffer; - - // Allocate new buffer. - // pcFindDlgBuffer = new char[ iFindDlgBufLen ]; - // if( pcFindDlgBuffer == NULL ) - // MessageBox( hwnd, "Could not allocate findstring buffer!", "Find ERROR", MB_OK | MB_ICONERROR ); - // Translate the selection into bytecode and write it into the edit box buffer. Text2BinTranslator::iTranslateBytesToBC(pcFindDlgBuffer, &DataArray[sel_start], select_len); } @@ -61,7 +41,7 @@ INT_PTR FindDlg::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) CheckDlgButton(hDlg, iFindDlgDirection == -1 ? IDC_RADIO1 : IDC_RADIO2, BST_CHECKED); CheckDlgButton(hDlg, IDC_CHECK1, iFindDlgMatchCase); CheckDlgButton(hDlg, IDC_CHECK4, iFindDlgUnicode); - return FALSE; + return TRUE; case WM_COMMAND: //GK16AUG2K @@ -94,35 +74,28 @@ INT_PTR FindDlg::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) int i; char (*cmp)(char) = iFindDlgMatchCase ? equal : lower_case; - SetCursor (LoadCursor (NULL, IDC_WAIT)); + SetCursor(LoadCursor(NULL, IDC_WAIT)); // Find forward. if (iFindDlgDirection == 1) { - i = find_bytes ((char*) &(DataArray[iCurByte + 1]), DataArray.GetLength() - iCurByte - 1, pcFindstring, destlen, 1, cmp); + i = find_bytes((char *)&DataArray[iCurByte + 1], DataArray.GetLength() - iCurByte - 1, pcFindstring, destlen, 1, cmp); if (i != -1) iCurByte += i + 1; } // Find backward. else { - i = find_bytes( (char*) &(DataArray[0]), - min( iCurByte + (destlen - 1), DataArray.GetLength() ), - pcFindstring, destlen, -1, cmp ); + i = find_bytes((char *)&DataArray[0], + min(iCurByte + (destlen - 1), DataArray.GetLength()), + pcFindstring, destlen, -1, cmp); if (i != -1) iCurByte = i; } - SetCursor (LoadCursor (NULL, IDC_ARROW)); + SetCursor(LoadCursor(NULL, IDC_ARROW)); if (i != -1) { - // Caret will be vertically centered if line of found string is not visible. - /* OLD: ONLY SET CURSOR POSITION - if( iCurByte/iBytesPerLine < iVscrollPos || iCurByte/iBytesPerLine > iVscrollPos + cyBuffer ) - iVscrollPos = max( 0, iCurByte/iBytesPerLine-cyBuffer/2 ); - adjust_vscrollbar(); - */ - - // NEW: Select found interval. + // Select found interval. bSelected = TRUE; iStartOfSelection = iCurByte; iEndOfSelection = iCurByte + destlen - 1; diff --git a/Externals/heksedit/History.txt b/Externals/heksedit/History.txt index 030578d3e..4f069d86c 100644 --- a/Externals/heksedit/History.txt +++ b/Externals/heksedit/History.txt @@ -1,6 +1,6 @@ To find source-level changes use diff or a visual diff prog such as CSdiff (good for RTF files) or Araxis Merge -version heksedit.dll 1.01b by Jochen Neubeck +heksedit.dll by Jochen Neubeck - Compiles into a dll for use as a control in other applications - Thorough refactoring, plus a few fixes, plus probably a few bugs - Got rid of most global variables, mostly to support multiple instances per process diff --git a/Externals/heksedit/LangArray.cpp b/Externals/heksedit/LangArray.cpp new file mode 100644 index 000000000..829abb192 --- /dev/null +++ b/Externals/heksedit/LangArray.cpp @@ -0,0 +1,451 @@ +#include "precomp.h" +#include "simparr.h" +#include "LangArray.h" +#include "VersionData.h" + +/** + * @brief Remove prefix from the string. + * @param [in] text String from which to jump over prefix. + * @param [in] prefix Prefix string to jump over. + * @return String without the prefix. + * @note Function returns pointer to original string, + * it does not allocate a new string. + */ +static char *EatPrefix(char *text, const char *prefix) +{ + if (int len = strlen(prefix)) + if (_memicmp(text, prefix, len) == 0) + return text + len; + return 0; +} + +LangArray::StringData *LangArray::StringData::Create(const char *ps, size_t length) +{ + size_t cb = FIELD_OFFSET(StringData, data) + length + 1; + StringData *psd = reinterpret_cast(new char[cb]); + psd->refcount = 0; + memcpy(psd->data, ps, length); + psd->data[length] = '\0'; + return psd; +} + +char *LangArray::StringData::Share() +{ + ++refcount; + return data; +} + +void LangArray::StringData::Unshare(char *data) +{ + data -= FIELD_OFFSET(StringData, data); + if (--reinterpret_cast(data)->refcount == 0) + delete [] data; +} + +LangArray::LangArray() +: m_hLangDll(0) +, m_codepage(0) +, m_langid(0) +{ +} + +LangArray::~LangArray() +{ + ClearAll(); +} + +void LangArray::ExpandToSize() +{ + while (m_nUpperBound < m_nSize - 1) + m_pT[++m_nUpperBound] = 0; +} + +void LangArray::ClearAll() +{ + while (m_nSize) + if (char *data = m_pT[--m_nSize]) + StringData::Unshare(data); + SimpleArray::ClearAll(); +} + +/** + * @brief Convert C style \\nnn, \\r, \\n, \\t etc into their indicated characters. + * @param [in] codepage Codepage to use in conversion. + * @param [in,out] s String to convert. + */ +static void unslash(unsigned codepage, char *p) +{ + char *q = p; + char c; + do + { + char *r = q + 1; + switch (c = *q) + { + case '\\': + switch (c = *r++) + { + case 'a': + c = '\a'; + break; + case 'b': + c = '\b'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + case 'v': + c = '\v'; + break; + case 'x': + *p = (char)strtol(r, &q, 16); + break; + default: + *p = (char)strtol(r - 1, &q, 8); + break; + } + if (q >= r) + break; + // fall through + default: + *p = c; + if ((*p & 0x80) && IsDBCSLeadByteEx(codepage, *p)) + *++p = *r++; + q = r; + } + ++p; + } while (c != '\0'); +} + +BOOL LangArray::Load(HINSTANCE hMainInstance, LANGID langid) +{ + if (m_langid == langid) + return TRUE; + m_langid = langid; + ClearAll(); + char buf[1024]; + SimpleString *ps = 0; + SimpleString msgid; + SimpleArray lines; + int unresolved = 0; + int mismatched = 0; + FILE *f = 0; + if (langid) + { + TCHAR path[MAX_PATH]; + GetModuleFileName(hMainInstance, path, MAX_PATH); + LPTSTR name = PathFindFileName(path); + LPTSTR ext = PathFindExtension(name); + *ext = _T('\0'); + wsprintf(ext + 1, _T("lng\\%s.lng"), name); + *ext = _T('.'); + if (m_hLangDll == 0) + { + m_hLangDll = LoadLibrary(path); + if (m_hLangDll == 0) + return FALSE; + } + const CVersionData *pvdMain = CVersionData::Load(hMainInstance); + if (pvdMain == 0) + return FALSE; + const CVersionData *pvdLang = CVersionData::Load(m_hLangDll); + if (pvdLang == 0) + return FALSE; + if (memcmp(pvdMain->Data(), pvdLang->Data(), FIELD_OFFSET(VS_FIXEDFILEINFO, dwProductVersionMS))) + return FALSE; + HRSRC potfile = FindResource(m_hLangDll, _T("en-US.pot"), RT_RCDATA); + if (potfile == 0) + return FALSE; + size_t size = SizeofResource(m_hLangDll, potfile); + const char *data = (const char *)LoadResource(m_hLangDll, potfile); + while (const char *eol = (const char *)memchr(data, '\n', size)) + { + size_t len = eol - data; + if (len >= sizeof buf) + { + assert(FALSE); + break; + } + memcpy(buf, data, len); + buf[len++] = '\0'; + data += len; + size -= len; + if (char *p = EatPrefix(buf, "#:")) + { + if (char *q = strchr(p, ':')) + { + int line = strtol(q + 1, &q, 10); + lines.Append(line); + ++unresolved; + } + } + else if (EatPrefix(buf, "msgid ")) + { + ps = &msgid; + } + if (ps) + { + char *p = strchr(buf, '"'); + char *q = strrchr(buf, '"'); + if (q > p) + { + *q = '\0'; + ps->AppendString(p + 1); + } + else + { + ps = 0; + if (int i = lines.GetLength()) + { + StringData *psd = StringData::Create(msgid, msgid.StrLen()); + do + { + int line = lines[--i]; + if (GetLength() <= line) + { + SetSize(line + 1); + ExpandToSize(); + } + SetAt(line, psd->Share()); + } while (i); + } + lines.ClearAll(); + msgid.Clear(); + } + } + } + PathRemoveFileSpec(path); + name = PathAddBackslash(path); + // Look for a .po file that matches the given langid. + // Possible cases in order of precedence: + // (1) Country specific translation for given country, e.g. de-CH.po + // (2) Country specific translation to serve as default, e.g. de-DE.po + // (3) Country inspecific translation, e.g. de.po + do + { + if (int i = GetLocaleInfo(langid, LOCALE_SISO639LANGNAME, name, 4)) + { + int j = GetLocaleInfo(langid, LOCALE_SISO3166CTRYNAME, name + i, 4); + name[--i] = '-'; + do + { + strcpy(name + i + j, ".po"); + f = fopen(path, "r"); + if (j == 0 || SUBLANGID(langid) != SUBLANG_DEFAULT) + break; + j = 0; + } while (f == 0); + } + if (SUBLANGID(langid) == SUBLANG_DEFAULT) + break; + langid = MAKELANGID(PRIMARYLANGID(langid), SUBLANG_DEFAULT); + } while (f == 0); + } + if (f == 0) + { + if (m_hLangDll) + FreeLibrary(m_hLangDll); + m_hLangDll = 0; + return FALSE; + } + ps = 0; + msgid.ClearAll(); + lines.ClearAll(); + SimpleString msgstr; + SimpleString format; + SimpleString directive; + while (fgets(buf, sizeof buf, f)) + { + if (char *p = EatPrefix(buf, "#:")) + { + if (char *q = strchr(p, ':')) + { + int line = strtol(q + 1, &q, 10); + if (line == 367) + line = line; + lines.Append(line); + --unresolved; + } + } + else if (char *p = EatPrefix(buf, "#,")) + { + StrTrim(p, " \t\r\n"); + format = p; + } + else if (char *p = EatPrefix(buf, "#.")) + { + StrTrim(p, " \t\r\n"); + directive = p; + } + else if (EatPrefix(buf, "msgid ")) + { + ps = &msgid; + } + else if (EatPrefix(buf, "msgstr ")) + { + ps = &msgstr; + } + if (ps) + { + char *p = strchr(buf, '"'); + char *q = strrchr(buf, '"'); + if (q > p) + { + *q = '\0'; + ps->AppendString(p + 1); + } + else + { + ps = 0; + if (msgstr.IsEmpty()) + msgstr = msgid; + unslash(m_codepage, msgstr); + if (int i = lines.GetLength()) + { + StringData *psd = StringData::Create(msgstr, msgstr.StrLen()); + do + { + int line = lines[--i]; + if (GetLength() <= line) + { + SetSize(line + 1); + ExpandToSize(); + } + char *data = GetAt(line); + if (data && strcmp(data, msgid) == 0) + { + StringData::Unshare(data); + SetAt(line, psd->Share()); + } + else + { + ++mismatched; + } + } while (i); + } + lines.ClearAll(); + if (strcmp(directive, "Codepage") == 0) + { + m_codepage = strtol(msgstr, &p, 10); + directive.Clear(); + } + msgid.Clear(); + msgstr.Clear(); + } + } + } + fclose(f); + if (unresolved || mismatched) + { + ClearAll(); + if (m_hLangDll) + FreeLibrary(m_hLangDll); + m_hLangDll = 0; + return FALSE; + } + return TRUE; +} + +BSTR LangArray::TranslateStringA(int line) +{ + BSTR t = 0; + if (line > 0 && line < GetLength()) + { + if (char *s = GetAt(line)) + { + if (int len = strlen(s)) + { + unsigned codepage = GetACP(); + if (m_codepage != codepage) + { + // Attempt to convert to UI codepage + BSTR ws = SysAllocStringLen(0, len); + len = MultiByteToWideChar(m_codepage, 0, s, -1, ws, len + 1); + if (len) + { + SysReAllocStringLen(&ws, ws, len - 1); + len = WideCharToMultiByte(codepage, 0, ws, -1, 0, 0, 0, 0); + if (len) + { + t = SysAllocStringByteLen(0, len - 1); + WideCharToMultiByte(codepage, 0, ws, -1, (PSTR)t, len, 0, 0); + } + } + SysFreeString(ws); + } + else + { + t = SysAllocStringByteLen(s, len); + } + } + } + } + return t; +} + +BSTR LangArray::TranslateStringW(int line) +{ + BSTR ws = 0; + if (line > 0 && line < GetLength()) + { + if (char *s = GetAt(line)) + { + if (int len = strlen(s)) + { + ws = SysAllocStringLen(0, len); + len = MultiByteToWideChar(m_codepage, 0, s, -1, ws, len + 1); + SysReAllocStringLen(&ws, ws, len - 1); + } + } + } + return ws; +} + +void LangArray::TranslateDialogA(HWND h) +{ + UINT gw = GW_CHILD; + do + { + TCHAR text[80]; + ::GetWindowTextA(h, text, RTL_NUMBER_OF(text)); + int line = 0; + if (LPTSTR p = _tcschr(text, _T(':'))) + line = _ttoi(p + 1); + if (BSTR t = TranslateStringA(line)) + { + ::SetWindowTextA(h, (PSTR)t); + ::SysFreeString(t); + } + h = ::GetWindow(h, gw); + gw = GW_HWNDNEXT; + } while (h); +} + +void LangArray::TranslateDialogW(HWND h) +{ + UINT gw = GW_CHILD; + do + { + WCHAR text[80]; + ::GetWindowTextW(h, text, RTL_NUMBER_OF(text)); + int line = 0; + if (LPWSTR p = wcschr(text, L':')) + line = _wtoi(p + 1); + if (BSTR t = TranslateStringW(line)) + { + ::SetWindowTextW(h, t); + ::SysFreeString(t); + } + h = ::GetWindow(h, gw); + gw = GW_HWNDNEXT; + } while (h); +} diff --git a/Externals/heksedit/LangArray.h b/Externals/heksedit/LangArray.h new file mode 100644 index 000000000..ad5989cb2 --- /dev/null +++ b/Externals/heksedit/LangArray.h @@ -0,0 +1,24 @@ +class LangArray : public SimpleArray +{ +public: + struct StringData + { + int refcount; + char data[1]; + static StringData *Create(const char *, size_t); + char *Share(); + static void Unshare(char *); + }; + HMODULE m_hLangDll; + unsigned m_codepage; + LANGID m_langid; + LangArray(); + ~LangArray(); + void ExpandToSize(); + void ClearAll(); + BOOL Load(HINSTANCE, LANGID); + BSTR TranslateStringA(int line); + BSTR TranslateStringW(int line); + void TranslateDialogA(HWND); + void TranslateDialogW(HWND); +}; diff --git a/Externals/heksedit/Languages/20080825T174325.CreateMasterPotFile b/Externals/heksedit/Languages/20080825T174325.CreateMasterPotFile new file mode 100644 index 000000000..e69de29bb diff --git a/Externals/heksedit/Languages/20080825T175125.UpdatePoFilesFromPotFile b/Externals/heksedit/Languages/20080825T175125.UpdatePoFilesFromPotFile new file mode 100644 index 000000000..e69de29bb diff --git a/Externals/heksedit/Languages/CreateMasterPotFile.vbs b/Externals/heksedit/Languages/CreateMasterPotFile.vbs new file mode 100644 index 000000000..a361bf815 --- /dev/null +++ b/Externals/heksedit/Languages/CreateMasterPotFile.vbs @@ -0,0 +1,331 @@ +Option Explicit +'' +' This script creates the master POT file (en-US.pot). +' +' Copyright (C) 2007 by Tim Gerundt +' Released under the "GNU General Public License" +' +' ID line follows -- this is updated by SVN +' $Id: CreateMasterPotFile.vbs 4974 2008-01-29 23:10:28Z gerundt $ + +Const ForReading = 1 + +Const NO_BLOCK = 0 +Const MENU_BLOCK = 1 +Const DIALOGEX_BLOCK = 2 +Const STRINGTABLE_BLOCK = 3 +Const VERSIONINFO_BLOCK = 4 +Const ACCELERATORS_BLOCK = 5 +Const TEXTINCLUDE_BLOCK = 6 + +Dim oFSO, bRunFromCmd + +Set oFSO = CreateObject("Scripting.FileSystemObject") + +bRunFromCmd = LCase(oFSO.GetFileName(Wscript.FullName)) = "cscript.exe" + +Call Main + +'' +' ... +Sub Main + Dim oStrings, sCodePage + Dim StartTime, EndTime, Seconds + Dim oFile, dDate, sBuild + + StartTime = Time + + InfoBox "Creating POT file from heksedit.rc...", 3 + dDate = oFSO.GetFile("../heksedit.rc").DateLastModified + sBuild = FormatTimeStamp(dDate) & ".CreateMasterPotFile" + If Not oFSO.FileExists(sBuild) Then + Set oStrings = GetStringsFromRcFile("../heksedit.rc", sCodePage) + CreateMasterPotFile "en-US.pot", oStrings, sCodePage + For Each oFile In oFSO.GetFolder(".").Files 'For all files in the current folder... + Select Case UCase(oFSO.GetExtensionName(oFile.Name)) + Case "CREATEMASTERPOTFILE" + oFile.Name = sBuild + End Select + Next + + EndTime = Time + Seconds = DateDiff("s", StartTime, EndTime) + + InfoBox "POT file created, after " & Seconds & " second(s).", 10 + Else 'If update NOT necessary... + InfoBox "POT file already up-to-date.", 10 + End If +End Sub + +'' +' ... +Class CString + Dim Comment, References, Context, Id, Str +End Class + +'' +' ... +Function GetStringsFromRcFile(ByVal sRcFilePath, ByRef sCodePage) + Dim oBlacklist, oStrings, oString, oRcFile, sLine, iLine + Dim sRcFileName, iBlockType, sReference, sString, sComment, sContext, oMatch, sTemp, sKey + Dim oLcFile, sLcLine, fContinuation + + Set oBlacklist = GetStringBlacklist("StringBlacklist.txt") + + Set oStrings = CreateObject("Scripting.Dictionary") + + If (oFSO.FileExists(sRcFilePath) = True) Then 'If the RC file exists... + sRcFileName = oFSO.GetFileName(sRcFilePath) + iLine = 0 + iBlockType = NO_BLOCK + sCodePage = "" + Set oRcFile = oFSO.OpenTextFile(sRcFilePath, ForReading) + Set oLcFile = oFSO.CreateTextFile("heksedit.rc", True) + Do Until oRcFile.AtEndOfStream = True 'For all lines... + sLcLine = oRcFile.ReadLine + sLine = Trim(sLcLine) + sLine = Replace(sLine, vbTab, " ") + iLine = iLine + 1 + + sReference = sRcFileName & ":" & iLine + sString = "" + sComment = "" + sContext = "" + + If fContinuation Then + ' Nothing to do + ElseIf InStr(sLine, " TEXTINCLUDE") > 0 Then 'TEXTINCLUDE... + iBlockType = TEXTINCLUDE_BLOCK + ElseIf InStr(sLine, " MENU") > 0 And InStr(sLine, "IDR_") > 0 Then 'MENU... + iBlockType = MENU_BLOCK + ElseIf InStr(sLine, " DIALOG") > 0 Then 'DIALOG(EX)... + iBlockType = DIALOGEX_BLOCK + ElseIf InStr(sLine, "STRINGTABLE") > 0 Then 'STRINGTABLE... + iBlockType = STRINGTABLE_BLOCK + ElseIf InStr(sLine, " VERSIONINFO") > 0 Then 'VERSIONINFO... + iBlockType = VERSIONINFO_BLOCK + ElseIf InStr(sLine, " ACCELERATORS") > 0 Then 'ACCELERATORS... + iBlockType = ACCELERATORS_BLOCK + ElseIf InStr(sLine, " BITMAP ") > 0 Then 'BEGIN... + sLcLine = "//" & sLcLine + 'IGNORE FOR SPEEDUP! + ElseIf (sLine = "BEGIN") Then 'BEGIN... + 'IGNORE FOR SPEEDUP! + ElseIf (sLine = "END") Then 'END... + If (iBlockType = STRINGTABLE_BLOCK) Then 'If inside stringtable... + iBlockType = NO_BLOCK + End If + ElseIf (Left(sLine, 2) = "//") Then 'If comment line... + sLine = "" + 'IGNORE FOR SPEEDUP! + ElseIf sLine <> "" Then 'If NOT empty line... + Select Case iBlockType + Case NO_BLOCK: + If FoundRegExpMatch(sLine, "LANGUAGE (LANG_\w*, SUBLANG_\w*)", oMatch) Then 'LANGUAGE... + sString = oMatch.SubMatches(0) + sComment = "LANGUAGE, SUBLANGUAGE" + ElseIf FoundRegExpMatch(sLine, "code_page\(([\d]+)\)", oMatch) Then 'code_page... + sString = oMatch.SubMatches(0) + sComment = "Codepage" + sCodePage = oMatch.SubMatches(0) + End If + + Case MENU_BLOCK, DIALOGEX_BLOCK, STRINGTABLE_BLOCK: + If InStr(sLine, """") > 0 Then 'If quote found (for speedup)... + '-------------------------------------------------------------------------------- + ' Replace 1st string literal only - 2nd string literal specifies control class! + '-------------------------------------------------------------------------------- + If FoundRegExpMatch(sLine, """((?:""""|[^""])*)""", oMatch) Then 'String... + sTemp = oMatch.SubMatches(0) + If (sTemp <> "") And (oBlacklist.Exists(sTemp) = False) Then 'If NOT blacklisted... + sLcLine = Replace(sLcLine, """" & sTemp & """", """" & sReference & """", 1, 1) + sString = Replace(sTemp, """""", "\""") + If FoundRegExpMatch(sLine, "//#\. (.*?)$", oMatch) Then 'If found a comment for the translators... + sComment = Trim(oMatch.SubMatches(0)) + ElseIf FoundRegExpMatch(sLine, "//msgctxt (.*?)$", oMatch) Then 'If found a context for the translation... + sContext = Trim(oMatch.SubMatches(0)) + sComment = sContext + End If + End If + End If + End If + + Case VERSIONINFO_BLOCK: + If FoundRegExpMatch(sLine, "BLOCK ""([0-9A-F]+)""", oMatch) Then 'StringFileInfo.Block... + sString = oMatch.SubMatches(0) + sComment = "StringFileInfo.Block" + ElseIf FoundRegExpMatch(sLine, "VALUE ""Comments"", ""(.*?)\\?0?""", oMatch) Then 'StringFileInfo.Comments... + sString = oMatch.SubMatches(0) + sComment = "You should use a string like ""Translated by "" followed by the translator names for this string. It is ONLY VISIBLE in the StringFileInfo.Comments property from the final resource file!" + ElseIf FoundRegExpMatch(sLine, "VALUE ""Translation"", (.*?)$", oMatch) Then 'VarFileInfo.Translation... + sString = oMatch.SubMatches(0) + sComment = "VarFileInfo.Translation" + End If + + End Select + End If + + If (sString <> "") Then + sKey = sContext & sString + Set oString = New CString + If (oStrings.Exists(sKey) = True) Then 'If the key is already used... + Set oString = oStrings(sKey) + End If + If (sComment <> "") Then + oString.Comment = sComment + End If + If (oString.References <> "") Then + oString.References = oString.References & vbTab & sReference + Else + oString.References = sReference + End If + oString.Context = sContext + oString.Id = sString + oString.Str = "" + + If (oStrings.Exists(sKey) = True) Then 'If the key is already used... + Set oStrings(sKey) = oString + Else 'If the key is NOT already used... + oStrings.Add sContext & sString, oString + End If + End If + If sLine = "#ifndef APSTUDIO_INVOKED" Then Exit Do + oLcFile.WriteLine sLcLine + fContinuation = sLine <> "" And InStr(",|", Right(sLine, 1)) <> 0 + Loop + oLcFile.WriteLine "#include ""version.rc""" + oLcFile.WriteLine "en-US.pot RCDATA ""en-US.pot""" + oRcFile.Close + oLcFile.Close + End If + Set GetStringsFromRcFile = oStrings +End Function + +'' +' ... +Function GetStringBlacklist(ByVal sTxtFilePath) + Dim oBlacklist, oTxtFile, sLine + + Set oBlacklist = CreateObject("Scripting.Dictionary") + + If (oFSO.FileExists(sTxtFilePath) = True) Then 'If the blacklist file exists... + Set oTxtFile = oFSO.OpenTextFile(sTxtFilePath, ForReading) + Do Until oTxtFile.AtEndOfStream = True 'For all lines... + sLine = Trim(oTxtFile.ReadLine) + + If (sLine <> "") Then + If (oBlacklist.Exists(sLine) = False) Then 'If the key is NOT already used... + oBlacklist.Add sLine, True + End If + End If + Loop + oTxtFile.Close + End If + Set GetStringBlacklist = oBlacklist +End Function + +'' +' ... +Sub CreateMasterPotFile(ByVal sPotPath, ByVal oStrings, ByVal sCodePage) + Dim oPotFile, sKey, oString, aReferences, i + + Set oPotFile = oFSO.CreateTextFile(sPotPath, True) + + oPotFile.WriteLine "# This file is part of FRHED " + oPotFile.WriteLine "# Released under the ""GNU General Public License""" + oPotFile.WriteLine "#" + oPotFile.WriteLine "# ID line follows -- this is updated by SVN" + oPotFile.WriteLine "# $" & "Id: " & "$" + oPotFile.WriteLine "#" + oPotFile.WriteLine "msgid """"" + oPotFile.WriteLine "msgstr """"" + oPotFile.WriteLine """Project-Id-Version: FRHED\n""" + oPotFile.WriteLine """Report-Msgid-Bugs-To: http://sourceforge.net/tracker/?group_id=13216&atid=113216\n""" + oPotFile.WriteLine """POT-Creation-Date: " & GetPotCreationDate() & "\n""" + oPotFile.WriteLine """PO-Revision-Date: \n""" + oPotFile.WriteLine """Last-Translator: \n""" + oPotFile.WriteLine """Language-Team: English \n""" + oPotFile.WriteLine """MIME-Version: 1.0\n""" + oPotFile.WriteLine """Content-Type: text/plain; charset=CP" & sCodePage & "\n""" + oPotFile.WriteLine """Content-Transfer-Encoding: 8bit\n""" + oPotFile.WriteLine """X-Poedit-Language: English\n""" + oPotFile.WriteLine """X-Poedit-SourceCharset: CP" & sCodePage & "\n""" + oPotFile.WriteLine """X-Generator: CreateMasterPotFile.vbs\n""" + oPotFile.WriteLine + For Each sKey In oStrings.Keys 'For all strings... + Set oString = oStrings(sKey) + If (oString.Comment <> "") Then 'If comment exists... + oPotFile.WriteLine "#. " & oString.Comment + End If + aReferences = Split(oString.References, vbTab) + For i = LBound(aReferences) To UBound(aReferences) 'For all references... + oPotFile.WriteLine "#: " & aReferences(i) + Next + oPotFile.WriteLine "#, c-format" + If (oString.Context <> "") Then 'If context exists... + oPotFile.WriteLine "msgctxt """ & oString.Context & """" + End If + oPotFile.WriteLine "msgid """ & oString.Id & """" + oPotFile.WriteLine "msgstr """"" + oPotFile.WriteLine + Next + oPotFile.Close +End Sub + +'' +' ... +Function FoundRegExpMatch(ByVal sString, ByVal sPattern, ByRef oMatchReturn) + Dim oRegExp, oMatches + + Set oRegExp = New RegExp + oRegExp.Pattern = sPattern + oRegExp.IgnoreCase = True + + Set oMatchReturn = Nothing + FoundRegExpMatch = False + If oRegExp.Test(sString) Then + Set oMatches = oRegExp.Execute(sString) + Set oMatchReturn = oMatches(0) + FoundRegExpMatch = True + End If +End Function + +'' +' ... +Function GetPotCreationDate() + Dim oNow, sYear, sMonth, sDay, sHour, sMinute + + oNow = Now() + sYear = Year(oNow) + sMonth = Month(oNow) + If (sMonth < 10) Then sMonth = "0" & sMonth + sDay = Day(oNow) + If (sDay < 10) Then sDay = "0" & sDay + sHour = Hour(oNow) + If (sHour < 10) Then sHour = "0" & sHour + sMinute = Minute(oNow) + If (sMinute < 10) Then sMinute = "0" & sMinute + + GetPotCreationDate = sYear & "-" & sMonth & "-" & sDay & " " & sHour & ":" & sMinute & "+0000" +End Function + +'' +' ... +Function FormatTimestamp(now) + ' Form an ISO 8601 compliant timestamp without separators. Don't care about timezones. + FormatTimestamp = Right("0000" & Year(now), 4) & Right("00" & Month(now), 2) & Right("00" & Day(now), 2) _ + & "T" & Right("00" & Hour(now), 2) & Right("00" & Minute(now), 2) & Right("00" & Second(now), 2) +End Function + +'' +' ... +Function InfoBox(ByVal sText, ByVal iSecondsToWait) + Dim oShell + + If (bRunFromCmd = False) Then 'If run from command line... + Set oShell = Wscript.CreateObject("WScript.Shell") + InfoBox = oShell.Popup(sText, iSecondsToWait, Wscript.ScriptName, 64) + Else 'If NOT run from command line... + Wscript.Echo sText + End If +End Function diff --git a/Externals/heksedit/Languages/StringBlacklist.txt b/Externals/heksedit/Languages/StringBlacklist.txt new file mode 100644 index 000000000..daf36c8f8 --- /dev/null +++ b/Externals/heksedit/Languages/StringBlacklist.txt @@ -0,0 +1,11 @@ +(filter name) +[VERSION COPYRIGHT GOES HERE] +_HDR_POPUP_ +_ITEM_POPUP_ +_POPUP_ + +0 +0.00 +IDM_MRU +MS Shell Dlg +Version 1.0 diff --git a/Externals/heksedit/Languages/UpdatePoFilesFromPotFile.vbs b/Externals/heksedit/Languages/UpdatePoFilesFromPotFile.vbs new file mode 100644 index 000000000..02a4a1c5b --- /dev/null +++ b/Externals/heksedit/Languages/UpdatePoFilesFromPotFile.vbs @@ -0,0 +1,247 @@ +Option Explicit +'' +' This script updates the language PO files from the master POT file. +' +' Copyright (C) 2007 by Tim Gerundt +' Released under the "GNU General Public License" +' +' ID line follows -- this is updated by SVN +' $Id: UpdatePoFilesFromPotFile.vbs 4974 2008-01-29 23:10:28Z gerundt $ + +Const ForReading = 1 + +Dim oFSO, bRunFromCmd + +Set oFSO = CreateObject("Scripting.FileSystemObject") + +bRunFromCmd = False +If LCase(oFSO.GetFileName(Wscript.FullName)) = "cscript.exe" Then + bRunFromCmd = True +End If + +Call Main + +'' +' ... +Sub Main + Dim oFiles, oFile, sFile, sDir, bPotChanged + Dim oEnglishPotContent, oLanguagePoContent + Dim StartTime, EndTime, Seconds + Dim dDate, sBuild + + StartTime = Time + + InfoBox "Updating PO files from POT file...", 3 + + sDir = oFSO.GetParentFolderName(Wscript.ScriptFullName) + + dDate = oFSO.GetFile(sDir & "\en-US.pot").DateLastModified + sBuild = FormatTimeStamp(dDate) & ".UpdatePoFilesFromPotFile" + + Set oEnglishPotContent = GetContentFromPoFile(sDir & "\en-US.pot") + If oEnglishPotContent.Count = 0 Then Err.Raise vbObjectError, "Sub Main", "Error reading content from en-US.pot" + Set oFiles = Wscript.Arguments + If oFiles.Count = 0 Then + Set oFiles = oFSO.GetFolder(".").Files + bPotChanged = Not oFSO.FileExists(sBuild) + Else + bPotChanged = True + End If + For Each oFile In oFiles 'For all languages... + sFile = CStr(oFile) + Select Case UCase(oFSO.GetExtensionName(sFile)) + Case "UPDATEPOFILESFROMPOTFILE" + If oFile.Name <> sBuild Then oFile.Name = sBuild + Case "PO" + If bPotChanged Or GetArchiveBit(sFile) Then 'If update necessary... + If bRunFromCmd Then 'If run from command line... + Wscript.Echo oFSO.GetFileName(sFile) + End If + Set oLanguagePoContent = GetContentFromPoFile(sFile) + If oLanguagePoContent.Count > 0 Then 'If content exists... + CreateUpdatedPoFile sFile, oEnglishPotContent, oLanguagePoContent + End If + SetArchiveBit sFile, False + End If + End Select + Next + + EndTime = Time + Seconds = DateDiff("s", StartTime, EndTime) + + InfoBox "All PO files updated, after " & Seconds & " second(s).", 10 +End Sub + +'' +' ... +Class CSubContent + Dim sMsgCtxt2, sMsgId2, sMsgStr2, sTranslatorComments, sExtractedComments, sReferences, sFlags +End Class + +'' +' ... +Function GetContentFromPoFile(ByVal sPoPath) + Dim oContent, oSubContent, oTextFile, sLine + Dim oMatch, iMsgStarted, sMsgCtxt, sMsgId + Dim reMsgCtxt, reMsgId, reMsgContinued + + Set reMsgCtxt = New RegExp + reMsgCtxt.Pattern = "^msgctxt ""(.*)""$" + reMsgCtxt.IgnoreCase = True + + Set reMsgId = New RegExp + reMsgId.Pattern = "^msgid ""(.*)""$" + reMsgId.IgnoreCase = True + + Set reMsgContinued = New RegExp + reMsgContinued.Pattern = "^""(.*)""$" + reMsgContinued.IgnoreCase = True + + Set oContent = CreateObject("Scripting.Dictionary") + + iMsgStarted = 0 + sMsgCtxt = "" + Set oSubContent = New CSubContent + Set oTextFile = oFSO.OpenTextFile(sPoPath, ForReading) + Do Until oTextFile.AtEndOfStream 'For all lines... + sLine = Trim(oTextFile.ReadLine) + If sLine <> "" Then 'If NOT empty line... + If Left(sLine, 1) <> "#" Then 'If NOT comment line... + If reMsgCtxt.Test(sLine) Then 'If "msgctxt"... + iMsgStarted = 1 + Set oMatch = reMsgCtxt.Execute(sLine)(0) + sMsgCtxt = oMatch.SubMatches(0) + oSubContent.sMsgCtxt2 = sLine & vbCrLf + ElseIf reMsgId.Test(sLine) Then 'If "msgid"... + iMsgStarted = 2 + Set oMatch = reMsgId.Execute(sLine)(0) + sMsgId = oMatch.SubMatches(0) + oSubContent.sMsgId2 = sLine & vbCrLf + ElseIf Left(sLine, 8) = "msgstr """ Then 'If "msgstr"... + iMsgStarted = 3 + oSubContent.sMsgStr2 = sLine & vbCrLf + ElseIf reMsgContinued.Test(sLine) Then 'If "msgctxt", "msgid" or "msgstr" continued... + If iMsgStarted = 1 Then + sMsgCtxt = sMsgCtxt & oMatch.SubMatches(0) + oSubContent.sMsgCtxt2 = oSubContent.sMsgCtxt2 & sLine & vbCrLf + ElseIf iMsgStarted = 2 Then + Set oMatch = reMsgContinued.Execute(sLine)(0) + sMsgId = sMsgId & oMatch.SubMatches(0) + oSubContent.sMsgId2 = oSubContent.sMsgId2 & sLine & vbCrLf + ElseIf iMsgStarted = 3 Then + oSubContent.sMsgStr2 = oSubContent.sMsgStr2 & sLine & vbCrLf + End If + End If + Else 'If comment line... + iMsgStarted = -1 + Select Case Left(sLine, 2) + Case "#." 'Extracted comment... + oSubContent.sExtractedComments = oSubContent.sExtractedComments & sLine & vbCrLf + Case "#:" 'Reference... + oSubContent.sReferences = oSubContent.sReferences & sLine & vbCrLf + Case "#," 'Flag... + oSubContent.sFlags = oSubContent.sFlags & sLine & vbCrLf + Case Else 'Translator comment... + oSubContent.sTranslatorComments = oSubContent.sTranslatorComments & sLine & vbCrLf + End Select + End If + ElseIf iMsgStarted <> 0 Then 'If empty line AND there is pending translation... + iMsgStarted = 0 'Don't process same translation twice + If sMsgId = "" Then sMsgId = "__head__" + oContent.Add sMsgCtxt & sMsgId, oSubContent + sMsgCtxt = "" + Set oSubContent = New CSubContent + End If + Loop + oTextFile.Close + Set GetContentFromPoFile = oContent +End Function + +'' +' ... +Sub CreateUpdatedPoFile(ByVal sPoPath, ByVal oEnglishPotContent, ByVal oLanguagePoContent) + Dim sBakPath, oPoFile, sKey, oEnglish, oLanguage + + '-------------------------------------------------------------------------------- + ' Backup the old PO file... + '-------------------------------------------------------------------------------- + sBakPath = sPoPath & ".bak" + If oFSO.FileExists(sBakPath) Then + oFSO.DeleteFile sBakPath + End If + oFSO.MoveFile sPoPath, sBakPath + '-------------------------------------------------------------------------------- + + Set oPoFile = oFSO.CreateTextFile(sPoPath, True) + + Set oLanguage = oLanguagePoContent("__head__") + oPoFile.Write oLanguage.sTranslatorComments + oPoFile.Write oLanguage.sMsgId2 + oPoFile.Write oLanguage.sMsgStr2 + oPoFile.Write vbCrLf + For Each sKey In oEnglishPotContent.Keys 'For all English content... + If sKey <> "__head__" Then + Set oEnglish = oEnglishPotContent(sKey) + If oLanguagePoContent.Exists(sKey) Then 'If translation exists... + Set oLanguage = oLanguagePoContent(sKey) + Else 'If translation NOT exists... + Set oLanguage = oEnglish + End If + oPoFile.Write oLanguage.sTranslatorComments + oPoFile.Write oEnglish.sExtractedComments + oPoFile.Write oEnglish.sReferences + oPoFile.Write oLanguage.sFlags + oPoFile.Write oLanguage.sMsgCtxt2 + oPoFile.Write oLanguage.sMsgId2 + oPoFile.Write oLanguage.sMsgStr2 + oPoFile.Write vbCrLf + End If + Next + oPoFile.Close +End Sub + +'' +' ... +Function FormatTimestamp(now) + ' Form an ISO 8601 compliant timestamp without separators. Don't care about timezones. + FormatTimestamp = Right("0000" & Year(now), 4) & Right("00" & Month(now), 2) & Right("00" & Day(now), 2) _ + & "T" & Right("00" & Hour(now), 2) & Right("00" & Minute(now), 2) & Right("00" & Second(now), 2) +End Function + +'' +' ... +Function InfoBox(ByVal sText, ByVal iSecondsToWait) + Dim oShell + + If (bRunFromCmd = False) Then 'If run from command line... + Set oShell = Wscript.CreateObject("WScript.Shell") + InfoBox = oShell.Popup(sText, iSecondsToWait, Wscript.ScriptName, 64) + Else 'If NOT run from command line... + Wscript.Echo sText + End If +End Function + +'' +' ... +Function GetArchiveBit(ByVal sFilePath) + Dim oFile + GetArchiveBit = False + If oFSO.FileExists(sFilePath) Then 'If the file exists... + Set oFile = oFSO.GetFile(sFilePath) + If (oFile.Attributes And 32) = 32 Then 'If archive bit set... + GetArchiveBit = True + End If + End If +End Function + +'' +' ... +Sub SetArchiveBit(ByVal sFilePath, ByVal bValue) + Dim oFile + If oFSO.FileExists(sFilePath) Then 'If the file exists... + Set oFile = oFSO.GetFile(sFilePath) + If bValue Xor (oFile.Attributes And 32) = 32 Then 'If archive bit different... + oFile.Attributes = oFile.Attributes Xor 32 + End If + End If +End Sub diff --git a/Externals/heksedit/Languages/heksedit.rc b/Externals/heksedit/Languages/heksedit.rc new file mode 100644 index 000000000..ba5cde657 --- /dev/null +++ b/Externals/heksedit/Languages/heksedit.rc @@ -0,0 +1,1314 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINMENU MENU +BEGIN + POPUP "heksedit.rc:31" + BEGIN + MENUITEM "heksedit.rc:33", IDM_NEW + MENUITEM "heksedit.rc:34", IDM_OPEN + MENUITEM "heksedit.rc:35", IDM_PARTIAL_OPEN + MENUITEM "heksedit.rc:36", IDM_SAVE + MENUITEM "heksedit.rc:37", IDM_SAVE_AS + MENUITEM "heksedit.rc:38", IDM_SAVESELAS + MENUITEM "heksedit.rc:39", IDM_REVERT + MENUITEM "heksedit.rc:40", IDM_INSERTFILE + MENUITEM "heksedit.rc:41", IDM_DELETEFILE + MENUITEM "heksedit.rc:42", IDM_NEW + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:44", IDM_COPY_HEXDUMP + MENUITEM "heksedit.rc:45", IDM_OPEN_HEXDUMP + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:47", IDM_EXIT + MENUITEM "IDM_MRU", IDM_MRU1 + MENUITEM "IDM_MRU", IDM_MRU2 + MENUITEM "IDM_MRU", IDM_MRU3 + MENUITEM "IDM_MRU", IDM_MRU4 + MENUITEM "IDM_MRU", IDM_MRU5 + MENUITEM "IDM_MRU", IDM_MRU6 + MENUITEM "IDM_MRU", IDM_MRU7 + MENUITEM "IDM_MRU", IDM_MRU8 + MENUITEM "IDM_MRU", IDM_MRU9 + END + POPUP "heksedit.rc:58" + BEGIN + MENUITEM "heksedit.rc:60", ID_DISK_OPEN_DRIVE + MENUITEM "heksedit.rc:61", ID_DISK_CLOSEDRIVE + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:63", ID_DISK_GOTOFIRSTTRACK + MENUITEM "heksedit.rc:64", ID_DISK_GOTONEXTTRACK + MENUITEM "heksedit.rc:65", + ID_DISK_GOTOPREVIOUSTRACK + MENUITEM "heksedit.rc:67", ID_DISK_GOTOLASTTRACK + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:69", ID_DISK_GOTOTRACK + END + POPUP "heksedit.rc:71" + BEGIN + MENUITEM "heksedit.rc:73", IDM_EDIT_CUT + MENUITEM "heksedit.rc:74", IDM_EDIT_COPY + MENUITEM "heksedit.rc:75", IDM_EDIT_PASTE + MENUITEM "heksedit.rc:76", IDM_PASTE_WITH_DLG + MENUITEM "heksedit.rc:77", IDM_EDIT_MOVE_COPY + MENUITEM "heksedit.rc:78", IDM_EDIT_REVERSE + MENUITEM "heksedit.rc:79", IDM_EDIT_APPEND + MENUITEM "heksedit.rc:80", IDA_DELETEKEY + MENUITEM "heksedit.rc:81", IDM_SELECT_ALL + MENUITEM "heksedit.rc:82", IDM_SELECT_BLOCK + MENUITEM "heksedit.rc:83", IDM_FILL_WITH + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:85", IDM_CHANGE_MODE + MENUITEM "heksedit.rc:86", + IDA_INSERTMODETOGGLE + MENUITEM "heksedit.rc:88", IDM_EDIT_READONLYMODE + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:90", IDM_FIND + MENUITEM "heksedit.rc:91", IDM_REPLACE + MENUITEM "heksedit.rc:92", IDM_FINDPREV + MENUITEM "heksedit.rc:93", IDM_FINDNEXT + MENUITEM "heksedit.rc:94", IDM_GO_TO + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:96", + IDM_EDIT_ENTERDECIMALVALUE + MENUITEM "heksedit.rc:98", IDM_EDIT_MANIPULATEBITS + MENUITEM "heksedit.rc:99", IDM_COMPARE + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:101", IDM_READFLOAT + MENUITEM "heksedit.rc:102", IDM_PROPERTIES + MENUITEM "heksedit.rc:103", IDM_APPLYTEMPLATE + MENUITEM "heksedit.rc:104", IDM_OPEN_TEXT + END + POPUP "heksedit.rc:106" + BEGIN + MENUITEM "heksedit.rc:108", IDM_SCROLL_LEFT + MENUITEM "heksedit.rc:109", IDM_SCROLL_RIGHT + MENUITEM "heksedit.rc:110", IDM_SCROLL_UP + MENUITEM "heksedit.rc:111", IDM_SCROLL_DOWN + MENUITEM "heksedit.rc:112", IDM_SCROLL_PRIOR + MENUITEM "heksedit.rc:113", IDM_SCROLL_NEXT + END + POPUP "heksedit.rc:115" + BEGIN + MENUITEM "heksedit.rc:117", IDM_VIEW_SETTINGS + POPUP "heksedit.rc:118" + BEGIN + MENUITEM "heksedit.rc:120", IDM_TEXT_COLOR + MENUITEM "heksedit.rc:121", IDM_BK_COLOR + MENUITEM "heksedit.rc:122", IDM_SEP_COLOR + MENUITEM "heksedit.rc:123", + IDM_SELTEXT_COLOR + MENUITEM "heksedit.rc:125", + IDM_SELBACK_COLOR + MENUITEM "heksedit.rc:127", IDM_BMK_COLOR + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:129", + IDM_RESET_COLORS + MENUITEM "heksedit.rc:131", + IDM_ADOPT_COLOURS + END + MENUITEM "heksedit.rc:134", IDM_CHARACTER_SET + MENUITEM "heksedit.rc:135", IDM_BINARYMODE + MENUITEM "heksedit.rc:136", IDM_OLE_DRAG_DROP + MENUITEM "heksedit.rc:137", IDM_MAKE_BACKUPS, CHECKED + END + POPUP "heksedit.rc:139" + BEGIN + MENUITEM "heksedit.rc:141", IDM_CONTEXT, CHECKED + MENUITEM "heksedit.rc:142", IDM_UNKNOWN, CHECKED + MENUITEM "heksedit.rc:143", IDM_DEFAULT, CHECKED + MENUITEM "heksedit.rc:144", IDM_SAVEINI, CHECKED + MENUITEM "heksedit.rc:145", IDM_CHANGEINST + MENUITEM "heksedit.rc:146", IDM_REMOVE + MENUITEM "heksedit.rc:147", IDM_UPGRADE + MENUITEM "heksedit.rc:148", IDM_SHORTCUTS + END + POPUP "heksedit.rc:150" + BEGIN + MENUITEM "heksedit.rc:152", IDM_ADDBOOKMARK + MENUITEM "heksedit.rc:153", IDM_REMOVE_BKM + MENUITEM "heksedit.rc:154", IDM_CLEARALL_BMK + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:156", IDM_BOOKMARK1 + MENUITEM "heksedit.rc:157", IDM_BOOKMARK2 + MENUITEM "heksedit.rc:158", IDM_BOOKMARK3 + MENUITEM "heksedit.rc:159", IDM_BOOKMARK4 + MENUITEM "heksedit.rc:160", IDM_BOOKMARK5 + MENUITEM "heksedit.rc:161", IDM_BOOKMARK6 + MENUITEM "heksedit.rc:162", IDM_BOOKMARK7 + MENUITEM "heksedit.rc:163", IDM_BOOKMARK8 + MENUITEM "heksedit.rc:164", IDM_BOOKMARK9 + END + POPUP "heksedit.rc:166" + BEGIN + MENUITEM "heksedit.rc:168", ID_MISC_GOTO_DLL_EXPORTS + MENUITEM "heksedit.rc:169", ID_MISC_GOTO_DLL_IMPORTS + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:171", ID_MISC_ENCODEDECODE + END + POPUP "heksedit.rc:173" + BEGIN + MENUITEM "heksedit.rc:175", IDM_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:177", IDM_ABOUT + END +END + +IDR_CONTEXTMENU MENU +BEGIN + POPUP "0" + BEGIN + MENUITEM "heksedit.rc:185", IDM_EDIT_CUT + MENUITEM "heksedit.rc:186", IDM_EDIT_COPY + MENUITEM "heksedit.rc:187", IDM_EDIT_PASTE + MENUITEM "heksedit.rc:188", IDA_DELETEKEY + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:190", IDM_FIND + MENUITEM "heksedit.rc:191", IDM_REPLACE + MENUITEM "heksedit.rc:192", IDM_FINDNEXT + MENUITEM "heksedit.rc:193", IDM_FINDPREV + MENUITEM "heksedit.rc:194", IDM_GO_TO + END + POPUP "heksedit.rc:196" + BEGIN + MENUITEM "heksedit.rc:198", ID_DISK_GOTOFIRSTTRACK + MENUITEM "heksedit.rc:199", ID_DISK_GOTONEXTTRACK + MENUITEM "heksedit.rc:200", ID_DISK_GOTOPREVIOUSTRACK + MENUITEM "heksedit.rc:201", ID_DISK_GOTOLASTTRACK + MENUITEM SEPARATOR + MENUITEM "heksedit.rc:203", ID_DISK_GOTOTRACK + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_ACCELERATOR1 ACCELERATORS +BEGIN + "A", IDM_SELECT_ALL, VIRTKEY, CONTROL, NOINVERT + "A", IDM_ADOPT_COLOURS, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "B", IDM_EDIT_MANIPULATEBITS, VIRTKEY, CONTROL, NOINVERT + "B", IDM_BMK_COLOR, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "C", IDM_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "D", IDM_EDIT_ENTERDECIMALVALUE, VIRTKEY, CONTROL, NOINVERT + "D", IDM_DELETEFILE, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "E", IDM_SELECT_BLOCK, VIRTKEY, CONTROL, NOINVERT + "F", IDM_FIND, VIRTKEY, CONTROL, NOINVERT + "F", IDM_FILL_WITH, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "G", IDM_GO_TO, VIRTKEY, CONTROL, NOINVERT + "H", IDM_REPLACE, VIRTKEY, CONTROL, NOINVERT + "H", IDM_OPEN_HEXDUMP, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "I", IDM_VIEW_SETTINGS, VIRTKEY, CONTROL, NOINVERT + "I", IDM_INSERTFILE, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "J", IDM_SAVE_AS, VIRTKEY, CONTROL, NOINVERT + "K", IDM_BK_COLOR, VIRTKEY, CONTROL, NOINVERT + "K", IDM_SELBACK_COLOR, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "L", IDM_READFLOAT, VIRTKEY, CONTROL, NOINVERT + "M", IDM_COMPARE, VIRTKEY, CONTROL, NOINVERT + "M", IDM_EDIT_MOVE_COPY, VIRTKEY, CONTROL, ALT, NOINVERT + "M", IDM_MAKE_BACKUPS, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "N", IDM_NEW, VIRTKEY, CONTROL, NOINVERT + "O", IDM_OPEN, VIRTKEY, CONTROL, NOINVERT + "O", IDM_OLE_DRAG_DROP, VIRTKEY, CONTROL, ALT, NOINVERT + "O", IDM_SAVESELAS, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "P", IDM_EDIT_APPEND, VIRTKEY, CONTROL, NOINVERT + "P", IDM_PARTIAL_OPEN, VIRTKEY, ALT, NOINVERT + "Q", IDM_SEP_COLOR, VIRTKEY, CONTROL, NOINVERT + "R", IDM_CHARACTER_SET, VIRTKEY, CONTROL, NOINVERT + "R", IDM_EDIT_READONLYMODE, VIRTKEY, ALT, NOINVERT + "R", IDM_EDIT_REVERSE, VIRTKEY, CONTROL, ALT, NOINVERT + "R", IDM_REVERT, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "S", IDM_SAVE, VIRTKEY, CONTROL, NOINVERT + "S", IDM_RESET_COLORS, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "T", IDM_TEXT_COLOR, VIRTKEY, CONTROL, NOINVERT + "T", IDM_APPLYTEMPLATE, VIRTKEY, ALT, NOINVERT + "T", IDM_SELTEXT_COLOR, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "V", IDM_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "V", IDM_PASTE_WITH_DLG, VIRTKEY, SHIFT, CONTROL, + NOINVERT + VK_BACK, IDA_BACKSPACE, VIRTKEY, NOINVERT + VK_DELETE, IDA_DELETEKEY, VIRTKEY, NOINVERT + VK_DOWN, IDM_SCROLL_DOWN, VIRTKEY, CONTROL, NOINVERT + VK_F1, IDM_HELP_TOPICS, VIRTKEY, NOINVERT + VK_F2, IDM_INTERNALSTATUS, VIRTKEY, NOINVERT + VK_F3, IDM_FINDPREV, VIRTKEY, NOINVERT + VK_F4, IDM_FINDNEXT, VIRTKEY, NOINVERT + VK_F5, IDM_OPEN_TEXT, VIRTKEY, NOINVERT + VK_INSERT, IDA_INSERTMODETOGGLE, VIRTKEY, NOINVERT + VK_LEFT, IDM_SCROLL_LEFT, VIRTKEY, CONTROL, NOINVERT + VK_NEXT, IDM_SCROLL_NEXT, VIRTKEY, CONTROL, NOINVERT + VK_NEXT, ID_DISK_GOTONEXTTRACK, VIRTKEY, SHIFT, CONTROL, + NOINVERT + VK_PRIOR, IDM_SCROLL_PRIOR, VIRTKEY, CONTROL, NOINVERT + VK_PRIOR, ID_DISK_GOTOPREVIOUSTRACK, VIRTKEY, SHIFT, CONTROL, + NOINVERT + VK_RETURN, IDM_PROPERTIES, VIRTKEY, ALT, NOINVERT + VK_RIGHT, IDM_SCROLL_RIGHT, VIRTKEY, CONTROL, NOINVERT + VK_UP, IDM_SCROLL_UP, VIRTKEY, CONTROL, NOINVERT + "W", IDM_ADDBOOKMARK, VIRTKEY, CONTROL, NOINVERT + "W", IDM_REMOVE_BKM, VIRTKEY, ALT, NOINVERT + "W", IDM_CLEARALL_BMK, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "X", IDM_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT + "X", IDM_NEW, VIRTKEY, SHIFT, CONTROL, + NOINVERT + "Y", IDM_BINARYMODE, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_GOTODIALOG DIALOGEX 0, 0, 244, 66 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "heksedit.rc:332" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:335", + IDC_STATIC,7,10,139,8 + LTEXT "heksedit.rc:337", + IDC_STATIC,7,19,142,8 + LTEXT "heksedit.rc:339",IDC_STATIC,7,34,40,8 + EDITTEXT IDC_EDIT1,7,44,149,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:341",IDOK,187,20,50,14 + PUSHBUTTON "heksedit.rc:342",IDCANCEL,187,38,50,14 +END + +IDD_FINDDIALOG DIALOGEX 0, 0, 279, 138 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "heksedit.rc:348" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:351", + IDC_STATIC,7,7,265,16 + EDITTEXT IDC_EDIT1,7,26,265,57,ES_MULTILINE | ES_AUTOVSCROLL + CONTROL "heksedit.rc:354",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,87,53,10 + CONTROL "heksedit.rc:356",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,100,49,8 + GROUPBOX "heksedit.rc:358",IDC_STATIC,62,87,61,36 + CONTROL "heksedit.rc:359",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,71,98,25,10 + CONTROL "heksedit.rc:361",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,71,111,35, + 10 + DEFPUSHBUTTON "heksedit.rc:363",IDOK,222,100,50,14,WS_GROUP + PUSHBUTTON "heksedit.rc:364",IDCANCEL,222,117,50,14 +END + +IDD_ABOUTDIALOG DIALOGEX 0, 0, 212, 191 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_CAPTION +CAPTION "heksedit.rc:370" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "heksedit.rc:373",IDOK,80,171,50,14 + ICON 32512,IDC_APPICON,7,9,20,20 + LTEXT "",IDC_STATIC1,37,7,167,66 + LTEXT "heksedit.rc:376",IDC_STATIC,5,71,20,8 + EDITTEXT IDC_EDIT1,6,81,198,25,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY + EDITTEXT IDC_EDIT2,22,121,167,12,ES_AUTOHSCROLL | ES_READONLY + GROUPBOX "heksedit.rc:380",IDC_STATIC,6,111,198,52 + PUSHBUTTON "heksedit.rc:381",IDC_BUTTON1, + 30,140,150,14 +END + +IDD_HEXDUMPDIALOG DIALOGEX 0, 0, 163, 161 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:387" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:390",IDC_STATIC,7, + 7,128,8 + LTEXT "heksedit.rc:392",IDC_STATIC,7,17,72,8 + EDITTEXT IDC_EDIT1,6,25,149,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:394",IDC_STATIC,7,40, + 111,8 + EDITTEXT IDC_EDIT2,7,49,149,13,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:397",IDC_STATIC,7,69,88,40,WS_GROUP + CONTROL "heksedit.rc:398",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,14,80,55,10 + CONTROL "heksedit.rc:400",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,14,92,75,10 + GROUPBOX "heksedit.rc:402",IDC_STATIC,7,110,103,45,WS_GROUP + CONTROL "heksedit.rc:403",IDC_EXPORTDISPLAY,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,15,120,78,10 + CONTROL "heksedit.rc:405",IDC_EXPORTDIGITS,"Button", + BS_AUTORADIOBUTTON,15,130,89,10 + CONTROL "heksedit.rc:407",IDC_EXPORTRTF,"Button", + BS_AUTORADIOBUTTON,15,140,81,10 + DEFPUSHBUTTON "heksedit.rc:409",IDOK,105,70,50,14,WS_GROUP + PUSHBUTTON "heksedit.rc:410",IDCANCEL,105,90,50,14 +END + +IDD_DECIMALDIALOG DIALOGEX 0, 0, 204, 111 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:415" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:418",IDC_STATIC,7,7,65,8 + EDITTEXT IDC_EDIT1,7,16,97,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:420",IDC_STATIC,7,30, + 108,8 + EDITTEXT IDC_EDIT2,7,38,98,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:423",IDC_STATIC,7,54,54,8 + EDITTEXT IDC_EDIT3,7,62,97,12,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:425",IDC_STATIC,7,79,190,25 + CONTROL "heksedit.rc:426",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,11,88,49,10 + CONTROL "heksedit.rc:428",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON, + 63,88,57,10 + CONTROL "heksedit.rc:430",IDC_RADIO3,"Button", + BS_AUTORADIOBUTTON,122,88,71,10 + DEFPUSHBUTTON "heksedit.rc:432",IDOK,147,39,50,14,WS_GROUP + PUSHBUTTON "heksedit.rc:433",IDCANCEL,147,56,50,14 +END + +IDD_PASTEDIALOG DIALOGEX 0, 0, 291, 145 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:438" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:441",IDC_STATIC,7,7,76,8 + EDITTEXT IDC_EDIT1,7,18,277,65,ES_MULTILINE | WS_VSCROLL, + WS_EX_TRANSPARENT + GROUPBOX "heksedit.rc:444",IDC_STATIC,7,86,64,40 + CONTROL "heksedit.rc:445",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,14,98,46,10 + CONTROL "heksedit.rc:447",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,14,109,33,10 + LTEXT "heksedit.rc:449",IDC_STATIC,80,86,89,8 + EDITTEXT IDC_EDIT2,79,96,67,12,ES_AUTOHSCROLL + CONTROL "heksedit.rc:451",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,80,115,122,10 + LTEXT "heksedit.rc:453", + IDC_STATIC,7,129,160,8 + EDITTEXT IDC_EDIT3,168,126,60,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:456",IDOK,234,96,50,14 + PUSHBUTTON "heksedit.rc:457",IDCANCEL,234,112,50,14 +END + +IDD_CUTDIALOG DIALOGEX 0, 0, 169, 159 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:462" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:465", + IDC_STATIC,7,7,157,8 + EDITTEXT IDC_EDIT1,7,16,136,12,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:468",IDC_STATIC,7,33,155,81 + CONTROL "heksedit.rc:469",IDC_RADIO1,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,15,48,110,10 + CONTROL "heksedit.rc:471",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,15,80,89,10 + EDITTEXT IDC_EDIT2,16,59,136,12,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_EDIT3,15,91,136,12,ES_AUTOHSCROLL | WS_DISABLED | + WS_GROUP + CONTROL "heksedit.rc:476",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,120,65,10 + DEFPUSHBUTTON "heksedit.rc:478",IDOK,112,122,50,14 + PUSHBUTTON "heksedit.rc:479",IDCANCEL,112,138,50,14 +END + +IDD_COPYDIALOG DIALOGEX 0, 0, 158, 154 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:484" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:487",IDC_STATIC,7,7,86,8 + LTEXT "heksedit.rc:488",IDC_STATIC,7,20,72,8 + EDITTEXT IDC_EDIT1,7,29,130,13,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:490",IDC_STATIC,7,51,144,73 + CONTROL "heksedit.rc:491",IDC_RADIO1,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,63,115,10 + CONTROL "heksedit.rc:493",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,13,93,95,10 + EDITTEXT IDC_EDIT2,14,73,130,13,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_EDIT3,14,103,130,13,ES_AUTOHSCROLL | WS_DISABLED | + WS_GROUP + DEFPUSHBUTTON "heksedit.rc:498",IDOK,25,131,50,14 + PUSHBUTTON "heksedit.rc:499",IDCANCEL,82,131,50,14 +END + +IDD_VIEWSETTINGSDIALOG DIALOGEX 0, 0, 229, 167 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:504" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:507",IDC_STATIC,7,7, + 110,8 + EDITTEXT IDC_EDIT1,7,16,68,12,ES_AUTOHSCROLL + CONTROL "heksedit.rc:510", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | + WS_TABSTOP,7,31,214,19 + LTEXT "heksedit.rc:513", + IDC_STATIC,7,51,151,8 + EDITTEXT IDC_EDIT2,7,61,68,12,ES_AUTOHSCROLL + CONTROL "heksedit.rc:516",IDC_CHECK2, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,80, + 61,140,12 + GROUPBOX "heksedit.rc:519",IDC_STATIC,7,76, + 128,25,WS_GROUP + CONTROL "heksedit.rc:521",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,14,86,45,10 + CONTROL "heksedit.rc:523",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,65,86,37, + 10 + CONTROL "heksedit.rc:525",IDC_CHECK5,"Button", + BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,7,106,128,10 + LTEXT "heksedit.rc:527", + IDC_STATIC,7,122,133,8 + EDITTEXT IDC_EDIT3,7,132,214,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:530",IDOK,171,80,50,14 + PUSHBUTTON "heksedit.rc:531",IDCANCEL,171,97,50,14 +END + +IDD_APPENDDIALOG DIALOGEX 0, 0, 192, 46 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:536" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:539",IDC_STATIC,7,7, + 121,8 + EDITTEXT IDC_EDIT1,7,17,120,12,ES_AUTOHSCROLL | ES_NUMBER + DEFPUSHBUTTON "heksedit.rc:542",IDOK,135,7,50,14 + PUSHBUTTON "heksedit.rc:543",IDCANCEL,135,24,50,14 +END + +IDD_MANIPBITSDIALOG DIALOGEX 0, 0, 257, 84 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:548" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:551",IDC_STATIC1,7,7,243,8 + CONTROL "heksedit.rc:552",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 7,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:554",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 38,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:556",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 69,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:558",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 100,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:560",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 130,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:562",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 160,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:564",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 190,18,30,10,WS_EX_STATICEDGE + CONTROL "heksedit.rc:566",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 220,18,30,10,WS_EX_STATICEDGE + LTEXT "heksedit.rc:568",IDC_STATIC,15,29,17,8 + LTEXT "heksedit.rc:569",IDC_STATIC,48,29,13,8 + LTEXT "heksedit.rc:570",IDC_STATIC,77,29,13,8 + LTEXT "heksedit.rc:571",IDC_STATIC,108,29,13,8 + LTEXT "heksedit.rc:572",IDC_STATIC,140,29,9,8 + LTEXT "heksedit.rc:573",IDC_STATIC,171,29,9,8 + LTEXT "heksedit.rc:574",IDC_STATIC,202,29,9,8 + LTEXT "heksedit.rc:575",IDC_STATIC,231,29,9,8 + LTEXT "heksedit.rc:576",IDC_STATIC2,7,43,243,8 + DEFPUSHBUTTON "heksedit.rc:577",IDOK,75,63,50,14 + PUSHBUTTON "heksedit.rc:578",IDCANCEL,132,63,50,14 +END + +IDD_CHARACTERSETDIALOG DIALOGEX 0, 0, 172, 81 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "heksedit.rc:584" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "heksedit.rc:587",IDC_STATIC,7,7,101,40 + CONTROL "heksedit.rc:588",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 25,19,33,10 + CONTROL "heksedit.rc:590",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,25,32,32,10 + LTEXT "heksedit.rc:591",IDC_STATIC,7,53,101,8 + EDITTEXT IDC_EDIT1,7,62,65,12,ES_AUTOHSCROLL | ES_NUMBER + DEFPUSHBUTTON "heksedit.rc:593",IDOK,115,24,50,14 + PUSHBUTTON "heksedit.rc:594",IDCANCEL,115,41,50,14 +END + +IDD_CHOOSEDIFFDIALOG DIALOGEX 0, 0, 258, 231 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:599" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:602",IDC_STATIC2,7,7,244,8 + LTEXT "heksedit.rc:603",IDC_STATIC1,7,18,244,8 + LISTBOX IDC_LIST1,7,29,244,178,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + WS_TABSTOP + DEFPUSHBUTTON "heksedit.rc:606",IDOK,7,210,50,14 + PUSHBUTTON "heksedit.rc:607",IDCANCEL,74,210,50,14 + PUSHBUTTON "heksedit.rc:608",IDCOPY,187,210,64,14 +END + +IDD_BINARYMODEDIALOG DIALOGEX 0, 0, 183, 58 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:613" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "heksedit.rc:616",IDC_STATIC,7,7,104,44 + CONTROL "heksedit.rc:617",IDC_RADIO1,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,15,20,73,10 + CONTROL "heksedit.rc:619",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON,15,34,83,10 + DEFPUSHBUTTON "heksedit.rc:621",IDOK,126,12,50,14,WS_GROUP + PUSHBUTTON "heksedit.rc:622",IDCANCEL,126,29,50,14 +END + +IDD_SELECT_BLOCK_DIALOG DIALOGEX 0, 0, 207, 68 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:627" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:630", + IDC_STATIC,7,7,134,8 + EDITTEXT IDC_EDIT1,7,17,134,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:633", + IDC_STATIC2,7,36,133,8 + EDITTEXT IDC_EDIT2,7,48,133,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:636",IDOK,150,18,50,14 + PUSHBUTTON "heksedit.rc:637",IDCANCEL,150,35,50,14 +END + +IDD_ADDBMK_DIALOG DIALOGEX 0, 0, 193, 65 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:642" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:645",IDC_STATIC,7,7, + 114,8 + EDITTEXT IDC_EDIT1,7,18,118,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:648",IDC_STATIC,7,36,63,8 + EDITTEXT IDC_EDIT2,7,46,118,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:650",IDOK,136,16,50,14 + PUSHBUTTON "heksedit.rc:651",IDCANCEL,136,33,50,14 +END + +IDD_REMOVEBMK_DIALOG DIALOGEX 0, 0, 209, 167 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:656" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:659",IDC_STATIC,7,7,84,8 + LISTBOX IDC_LIST1,7,17,195,123,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "heksedit.rc:662",IDOK,51,146,50,14 + PUSHBUTTON "heksedit.rc:663",IDCANCEL,109,146,50,14 +END + +IDD_OPEN_PARTIAL_DIALOG DIALOGEX 0, 0, 221, 135 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:668" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "heksedit.rc:671",IDC_STATIC,7,7,207,60 + CONTROL "heksedit.rc:672", + IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,21, + 179,10 + CONTROL "heksedit.rc:675",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON,17,50,64,10 + EDITTEXT IDC_EDIT1,28,31,134,12,ES_AUTOHSCROLL | WS_GROUP + LTEXT "heksedit.rc:678",IDC_STATIC2,7,73,207,8 + EDITTEXT IDC_EDIT2,7,82,135,13,ES_AUTOHSCROLL + CONTROL "heksedit.rc:680", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,100, + 206,10 + DEFPUSHBUTTON "heksedit.rc:683",IDOK,55,115,50,14 + PUSHBUTTON "heksedit.rc:684",IDCANCEL,110,115,50,14 +END + +IDD_FASTPASTE_DIALOG DIALOGEX 0, 0, 267, 146 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:689" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "heksedit.rc:692",IDC_STATIC,7,7,64,35 + CONTROL "heksedit.rc:693",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,14,18,46,10 + CONTROL "heksedit.rc:695",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,14,30,33,10 + LTEXT "heksedit.rc:697",IDC_STATIC,80,7,89,8 + EDITTEXT IDC_EDIT2,79,17,67,12,ES_AUTOHSCROLL + CONTROL "heksedit.rc:699",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,80,36,122,10 + LTEXT "heksedit.rc:701", + IDC_STATIC,7,49,156,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT3,170,49,35,12,ES_AUTOHSCROLL + LTEXT "heksedit.rc:704",IDC_STATIC,5,65,75,8 + LISTBOX IDC_LIST,5,75,255,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + WS_HSCROLL | WS_TABSTOP + LTEXT "heksedit.rc:707", + IDC_STATIC,5,115,255,25 + DEFPUSHBUTTON "heksedit.rc:709",IDOK,210,11,50,14 + PUSHBUTTON "heksedit.rc:710",IDCANCEL,210,28,50,14 + PUSHBUTTON "heksedit.rc:711",IDC_REFRESH,210,45,50,15 +END + +IDD_TMPL_RESULT_DIALOG DIALOGEX 0, 0, 304, 175 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:716" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:719",IDC_STATIC,7,7,96,8 + EDITTEXT IDC_EDIT1,7,17,290,132,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL + DEFPUSHBUTTON "heksedit.rc:722",IDOK,99,154,50,14 + PUSHBUTTON "heksedit.rc:723",IDCANCEL,154,154,50,14 +END + +IDD_REPLACEDIALOG DIALOGEX 0, 0, 208, 226 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:728" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:731",IDC_STATIC,7,7,34,8 + EDITTEXT IDC_TO_REPLACE_EDIT,7,16,194,62,ES_MULTILINE | + ES_AUTOHSCROLL | WS_VSCROLL + PUSHBUTTON "heksedit.rc:734",IDC_FINDNEXT_BUTTON,7,81,39,14 + PUSHBUTTON "heksedit.rc:735",IDC_FINDPREVIOUS_BUTTON,51,81,54,14 + CONTROL "heksedit.rc:736",IDC_MATCHCASE_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,146,81,53,10 + LTEXT "heksedit.rc:738",IDC_STATIC,7,98,44,8 + EDITTEXT IDC_REPLACEWITH_EDIT,7,108,194,58,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:740",IDC_STATIC,7,169,105,50 + PUSHBUTTON "heksedit.rc:741",IDC_FOLLOCC_BUTTON,13,180,90, + 14 + PUSHBUTTON "heksedit.rc:743",IDC_PREVOCC_BUTTON,14,196,89, + 14 + CONTROL "heksedit.rc:745",IDC_USETRANSLATION_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,126,172,75,10 + PUSHBUTTON "heksedit.rc:747",IDC_REPLACE_BUTTON,148,186,53,14 + PUSHBUTTON "heksedit.rc:748",IDCANCEL,147,205,54,14 +END + +IDD_FILL_WITH DIALOGEX 0, 0, 382, 103 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:753" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:756",IDC_STATIC,5,5,56,8 + COMBOBOX IDC_TYPE,65,5,35,35,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "heksedit.rc:759",IDC_FILESTAT,105,5,14,12 + EDITTEXT IDC_FN,120,5,210,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "heksedit.rc:761",IDC_BROWSE,335,5,40,15 + LTEXT "heksedit.rc:762",IDC_HEXSTAT,5,15,40,8 + EDITTEXT IDC_HEX,5,25,370,12,ES_AUTOHSCROLL + GROUPBOX "heksedit.rc:764",IDC_STATIC,5,38,100,25 + CONTROL "heksedit.rc:765",IDC_EQ,"Button",BS_AUTORADIOBUTTON | BS_LEFT | + BS_VCENTER | WS_GROUP,10,48,20,10 + CONTROL "heksedit.rc:767",IDC_OR,"Button",BS_AUTORADIOBUTTON | BS_LEFT | + BS_VCENTER,30,48,21,10 + CONTROL "heksedit.rc:769",IDC_AND,"Button",BS_AUTORADIOBUTTON | BS_LEFT | + BS_VCENTER,50,48,24,10 + CONTROL "heksedit.rc:771",IDC_XOR,"Button",BS_AUTORADIOBUTTON | BS_LEFT | + BS_VCENTER,75,48,24,10 + DEFPUSHBUTTON "heksedit.rc:773",IDOK,165,45,50,15,WS_GROUP + PUSHBUTTON "heksedit.rc:774",IDCANCEL,250,45,50,15 + LTEXT "heksedit.rc:775",IDC_STATIC,5,65,13,8 + LTEXT "heksedit.rc:776",IDC_STATIC,5,73,54,8 + EDITTEXT IDC_STS,5,84,55,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "heksedit.rc:778",IDC_STATIC,65,73,52,8 + EDITTEXT IDC_ES,65,84,55,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "heksedit.rc:780",IDC_STATIC,125,73,52,8 + EDITTEXT IDC_SS,125,84,55,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "heksedit.rc:782",IDC_STATIC,185, + 65,60,18 + EDITTEXT IDC_SI,185,84,55,12,ES_AUTOHSCROLL | ES_READONLY + CTEXT "heksedit.rc:785",IDC_STATIC,255,65,50, + 15 + EDITTEXT IDC_IFS,245,84,75,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "heksedit.rc:788",IDC_STATIC,330,73,35,8 + EDITTEXT IDC_R,325,84,50,12,ES_AUTOHSCROLL | ES_READONLY +END + +IDD_CHANGEINST DIALOGEX 0, 0, 247, 76 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:794" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:797",IDC_STATIC,5,5,105, + 15,SS_CENTERIMAGE + EDITTEXT IDC_EDIT1,150,5,25,15,ES_AUTOHSCROLL + CONTROL "heksedit.rc:800",IDC_LINST,"msctls_updown32",UDS_SETBUDDYINT | + UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,175,5,11, + 15 + LTEXT "heksedit.rc:803", + IDC_STATIC,5,25,144,15,SS_CENTERIMAGE + EDITTEXT IDC_EDIT0,150,25,25,15,ES_AUTOHSCROLL + CONTROL "heksedit.rc:806",IDC_SINST,"msctls_updown32",UDS_SETBUDDYINT | + UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,175,25, + 11,15 + DEFPUSHBUTTON "heksedit.rc:809",IDOK,190,5,50,15 + PUSHBUTTON "heksedit.rc:810",IDCANCEL,190,25,50,15 + LTEXT "heksedit.rc:811", + IDC_STATIC,5,45,235,25 +END + +IDD_ENCODE_DECODE_DIALOG DIALOGEX 0, 0, 236, 169 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:817" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:820",IDC_STATIC,4,4,172,8 + LISTBOX IDC_LIST1,4,16,172,108,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + LTEXT "heksedit.rc:823",IDC_STATIC,4,128,36,8 + EDITTEXT IDC_EDIT1,4,140,172,12,ES_AUTOHSCROLL + CONTROL "heksedit.rc:825",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,4,156,76,8 + CONTROL "heksedit.rc:827",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,100,156, + 76,8 + DEFPUSHBUTTON "heksedit.rc:829",IDOK,180,4,50,14,WS_GROUP + PUSHBUTTON "heksedit.rc:830",IDCANCEL,180,20,50,14 +END + +IDD_OPEN_DRIVE_DIALOG DIALOGEX 0, 0, 236, 133 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:835" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LISTBOX IDC_LIST1,4,4,172,124,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "heksedit.rc:840",IDOK,180,4,50,14 + PUSHBUTTON "heksedit.rc:841",IDCANCEL,180,20,50,14 +END + +IDD_GOTO_TRACK_DIALOG DIALOGEX 0, 0, 244, 133 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "heksedit.rc:847" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:850",-1,4,4,168,12 + EDITTEXT IDC_EDIT3,4,20,172,80,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY + LTEXT "heksedit.rc:853",-1,4,104,38,8 + EDITTEXT IDC_EDIT1,4,114,100,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "heksedit.rc:855",IDOK,184,8,50,14 + PUSHBUTTON "heksedit.rc:856",IDCANCEL,184,26,50,14 +END + +IDD_SHORTCUTS DIALOGEX 0, 0, 217, 166 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:861" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:864",IDC_STATIC,5,5,86,8 + CONTROL "heksedit.rc:865",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_TABSTOP,5,15, + 105,120,WS_EX_CLIENTEDGE + PUSHBUTTON "heksedit.rc:868", + IDC_FIND_AND_FIX,5,140,205,20,BS_CENTER | BS_VCENTER | + BS_MULTILINE + LTEXT "heksedit.rc:871",IDC_STATIC,115,5,55,8 + PUSHBUTTON "heksedit.rc:872",IDC_DESKTOP,115,15,40,15,BS_CENTER | + BS_VCENTER | BS_MULTILINE + PUSHBUTTON "heksedit.rc:874",IDC_START,160,15,50,15,BS_CENTER | + BS_VCENTER | BS_MULTILINE + PUSHBUTTON "heksedit.rc:876",IDC_SENDTO,115,35,40,15,BS_CENTER | + BS_VCENTER | BS_MULTILINE + PUSHBUTTON "heksedit.rc:878",IDC_PROGRAMS,160,35,50,15,BS_CENTER | + BS_VCENTER | BS_MULTILINE + LTEXT "heksedit.rc:880",IDC_STATIC,115,55,59,8 + PUSHBUTTON "heksedit.rc:881",IDC_ADD,115,65,45,20 + PUSHBUTTON "heksedit.rc:882",IDC_UPDATE,165,65,45,20,BS_CENTER | + BS_VCENTER | BS_MULTILINE + PUSHBUTTON "heksedit.rc:884",IDC_DELETE,115,90,45,20 + PUSHBUTTON "heksedit.rc:885",IDC_MOVE,165,90,45,20,BS_CENTER | BS_VCENTER | + BS_MULTILINE + PUSHBUTTON "heksedit.rc:887",IDC_RELOAD,115,115,45,20 + DEFPUSHBUTTON "heksedit.rc:888",IDCANCEL,165,115,45,20 +END + +IDD_UPGRADE DIALOGEX 0, 0, 377, 242 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:893" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:896",IDC_STATIC,5,5,36,8 + CONTROL "heksedit.rc:897",IDC_VERS,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | + WS_TABSTOP,5,15,115,80,WS_EX_CLIENTEDGE + LTEXT "heksedit.rc:900",IDC_STATIC,125,5,40,8 + CONTROL "heksedit.rc:901",IDC_INSTS,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | + LVS_NOSORTHEADER | WS_TABSTOP,125,15,85,80, + WS_EX_CLIENTEDGE + LTEXT "heksedit.rc:905",IDC_STATIC,215,5,46,8 + CONTROL "heksedit.rc:906",IDC_INSTDATA,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_TABSTOP,215,15, + 155,80,WS_EX_CLIENTEDGE + CONTROL "heksedit.rc:909",IDC_LINKS,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | + WS_TABSTOP,5,100,110,90,WS_EX_CLIENTEDGE + CONTROL "",IDC_DISPLAY,"Button",BS_OWNERDRAW | WS_DISABLED | + WS_SYSMENU | WS_GROUP | WS_TABSTOP,120,100,115,90, + WS_EX_DLGMODALFRAME + CONTROL "heksedit.rc:915",IDC_MRU,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | + WS_TABSTOP,240,100,130,90,WS_EX_CLIENTEDGE + PUSHBUTTON "heksedit.rc:918",IDC_COPY,5,195,75,15 + PUSHBUTTON "heksedit.rc:919",IDC_READ,95,195,75,15 + PUSHBUTTON "heksedit.rc:920",IDC_DELETE,185,195,75,15 + DEFPUSHBUTTON "heksedit.rc:921",IDCANCEL,275,195,75,15 + CTEXT "heksedit.rc:922", + IDC_STATIC,45,215,270,25 +END + +IDD_MOVE_COPY DIALOGEX 0, 0, 163, 156 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:928" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:931",IDC_STATIC,5,15,97,8, + SS_CENTERIMAGE + EDITTEXT IDC_1STOFFSET,5,25,150,12,ES_AUTOHSCROLL | WS_GROUP + LTEXT "heksedit.rc:934",IDC_STATIC,5,45,62,8,SS_NOTIFY | + SS_CENTERIMAGE + CONTROL "heksedit.rc:936",IDC_OTHEREND,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,70,45,47,10 + CONTROL "heksedit.rc:938",IDC_LEN,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,120,45,38,10 + EDITTEXT IDC_2NDDELIM,5,55,150,12,ES_AUTOHSCROLL | WS_GROUP + LTEXT "heksedit.rc:941",IDC_STATIC,5,75,72,8,SS_NOTIFY | + SS_CENTERIMAGE + LTEXT "heksedit.rc:943",IDC_STATIC,5,85,28,8 + CONTROL "heksedit.rc:944",IDC_FORWARD,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,85,75,74,10 + CONTROL "heksedit.rc:946",IDC_FPOS,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,35,85,35,10 + CONTROL "heksedit.rc:948",IDC_LPOS,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,70,85,71,10 + EDITTEXT IDC_MOVEMENT,5,96,150,12,ES_AUTOHSCROLL | WS_GROUP + LTEXT "heksedit.rc:951", + IDC_STATIC,5,115,150,18 + DEFPUSHBUTTON "heksedit.rc:953",IDOK,5,136,70,14 + PUSHBUTTON "heksedit.rc:954",IDCANCEL,90,136,65,14 + LTEXT "heksedit.rc:955",IDC_STATIC,5,5,34,8 + CONTROL "heksedit.rc:956",IDC_MOVE,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 45,5,34,10 + CONTROL "heksedit.rc:958",IDC_COPY,"Button",BS_AUTORADIOBUTTON,80,5,32,10 +END + +IDD_DRAG_DROP DIALOGEX 0, 0, 202, 121 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:963" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "heksedit.rc:966",-1,5,5,82,8 + CONTROL "heksedit.rc:967",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | WS_TABSTOP,5,15, + 135,100,WS_EX_CLIENTEDGE + DEFPUSHBUTTON "heksedit.rc:970",IDOK,145,15,50,15 + PUSHBUTTON "heksedit.rc:971",IDCANCEL,145,35,50,15 + PUSHBUTTON "heksedit.rc:972",IDC_UP,145,55,50,15 + PUSHBUTTON "heksedit.rc:973",IDC_DOWN,145,75,50,15 + CONTROL "heksedit.rc:974",IDC_MOVE,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 145,95,34,10 + CONTROL "heksedit.rc:976",IDC_COPY,"Button",BS_AUTORADIOBUTTON,145,105,32, + 10 +END + +IDD_DRAG_DROP_OPTIONS DIALOGEX 0, 0, 312, 116 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "heksedit.rc:982" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "heksedit.rc:985",IDC_STATIC,5,0,145,75 + CONTROL "heksedit.rc:986",IDC_ENABLE_DROP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,10,71,10 + CONTROL "heksedit.rc:988",IDC_ENABLE_DRAG,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,20,76,10 + CONTROL "heksedit.rc:990",IDC_EN_SD_DD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,126,10 + CONTROL "heksedit.rc:992",IDC_EN_SD_SEL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,40,124,10 + CONTROL "heksedit.rc:994", + IDC_ALWAYS_CHOOSE,"Button",BS_AUTOCHECKBOX | BS_LEFT | + BS_VCENTER | BS_MULTILINE | WS_TABSTOP,10,50,135,20 + GROUPBOX "heksedit.rc:997",IDC_STATIC,155,0,150,45 + CONTROL "heksedit.rc:998",IDC_DROP_CF_HDROP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,10,132,10 + CONTROL "heksedit.rc:1000",IDC_DROP_BIN_DATA, + "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | + WS_TABSTOP,165,20,105,10 + CONTROL "heksedit.rc:1003",IDC_DROP_CF_TEXT,"Button", + BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,165, + 30,95,10 + GROUPBOX "heksedit.rc:1006",IDC_STATIC,155,45,150,65 + CONTROL "heksedit.rc:1007",IDC_DRAG_BIN_DATA,"Button", + BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_GROUP | + WS_TABSTOP,165,55,75,10 + CONTROL "heksedit.rc:1010",IDC_DRAG_CF_TEXT,"Button", + BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_GROUP | + WS_TABSTOP,165,65,76,10 + CONTROL "heksedit.rc:1013",IDC_TEXT_HEXDUMP,"Button",BS_AUTORADIOBUTTON | + BS_LEFT | BS_VCENTER | WS_GROUP,175,75,46,10 + CONTROL "heksedit.rc:1015",IDC_TEXT_SPECIAL,"Button", + BS_AUTORADIOBUTTON | BS_LEFT | BS_VCENTER,175,85,95,10 + CONTROL "heksedit.rc:1017",IDC_TEXT_DISPLAY,"Button", + BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_GROUP | + WS_TABSTOP,225,75,74,10 + CONTROL "heksedit.rc:1020",IDC_DRAG_RTF, + "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | + WS_GROUP | WS_TABSTOP,165,95,138,10 + DEFPUSHBUTTON "heksedit.rc:1023",IDOK,15,85,55,20 + PUSHBUTTON "heksedit.rc:1024",IDCANCEL,85,85,55,20 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_GOTODIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 237 + TOPMARGIN, 10 + BOTTOMMARGIN, 59 + END + + IDD_FINDDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 272 + TOPMARGIN, 7 + BOTTOMMARGIN, 131 + END + + IDD_ABOUTDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 205 + TOPMARGIN, 7 + BOTTOMMARGIN, 192 + END + + IDD_HEXDUMPDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 156 + TOPMARGIN, 7 + BOTTOMMARGIN, 154 + END + + IDD_DECIMALDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 197 + TOPMARGIN, 7 + BOTTOMMARGIN, 104 + END + + IDD_PASTEDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 284 + TOPMARGIN, 7 + BOTTOMMARGIN, 138 + END + + IDD_CUTDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 162 + TOPMARGIN, 7 + BOTTOMMARGIN, 152 + END + + IDD_COPYDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 151 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_VIEWSETTINGSDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 221 + TOPMARGIN, 7 + BOTTOMMARGIN, 160 + END + + IDD_APPENDDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 185 + TOPMARGIN, 7 + BOTTOMMARGIN, 39 + END + + IDD_MANIPBITSDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 250 + TOPMARGIN, 7 + BOTTOMMARGIN, 77 + END + + IDD_CHARACTERSETDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 165 + TOPMARGIN, 7 + BOTTOMMARGIN, 74 + END + + IDD_CHOOSEDIFFDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 224 + END + + IDD_BINARYMODEDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 176 + TOPMARGIN, 7 + BOTTOMMARGIN, 51 + END + + IDD_SELECT_BLOCK_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 200 + TOPMARGIN, 7 + BOTTOMMARGIN, 61 + END + + IDD_ADDBMK_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 186 + TOPMARGIN, 7 + BOTTOMMARGIN, 58 + END + + IDD_REMOVEBMK_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 202 + TOPMARGIN, 7 + BOTTOMMARGIN, 160 + END + + IDD_OPEN_PARTIAL_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 214 + TOPMARGIN, 7 + BOTTOMMARGIN, 128 + END + + IDD_FASTPASTE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 7 + BOTTOMMARGIN, 139 + END + + IDD_TMPL_RESULT_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 297 + TOPMARGIN, 7 + BOTTOMMARGIN, 168 + END + + IDD_REPLACEDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 201 + TOPMARGIN, 7 + BOTTOMMARGIN, 219 + END + + IDD_FILL_WITH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 375 + TOPMARGIN, 7 + BOTTOMMARGIN, 96 + END + + IDD_CHANGEINST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 240 + TOPMARGIN, 7 + BOTTOMMARGIN, 69 + END + + IDD_ENCODE_DECODE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 229 + TOPMARGIN, 7 + BOTTOMMARGIN, 162 + END + + IDD_OPEN_DRIVE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 229 + TOPMARGIN, 7 + BOTTOMMARGIN, 126 + END + + IDD_GOTO_TRACK_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 237 + TOPMARGIN, 10 + BOTTOMMARGIN, 126 + END + + IDD_MOVE_COPY, DIALOG + BEGIN + BOTTOMMARGIN, 140 + END + + IDD_DRAG_DROP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 195 + TOPMARGIN, 7 + BOTTOMMARGIN, 114 + END + + IDD_DRAG_DROP_OPTIONS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 305 + TOPMARGIN, 7 + BOTTOMMARGIN, 109 + END +END +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +//IDB_TOOLBAR BITMAP "res/Toolbar.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDM_OPEN "heksedit.rc:1281" + IDM_NEW "heksedit.rc:1282" +END + +STRINGTABLE +BEGIN + IDM_SAVE "heksedit.rc:1287" + IDM_FIND "heksedit.rc:1288" + IDM_EDIT_COPY "heksedit.rc:1289" + IDM_EDIT_PASTE "heksedit.rc:1290" + IDM_HELP_TOPICS "heksedit.rc:1291" + IDM_EDIT_CUT "heksedit.rc:1292" +END + +STRINGTABLE +BEGIN + IDM_REPLACE "heksedit.rc:1297" +END + +STRINGTABLE +BEGIN + ID_DISK_GOTONEXTTRACK "heksedit.rc:1302" + ID_DISK_GOTOPREVIOUSTRACK "heksedit.rc:1303" + ID_DISK_GOTOFIRSTTRACK "heksedit.rc:1304" + ID_DISK_GOTOLASTTRACK "heksedit.rc:1305" +END + +#endif // Englisch (USA) resources +///////////////////////////////////////////////////////////////////////////// + + + +#include "version.rc" +en-US.pot RCDATA "en-US.pot" diff --git a/Externals/heksedit/OpenPartiallyDlg.cpp b/Externals/heksedit/OpenPartiallyDlg.cpp index edf6d0502..94aa2a76e 100644 --- a/Externals/heksedit/OpenPartiallyDlg.cpp +++ b/Externals/heksedit/OpenPartiallyDlg.cpp @@ -55,7 +55,7 @@ BOOL OpenPartiallyDlg::Apply(HWND hDlg) MessageBox(hDlg, "Too many bytes to load.", "Open partially", MB_ICONERROR); return FALSE; } - //int filehandle = _open(szFileName, _O_RDONLY|_O_BINARY, _S_IREAD|_S_IWRITE); + //int filehandle = _open(szFileName, _O_RDONLY|_O_BINARY); /*if (filehandle == -1) { char buf[500]; diff --git a/Externals/heksedit/PDrive95.cpp b/Externals/heksedit/PDrive95.cpp index 2c5d7324e..48d12131f 100644 --- a/Externals/heksedit/PDrive95.cpp +++ b/Externals/heksedit/PDrive95.cpp @@ -1,5 +1,6 @@ #include "precomp.h" #include "pdrive95.h" +#include "DllProxies.h" #define SIZE_OF_ONE_BLOCK 512 #define SIZE_OF_ONE_BLOCKL 512L @@ -26,16 +27,17 @@ typedef struct } MBR; // RAW functions -LPFNResetDisk m_ResetDisk = NULL; -LPFNReadPhysicalSector m_ReadPhysicalSector = NULL; -LPFNWritePhysicalSector m_WritePhysicalSector = NULL; -LPFNReadDiskGeometry m_ReadDiskGeometry = NULL; -LPFNEI13GetDriveParameters m_EI13GetDriveParameters = NULL; -LPFNEI13ReadSector m_EI13ReadSector = NULL; -LPFNEI13WriteSector m_EI13WriteSector = NULL; +struct RAWIO32 *P9xPhysicalDrive::RAWIO32 = 0; P9xPhysicalDrive::P9xPhysicalDrive() { + // Load the RAWIO32.DLL if not yet done + if (RAWIO32 == 0 && (RAWIO32 = ::RAWIO32) == 0) + { + TCHAR buf[1024]; + ::RAWIO32.Proxy.FormatMessage(buf); + ::MessageBox(::GetActiveWindow(), buf, 0, MB_ICONSTOP); + } m_hDevice = 0; } @@ -114,30 +116,9 @@ BOOL P9xPhysicalDrive::ReadPartitionInfoRecursive(DWORD dwSector,INT64 TotalOffs BOOL P9xPhysicalDrive::Open( int iDrive ) { Close(); - if( m_ResetDisk == NULL ) - { - HINSTANCE hLibrary = (HINSTANCE)LoadLibrary( "RAWIO32.DLL" ); - if( !hLibrary ) - { - printf("ERROR %s, unable to load RAWIO32.DLL.\n", (LPCSTR) GetLastErrorString() ); - return FALSE; - } - - #define GETPROC(__NAME__) \ - m_##__NAME__ = (LPFN##__NAME__) GetProcAddress(hLibrary,#__NAME__); \ - if( !m_##__NAME__ ) { \ - printf("ERROR, missing export " #__NAME__ " IN DISKIO32.DLL\n" ); \ - return FALSE; \ - } - - GETPROC( ResetDisk ) - GETPROC( ReadPhysicalSector ) - GETPROC( WritePhysicalSector ) - GETPROC( ReadDiskGeometry ) - GETPROC( EI13GetDriveParameters ) - GETPROC( EI13ReadSector ) - GETPROC( EI13WriteSector ) - } + // Cannot open if RAWIO32.DLL is not in place + if (RAWIO32 == 0) + return FALSE; TRACE("About to get geometry\n"); m_bDriveNumber = (BYTE)(128 + iDrive); @@ -186,7 +167,7 @@ BOOL P9xPhysicalDrive::GetDriveGeometry( DISK_GEOMETRY* lpDG ) ZeroMemory(&edi,sizeof(edi)); edi.drive = m_bDriveNumber; - if( m_EI13GetDriveParameters(&edi) > 0 ) + if (RAWIO32->EI13GetDriveParameters(&edi) > 0) { lpDG->Cylinders.QuadPart = *(INT64*)&(edi.sectorsLo); lpDG->TracksPerCylinder = 1; //edi.heads; @@ -198,7 +179,7 @@ BOOL P9xPhysicalDrive::GetDriveGeometry( DISK_GEOMETRY* lpDG ) ZeroMemory(&si,sizeof(si)); si.bDrive = m_bDriveNumber; - if( m_ReadDiskGeometry(&si) > 0 ) + if (RAWIO32->ReadDiskGeometry(&si) > 0) { lpDG->Cylinders.QuadPart = si.wCylinder; lpDG->TracksPerCylinder = si.bHead; @@ -215,7 +196,7 @@ BOOL P9xPhysicalDrive::ReadAbsolute( LPBYTE lpbMemory, DWORD dwSize, INT64 Secto *((INT64*)&(bi.scheiss[0])) = Sector; bi.count = (WORD) (dwSize / SIZE_OF_ONE_BLOCK); - if( m_EI13ReadSector (&bi, lpbMemory, dwSize) > 0 ) + if (RAWIO32->EI13ReadSector(&bi, lpbMemory, dwSize) > 0) return TRUE; /* ***** NOT SUPPORTED ******* @@ -235,36 +216,32 @@ struct SectorInfo return FALSE; } -BOOL P9xPhysicalDrive::GetDriveGeometryEx( DISK_GEOMETRY_EX* lpDG, DWORD dwSize ) +BOOL P9xPhysicalDrive::GetDriveGeometryEx(DISK_GEOMETRY_EX *, DWORD) { - UNREFERENCED_PARAMETER( lpDG ); - UNREFERENCED_PARAMETER( dwSize ); return FALSE; } -BOOL P9xPhysicalDrive::GetDriveLayoutEx( LPBYTE lpbMemory, DWORD dwSize ) +BOOL P9xPhysicalDrive::GetDriveLayoutEx(LPBYTE, DWORD) { - UNREFERENCED_PARAMETER( lpbMemory ); - UNREFERENCED_PARAMETER( dwSize ); return FALSE; } BOOL P9xPhysicalDrive::GetDriveLayout( LPBYTE lpbMemory, DWORD dwSize ) { - DWORD dwBytesRequired = sizeof(DRIVE_LAYOUT_INFORMATION) + sizeof(PARTITION_INFORMATION)*(m_PartitionInfo.m_lCount-1); + DWORD dwBytesRequired = sizeof(DRIVE_LAYOUT_INFORMATION) + sizeof(PARTITION_INFORMATION) * (m_PartitionInfo.Count - 1); - if( dwSize < dwBytesRequired ) + if (dwSize < dwBytesRequired) return FALSE; PDRIVE_LAYOUT_INFORMATION pli = (PDRIVE_LAYOUT_INFORMATION) lpbMemory; - pli->PartitionCount = m_PartitionInfo.m_lCount; + pli->PartitionCount = m_PartitionInfo.Count; pli->Signature = 0; int index = 0; - ENUMERATE( &m_PartitionInfo, P9xPartitionInfo, pI ) + LIST_ENTRY *Flink = &m_PartitionInfo; + while ((Flink = Flink->Flink) != &m_PartitionInfo) { - pli->PartitionEntry[index++] = pI->m_pi; + P9xPartitionInfo *pi = static_cast(Flink); + pli->PartitionEntry[index++] = pi->m_pi; } return TRUE; } - - diff --git a/Externals/heksedit/PDrive95.h b/Externals/heksedit/PDrive95.h index b02e9b97f..4a0112051 100644 --- a/Externals/heksedit/PDrive95.h +++ b/Externals/heksedit/PDrive95.h @@ -11,32 +11,34 @@ http://www.win.tue.nl/~aeb/partitions/partition_types-1.html class P9xPartitionInfo : public PNode { - public: - P9xPartitionInfo(PARTITION_INFORMATION* pi):m_pi(*pi){} +public: + P9xPartitionInfo(PARTITION_INFORMATION* pi):m_pi(*pi){} - PARTITION_INFORMATION m_pi; + PARTITION_INFORMATION m_pi; }; class P9xPhysicalDrive : public IPhysicalDrive { - public: - P9xPhysicalDrive(); - virtual ~P9xPhysicalDrive(); - - //Path must look like this: "\\.\PhysicalDrive0" (of course, \ maps to \\, and \\ to \\\\) - BOOL Open( int iDrive ); - void Close(); - BOOL GetDriveGeometry( DISK_GEOMETRY* lpDG ); - BOOL GetDriveGeometryEx( DISK_GEOMETRY_EX* lpDG, DWORD dwSize ); - BOOL GetDriveLayout( LPBYTE lpbMemory, DWORD dwSize ); - BOOL GetDriveLayoutEx( LPBYTE lpbMemory, DWORD dwSize ); - BOOL ReadAbsolute( LPBYTE lpbMemory, DWORD dwSize, INT64 Sector ); - BOOL IsOpen(); - BOOL ReadPartitionInfoRecursive(DWORD dwSector,INT64 TotalOffset,int depth = 0); - - HANDLE m_hDevice; - BYTE m_bDriveNumber; - PList m_PartitionInfo; +public: + P9xPhysicalDrive(); + virtual ~P9xPhysicalDrive(); + + //Path must look like this: "\\.\PhysicalDrive0" (of course, \ maps to \\, and \\ to \\\\) + BOOL Open( int iDrive ); + void Close(); + BOOL GetDriveGeometry( DISK_GEOMETRY* lpDG ); + BOOL GetDriveGeometryEx( DISK_GEOMETRY_EX* lpDG, DWORD dwSize ); + BOOL GetDriveLayout( LPBYTE lpbMemory, DWORD dwSize ); + BOOL GetDriveLayoutEx( LPBYTE lpbMemory, DWORD dwSize ); + BOOL ReadAbsolute( LPBYTE lpbMemory, DWORD dwSize, INT64 Sector ); + BOOL IsOpen(); + BOOL ReadPartitionInfoRecursive(DWORD dwSector,INT64 TotalOffset,int depth = 0); + + HANDLE m_hDevice; + BYTE m_bDriveNumber; + PList m_PartitionInfo; +private: + static struct RAWIO32 *RAWIO32; }; #endif // PDrive95_h diff --git a/Externals/heksedit/PDriveNT.cpp b/Externals/heksedit/PDriveNT.cpp index 48eeb8aca..ff5411d3f 100644 --- a/Externals/heksedit/PDriveNT.cpp +++ b/Externals/heksedit/PDriveNT.cpp @@ -1,7 +1,6 @@ #include "precomp.h" #include "physicaldrive.h" #include "PDriveNT.h" -#include BOOL PNtPhysicalDrive::GetDriveLayout( LPBYTE lpbMemory, DWORD dwSize ) { diff --git a/Externals/heksedit/PhysicalDrive.cpp b/Externals/heksedit/PhysicalDrive.cpp index 8b197abd8..8eb503b96 100644 --- a/Externals/heksedit/PhysicalDrive.cpp +++ b/Externals/heksedit/PhysicalDrive.cpp @@ -1,6 +1,5 @@ #include "precomp.h" #include "physicaldrive.h" -#include #include "pdrive95.h" #include "pdrivent.h" @@ -21,26 +20,26 @@ IPhysicalDrive *CreatePhysicalDriveInstance() return 0; } -PString PartitionInfo::GetNameAsString() +LPTSTR PartitionInfo::GetNameAsString(LPTSTR szFormat) { - CHAR szFormat[80]; - - if( m_bIsPartition ) - sprintf( szFormat, "Drive %d, Partition %d (%s)", (m_dwDrive+1), (m_dwPartition+1), (LPCSTR) GetSizeAsString() ); + if (m_bIsPartition) + _stprintf(szFormat, _T("Drive %d, Partition %d (%s)"), m_dwDrive + 1, m_dwPartition + 1, GetSizeAsString()); else - sprintf( szFormat, "Drive %d (%s)", (m_dwDrive+1), (LPCSTR) GetSizeAsString() ); - return PString(szFormat); + _stprintf(szFormat, _T("Drive %d (%s)"), m_dwDrive + 1, GetSizeAsString()); + return szFormat; } -PString PartitionInfo::GetSizeAsString() +LPTSTR PartitionInfo::GetSizeAsString(LPTSTR szFormat) { double SizeInMB = (double) m_PartitionLength; SizeInMB /= (1000*1000); double SizeInGB = SizeInMB; SizeInGB /= (1000); - if( SizeInGB > 1.0 ) - return PString( 0, "%.2f GB", SizeInGB ); - return PString( 0, "%.2f MB", SizeInMB ); + if( SizeInGB >= 1.0 ) + _stprintf(szFormat, _T("%.2f GB"), SizeInGB); + else + _stprintf(szFormat, _T("%.2f MB"), SizeInMB); + return szFormat; } void IPhysicalDrive::GetPartitionInfo(PList* lpList) diff --git a/Externals/heksedit/PhysicalDrive.h b/Externals/heksedit/PhysicalDrive.h index 0672597e1..72b683896 100644 --- a/Externals/heksedit/PhysicalDrive.h +++ b/Externals/heksedit/PhysicalDrive.h @@ -15,8 +15,8 @@ public: INT64 m_StartingSector; INT64 m_PartitionLength; - PString GetNameAsString(); - PString GetSizeAsString(); + LPTSTR GetNameAsString(LPTSTR = PString<80>()); + LPTSTR GetSizeAsString(LPTSTR = PString<80>()); }; diff --git a/Externals/heksedit/PreLink.bat b/Externals/heksedit/PreLink.bat new file mode 100644 index 000000000..5e1d2a57e --- /dev/null +++ b/Externals/heksedit/PreLink.bat @@ -0,0 +1,12 @@ +cd +echo %0 +echo $(IntDir) = %1 +echo $(TargetPath) = %2 +cd Languages +cscript CreateMasterPotFile.vbs +cscript UpdatePoFilesFromPotFile.vbs +cd .. +rc /fo%1\lang.res /i.. Languages\heksedit.rc +mkdir %2\..\heksedit.lng +link /DLL /NOENTRY /MACHINE:IX86 /OUT:%2\..\heksedit.lng\heksedit.lng %1\lang.res +copy Languages\*.po %2\..\heksedit.lng diff --git a/Externals/heksedit/ShortcutsDlg.cpp b/Externals/heksedit/ShortcutsDlg.cpp index 4bbb06261..2acc54b74 100644 --- a/Externals/heksedit/ShortcutsDlg.cpp +++ b/Externals/heksedit/ShortcutsDlg.cpp @@ -1,5 +1,4 @@ #include "precomp.h" -#include #include "shtools.h" #include "resource.h" #include "hexwnd.h" diff --git a/Externals/heksedit/Simparr.cpp b/Externals/heksedit/Simparr.cpp index 3635f1201..3d5a9f016 100644 --- a/Externals/heksedit/Simparr.cpp +++ b/Externals/heksedit/Simparr.cpp @@ -5,7 +5,7 @@ #include "simparr.h" //------------------------------------------------------------------- -int SimpleString::AppendString( char* ps ) +int SimpleString::AppendString( const char* ps ) { if( m_nUpperBound == -1 ) return SetToString( ps ); @@ -17,28 +17,28 @@ int SimpleString::AppendString( char* ps ) } //------------------------------------------------------------------- -int SimpleString::SetToString( char* ps ) +int SimpleString::SetToString( const char* ps ) { Clear(); return AppendString( ps ); } //------------------------------------------------------------------- -char* SimpleString::operator=( char* ps ) +SimpleString& SimpleString::operator=( const char* ps ) { SetToString( ps ); - return ps; + return *this; } //------------------------------------------------------------------- -SimpleString& SimpleString::operator=( SimpleString str ) +SimpleString& SimpleString::operator=( const SimpleString &str ) { SetToString( &str[0] ); return *this; } //------------------------------------------------------------------- -char* SimpleString::operator+=( char* ps ) +SimpleString& SimpleString::operator+=( const char* ps ) { if( m_nUpperBound == -1 ) SetToString( ps ); @@ -46,7 +46,7 @@ char* SimpleString::operator+=( char* ps ) { InsertAtGrow( m_nUpperBound, ps, 0, strlen( ps ) ); } - return ps; + return *this; } //------------------------------------------------------------------- @@ -67,7 +67,7 @@ SimpleString::SimpleString() } //------------------------------------------------------------------- -SimpleString::SimpleString( char* ps ) +SimpleString::SimpleString( const char* ps ) { // Create a SimpleString from a normal char array-string. m_nGrowBy = 64; @@ -83,7 +83,7 @@ void SimpleString::Clear() } //------------------------------------------------------------------- -SimpleString SimpleString::operator+( SimpleString& str1 ) +SimpleString SimpleString::operator+( const SimpleString& str1 ) { SimpleString t1; t1.SetToString( m_pT ); @@ -98,7 +98,7 @@ int SimpleString::IsEmpty() } //------------------------------------------------------------------- -SimpleString operator+( SimpleString ps1, char* ps2 ) +SimpleString operator+( const SimpleString &ps1, const char* ps2 ) { SimpleString s1; s1 += ps1; @@ -107,7 +107,7 @@ SimpleString operator+( SimpleString ps1, char* ps2 ) } //------------------------------------------------------------------- -SimpleString operator+( char* ps1, SimpleString ps2 ) +SimpleString operator+( const char* ps1, const SimpleString &ps2 ) { SimpleString s1; s1 += ps1; diff --git a/Externals/heksedit/Simparr.h b/Externals/heksedit/Simparr.h index 6816b6725..a11e44c17 100644 --- a/Externals/heksedit/Simparr.h +++ b/Externals/heksedit/Simparr.h @@ -20,16 +20,20 @@ public: { return m_pT; } + operator const T*() const + { + return m_pT; + } int InsertAt(int nIndex, T argT, int nCount = 1); - void InsertAtRef(int nIndex, T& argT, int nCount = 1); + void InsertAtRef(int nIndex, const T& argT, int nCount = 1); int InsertAtGrow(int nIndex, T argT, int nCount = 1); - void InsertAtGrowRef(int nIndex, T& argT, int nCount = 1); - int InsertAtGrow (int nIndex, T* pT, int nSrcIndex, int nCount); + void InsertAtGrowRef(int nIndex, const T& argT, int nCount = 1); + int InsertAtGrow (int nIndex, const T* pT, int nSrcIndex, int nCount); int RemoveAt(int nIndex, int nCount = 1); void SetAtGrow(int nIndex, T argT); - int SetAtGrowRef(int nIndex, T& argT); + int SetAtGrowRef(int nIndex, const T& argT); void SetAt(int nIndex, T argT); - void SetAtRef(int nIndex, T& argT); + void SetAtRef(int nIndex, const T& argT); T GetAt(int nIndex); T& GetRefAt(int nIndex); int GetSize(); @@ -41,11 +45,11 @@ public: T& operator[](int nIndex) {return m_pT[nIndex];} SimpleArray& operator=(SimpleArray& spa); void ClearAll(); - int blContainsRef(T& argT); + int blContainsRef(const T& argT); int blContains(T argT); int nContainsAt(T argT); int blIsEmpty(); - void AppendRef(T& argT); + void AppendRef(const T& argT); void Append(T argT); void Exchange(int nIndex1, int nIndex2); int blCompare(SimpleArray& spa); @@ -55,8 +59,8 @@ public: void SetUpperBound(int upbnd); int AppendArray( T* pSrc, int srclen ); int ExpandToSize(); - int CopyFrom( int index, T* pSrc, int srclen ); - int Replace( int ToReplaceIndex, int ToReplaceLength, T* pReplaceWith, int ReplaceWithLength ); + int CopyFrom( int index, const T* pSrc, int srclen ); + int Replace( int ToReplaceIndex, int ToReplaceLength, const T* pReplaceWith, int ReplaceWithLength ); protected: int AddSpace (int nExtend); @@ -143,7 +147,7 @@ template inline int SimpleArray::InsertAtGrow(int nIndex, T argT, in } //------------------------------------------------------------------- -template inline int SimpleArray::InsertAtGrow (int nIndex, T* pT, int nSrcIndex, int nCount) +template inline int SimpleArray::InsertAtGrow (int nIndex, const T* pT, int nSrcIndex, int nCount) { if(nIndex<0 || nCount<1) return FALSE; @@ -176,7 +180,7 @@ template inline int SimpleArray::InsertAtGrow (int nIndex, T* pT, in } //------------------------------------------------------------------- -template inline void SimpleArray::InsertAtGrowRef(int nIndex, T& argT, int nCount) +template inline void SimpleArray::InsertAtGrowRef(int nIndex, const T& argT, int nCount) { if(nIndex<0 || nCount<1) return; int i; @@ -236,7 +240,7 @@ template inline int SimpleArray::InsertAt( int nIndex, T argT, int n } //------------------------------------------------------------------- -template inline void SimpleArray::InsertAtRef(int nIndex, T& argT, int nCount) +template inline void SimpleArray::InsertAtRef(int nIndex, const T& argT, int nCount) { if(nIndex < 0 || nIndex > m_nUpperBound) return; @@ -290,7 +294,7 @@ template inline void SimpleArray::SetAtGrow(int nIndex, T argT) } //------------------------------------------------------------------- -template inline int SimpleArray::SetAtGrowRef(int nIndex, T& argT) +template inline int SimpleArray::SetAtGrowRef(int nIndex, const T& argT) { if(nIndex < 0) return FALSE; @@ -319,7 +323,7 @@ template inline void SimpleArray::SetAt(int nIndex, T argT) } //------------------------------------------------------------------- -template inline void SimpleArray::SetAtRef(int nIndex, T& argT) +template inline void SimpleArray::SetAtRef(int nIndex, const T& argT) { if(nIndex >= 0 && nIndex < m_nSize) { @@ -436,7 +440,7 @@ template inline void SimpleArray::ClearAll() } //------------------------------------------------------------------- -template inline int SimpleArray::blContainsRef(T& argT) +template inline int SimpleArray::blContainsRef(const T& argT) { int i; for(i = 0; i <= m_nUpperBound; i++) @@ -475,13 +479,14 @@ template inline SimpleArray& SimpleArray::operator=( SimpleArray< // If this array is not empty then delete it. ClearAll(); // Allocate memory. - m_pT = new T[ m_nSize ]; + int nSize = spa.m_nUpperBound + 1; + m_pT = new T[ nSize ]; // Copy the valid elements. if( m_pT != NULL ) { // This array now is just large enough to contain the valid elements of spa. m_nUpperBound = spa.m_nUpperBound; - m_nSize = m_nUpperBound + 1; + m_nSize = nSize; // GrowBy rate is also copied. m_nGrowBy = spa.m_nGrowBy; int k; @@ -494,7 +499,7 @@ template inline SimpleArray& SimpleArray::operator=( SimpleArray< } //------------------------------------------------------------------- -template inline void SimpleArray::AppendRef(T& argT) +template inline void SimpleArray::AppendRef(const T& argT) { SetAt(m_nUpperBound+1, argT); } @@ -601,7 +606,7 @@ template inline int SimpleArray::ExpandToSize() } //------------------------------------------------------------------- -template inline int SimpleArray::CopyFrom( int index, T* pSrc, int srclen ) +template inline int SimpleArray::CopyFrom( int index, const T* pSrc, int srclen ) { if( m_nSize - index >= srclen ) { @@ -618,7 +623,7 @@ template inline int SimpleArray::CopyFrom( int index, T* pSrc, int s } //------------------------------------------------------------------- -template inline int SimpleArray::Replace( int ToReplaceIndex, int ToReplaceLength, T* pReplaceWith, int ReplaceWithLength ) +template inline int SimpleArray::Replace( int ToReplaceIndex, int ToReplaceLength, const T* pReplaceWith, int ReplaceWithLength ) { if( m_pT != NULL && ToReplaceLength > 0 ) { @@ -679,19 +684,19 @@ class SimpleString : public SimpleArray { public: int IsEmpty(); - SimpleString operator+( SimpleString& str1 ); + SimpleString operator+( const SimpleString& str1 ); SimpleString(); - SimpleString( char* ps ); - int AppendString( char* ps ); - int SetToString( char* ps ); - char* operator=( char* ps ); - SimpleString& operator=( SimpleString str ); - char* operator+=( char* ps ); + SimpleString( const char* ps ); + int AppendString( const char* ps ); + int SetToString( const char* ps ); + SimpleString& operator=( const char* ps ); + SimpleString& operator=( const SimpleString &str ); + SimpleString& operator+=( const char* ps ); int StrLen(); void Clear(); }; -SimpleString operator+( SimpleString ps1, char* ps2 ); -SimpleString operator+( char* ps1, SimpleString ps2 ); +SimpleString operator+( const SimpleString &ps1, const char* ps2 ); +SimpleString operator+( const char* ps1, const SimpleString &ps2 ); #endif // simplearr_h diff --git a/Externals/heksedit/UpgradeDlg.cpp b/Externals/heksedit/UpgradeDlg.cpp index a423ef1f1..6d1ec3d43 100644 --- a/Externals/heksedit/UpgradeDlg.cpp +++ b/Externals/heksedit/UpgradeDlg.cpp @@ -1,6 +1,5 @@ #include "precomp.h" #include "resource.h" -#include #include "regtools.h" #include "hexwnd.h" #include "hexwdlg.h" @@ -20,7 +19,6 @@ BOOL UpgradeDlg::OnInitDialog(HWND hw) { int i; HKEY hk; - //LONG res; char subkeynam[_MAX_PATH+1]; LVITEM item; ZeroMemory(&item,sizeof(LVITEM)); diff --git a/Externals/heksedit/VersionData.h b/Externals/heksedit/VersionData.h new file mode 100644 index 000000000..db40cfbb3 --- /dev/null +++ b/Externals/heksedit/VersionData.h @@ -0,0 +1,57 @@ +/*/VersionData.h +This code has been released into the public domain and may be used +for any purposes whatsoever without acknowledgment. +*/ + +class CVersionData +{ +private: + // Disallow construction + CVersionData(); +public: + WORD wLength; + WORD wValueLength; + WORD wType; + WCHAR szKey[1]; + const WCHAR *Data() const + { + if (this) + { + const WCHAR *p = szKey + lstrlenW(szKey) + 1; + return (const WCHAR *)((UINT_PTR) p + 3U & ~3U); + } + return 0; + } + const CVersionData *First() const + { + if (this) + { + return (const CVersionData *)((UINT_PTR)Data() + wValueLength + 3U & ~3U); + } + return 0; + } + const CVersionData *Next() const + { + if (this) + { + return (const CVersionData *)((UINT_PTR)this + wLength + 3U & ~3U); + } + return 0; + } + const CVersionData *Find(LPCWSTR szKey) const + { + const CVersionData *p = First(); + while (p < Next()) + { + if (szKey == 0 || StrCmpW(szKey, p->szKey) == 0) + return p; + p = p->Next(); + } + return 0; + } + static const CVersionData *Load(HMODULE hModule = 0, LPCTSTR lpszRes = MAKEINTRESOURCE(VS_VERSION_INFO)) + { + HRSRC hRes = FindResource(hModule, lpszRes, RT_VERSION); + return (const CVersionData *)LoadResource(hModule, hRes); + } +}; diff --git a/Externals/heksedit/dllmain.cpp b/Externals/heksedit/dllmain.cpp index 125e2cdd2..efec120ef 100644 --- a/Externals/heksedit/dllmain.cpp +++ b/Externals/heksedit/dllmain.cpp @@ -6,9 +6,18 @@ #include "hexwnd.h" HINSTANCE hMainInstance; -LRESULT CALLBACK HexWndProc (HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK HexWndProc(HWND, UINT, WPARAM, LPARAM); + +static const char szHexClassA[] = "hekseditA_" + SHARPEN(A,FRHED_MAJOR_VERSION) "." + SHARPEN(A,FRHED_MINOR_VERSION) "." + SHARPEN(A,FRHED_SUB_RELEASE_NO); + +static const WCHAR szHexClassW[] = L"hekseditW_" + SHARPEN(W,FRHED_MAJOR_VERSION) L"." + SHARPEN(W,FRHED_MINOR_VERSION) L"." + SHARPEN(W,FRHED_SUB_RELEASE_NO); -static const char szHexClass[] = "frhed hexclass"; //-------------------------------------------------------------------------------------------- // WinMain: the starting point. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) @@ -16,15 +25,21 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) if (dwReason == DLL_PROCESS_ATTACH) { hMainInstance = hInstance; - WNDCLASSEX wndclass; - Zero(wndclass); - wndclass.cbSize = sizeof(wndclass); - wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; - wndclass.lpfnWndProc = HexWndProc; - wndclass.hInstance = hInstance; - wndclass.hCursor = 0; - wndclass.lpszClassName = szHexClass; - RegisterClassEx(&wndclass); + union + { + WNDCLASSEXA a; + WNDCLASSEXW w; + } wndclass; + ZeroMemory(&wndclass, sizeof wndclass); + wndclass.a.cbSize = sizeof wndclass; + wndclass.a.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; + wndclass.a.lpfnWndProc = HexWndProc; + wndclass.a.hInstance = hInstance; + wndclass.a.hCursor = 0; + wndclass.a.lpszClassName = szHexClassA; + RegisterClassExA(&wndclass.a); + wndclass.w.lpszClassName = szHexClassW; + RegisterClassExW(&wndclass.w); return TRUE; } return FALSE; @@ -36,7 +51,7 @@ LRESULT CALLBACK HexWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) if (iMsg == WM_NCCREATE) SetWindowLong(hwnd, GWL_USERDATA, (LONG)new HexEditorWindow); HexEditorWindow *pHexWnd = (HexEditorWindow *)GetWindowLong(hwnd, GWL_USERDATA); - LRESULT lResult = pHexWnd->OnWndMsg( hwnd, iMsg, wParam, lParam ); + LRESULT lResult = pHexWnd->OnWndMsg(hwnd, iMsg, wParam, lParam); if (iMsg == WM_NCDESTROY) delete pHexWnd; return lResult; diff --git a/Externals/heksedit/frhed.dsp b/Externals/heksedit/frhed.dsp index 85934d58a..3e1ef7a08 100644 --- a/Externals/heksedit/frhed.dsp +++ b/Externals/heksedit/frhed.dsp @@ -111,15 +111,7 @@ SOURCE=.\toolbar.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\BinTrans.h -# End Source File -# Begin Source File - -SOURCE=.\gktools.h -# End Source File -# Begin Source File - -SOURCE=.\gtools.h +SOURCE=.\heksedit.h # End Source File # Begin Source File @@ -127,50 +119,10 @@ SOURCE=.\hexwnd.h # End Source File # Begin Source File -SOURCE=.\ido.h -# End Source File -# Begin Source File - -SOURCE=.\ids.h -# End Source File -# Begin Source File - -SOURCE=.\idt.h -# End Source File -# Begin Source File - -SOURCE=.\ntdiskspec.h -# End Source File -# Begin Source File - -SOURCE=.\PDrive95.h -# End Source File -# Begin Source File - -SOURCE=.\PDriveNT.h -# End Source File -# Begin Source File - -SOURCE=.\PhysicalDrive.h -# End Source File -# Begin Source File - -SOURCE=.\PMemoryBlock.h -# End Source File -# Begin Source File - SOURCE=.\precomp.h # End Source File # Begin Source File -SOURCE=..\RAWIO32\RAWIO32.h -# End Source File -# Begin Source File - -SOURCE=.\Simparr.h -# End Source File -# Begin Source File - SOURCE=.\toolbar.h # End Source File # Begin Source File @@ -187,32 +139,12 @@ SOURCE=.\frhed.rc # End Source File # Begin Source File -SOURCE=.\icon1.ico +SOURCE=.\res\icon1.ico # End Source File # Begin Source File SOURCE=.\resource.h # End Source File # End Group -# Begin Group "Text Files" - -# PROP Default_Filter "txt" -# Begin Source File - -SOURCE=.\Bugs.txt -# End Source File -# Begin Source File - -SOURCE=.\History.txt -# End Source File -# Begin Source File - -SOURCE=.\Readme.txt -# End Source File -# Begin Source File - -SOURCE=.\Todo.txt -# End Source File -# End Group # End Target # End Project diff --git a/Externals/heksedit/frhed.rc b/Externals/heksedit/frhed.rc index cda6f20d7..8efdee4c9 100644 --- a/Externals/heksedit/frhed.rc +++ b/Externals/heksedit/frhed.rc @@ -13,19 +13,14 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources +// Englisch (USA) resources -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // @@ -45,57 +40,12 @@ END 3 TEXTINCLUDE DISCARDABLE BEGIN - "\r\n" + "#include ""version.rc""\r\n" "\0" END #endif // APSTUDIO_INVOKED -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x21L -#else - FILEFLAGS 0x20L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040704b0" - BEGIN - VALUE "Comments", "Homepage: http://www.kibria.de, http://zip.to/pabs3\0" - VALUE "CompanyName", "(c) Raihan Kibria 2000\0" - VALUE "FileDescription", "frhed - free hex editor 1.1.0\0" - VALUE "FileVersion", "1, 1, 0\0" - VALUE "InternalName", "frhed\0" - VALUE "LegalCopyright", "GNU General Public License v2.0\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "frhed.exe\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "frhed\0" - VALUE "ProductVersion", "1, 1, 0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x407, 1200 - END -END - -#endif // !_MAC - ///////////////////////////////////////////////////////////////////////////// // @@ -104,9 +54,8 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON1 ICON DISCARDABLE "icon1.ico" - -#endif // Deutsch (Deutschland) resources +IDI_ICON1 ICON DISCARDABLE "res/icon1.ico" +#endif // Englisch (USA) resources ///////////////////////////////////////////////////////////////////////////// @@ -116,7 +65,7 @@ IDI_ICON1 ICON DISCARDABLE "icon1.ico" // // Generated from the TEXTINCLUDE 3 resource. // - +#include "version.rc" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/Externals/heksedit/frhed.vcproj b/Externals/heksedit/frhed.vcproj index e0ff5135b..b52051ba0 100644 --- a/Externals/heksedit/frhed.vcproj +++ b/Externals/heksedit/frhed.vcproj @@ -13,8 +13,8 @@ @@ -22,13 +22,15 @@ Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS" + StringPooling="TRUE" + ExceptionHandling="FALSE" RuntimeLibrary="2" UsePrecompiledHeader="3" PrecompiledHeaderThrough="precomp.h" - PrecompiledHeaderFile=".\../../BuildTmp/frhed/Release/frhed.pch" - AssemblerListingLocation=".\../../BuildTmp/frhed/Release/" - ObjectFile=".\../../BuildTmp/frhed/Release/" - ProgramDataBaseFileName=".\../../BuildTmp/frhed/Release/" + PrecompiledHeaderFile=".\..\..\BuildTmp\frhed\$(ConfigurationName)\frhed.pch" + AssemblerListingLocation=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" + ObjectFile=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" + ProgramDataBaseFileName=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE"/> @@ -37,10 +39,10 @@ @@ -74,8 +76,8 @@ @@ -83,13 +85,15 @@ Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS" + StringPooling="TRUE" + ExceptionHandling="FALSE" RuntimeLibrary="3" UsePrecompiledHeader="3" PrecompiledHeaderThrough="precomp.h" - PrecompiledHeaderFile=".\../../BuildTmp/frhed/Debug/frhed.pch" - AssemblerListingLocation=".\../../BuildTmp/frhed/Debug/" - ObjectFile=".\../../BuildTmp/frhed/Debug/" - ProgramDataBaseFileName=".\../../BuildTmp/frhed/Debug/" + PrecompiledHeaderFile=".\..\..\BuildTmp\frhed\$(ConfigurationName)\frhed.pch" + AssemblerListingLocation=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" + ObjectFile=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" + ProgramDataBaseFileName=".\..\..\BuildTmp\frhed\$(ConfigurationName)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" @@ -99,11 +103,11 @@ @@ -206,51 +210,12 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Externals/heksedit/gktools.cpp b/Externals/heksedit/gktools.cpp index 4ef1a2c7a..eb1c85135 100644 --- a/Externals/heksedit/gktools.cpp +++ b/Externals/heksedit/gktools.cpp @@ -1,4 +1,5 @@ #include "precomp.h" +#include "DllProxies.h" #include #include #include "resource.h" @@ -8,111 +9,96 @@ static PList PartitionInfoList; -typedef BOOL (__stdcall* LPFNUnMapAndLoad)( PLOADED_IMAGE LoadedImage ); -typedef PVOID (__stdcall* LPFNImageRvaToVa)( - IN PIMAGE_NT_HEADERS NtHeaders, - IN PVOID Base, - IN ULONG Rva, - IN OUT PIMAGE_SECTION_HEADER *LastRvaSection -); - -typedef BOOL (__stdcall* LPFNMapAndLoad)( - PSTR ImageName, - PSTR DllPath, - PLOADED_IMAGE LoadedImage, - BOOL DotDll, - BOOL ReadOnly -); - -LPFNMapAndLoad fMapAndLoad = 0; -LPFNImageRvaToVa fImageRvaToVa = 0; -LPFNUnMapAndLoad fUnMapAndLoad = 0; - -BOOL CanUseImagehelpDll() -{ - if( fUnMapAndLoad && fMapAndLoad && fImageRvaToVa ) - return TRUE; - - HMODULE hModule = LoadLibrary( "IMAGEHLP.DLL" ); - if( hModule ) - { - fMapAndLoad = (LPFNMapAndLoad) GetProcAddress( hModule, "MapAndLoad" ); - fImageRvaToVa = (LPFNImageRvaToVa) GetProcAddress( hModule, "ImageRvaToVa" ); - fUnMapAndLoad = (LPFNUnMapAndLoad) GetProcAddress( hModule, "UnMapAndLoad" ); - - return fUnMapAndLoad && fMapAndLoad && fImageRvaToVa; - } - return FALSE; -} - -#define IRTV(x) fImageRvaToVa( li.FileHeader, li.MappedAddress, (DWORD)x, 0 ) - BOOL WINAPI GetDllExportNames( LPCSTR pszFilename, ULONG* lpulOffset, ULONG* lpulSize ) { - if( !CanUseImagehelpDll() ) + struct IMAGEHLP *IMAGEHLP = ::IMAGEHLP; + if (IMAGEHLP == 0) return FALSE; LOADED_IMAGE li; - if( !fMapAndLoad( (LPSTR) pszFilename, NULL, &li, TRUE, TRUE ) ) - return FALSE; - - PIMAGE_EXPORT_DIRECTORY pExpDir = (PIMAGE_EXPORT_DIRECTORY)(li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); - if( !pExpDir ) + if (!IMAGEHLP->MapAndLoad((LPSTR)pszFilename, NULL, &li, TRUE, TRUE)) return FALSE; - pExpDir = (PIMAGE_EXPORT_DIRECTORY)IRTV(pExpDir); - if( !pExpDir->NumberOfNames ) - return FALSE; - - PDWORD* pExpNames = (LPDWORD*) pExpDir->AddressOfNames; - pExpNames = (LPDWORD*)IRTV(pExpNames); - ULONG ulStart = (ULONG) IRTV(*pExpNames); - *lpulOffset = ulStart - (ULONG) li.MappedAddress; - pExpNames += pExpDir->NumberOfNames-1; - ULONG ulStop = (ULONG) IRTV(*pExpNames); - *lpulSize = ulStop - ulStart + strlen((LPCSTR)ulStop); // hihi - - fUnMapAndLoad( &li ); - return TRUE; + BOOL bDone = FALSE; + if (DWORD dw = li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress) + { + PIMAGE_EXPORT_DIRECTORY pExpDir = (PIMAGE_EXPORT_DIRECTORY) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, dw, 0); + DWORD firstName = pExpDir->Name; + DWORD lastName = pExpDir->Name; + if (pExpDir->NumberOfNames) + { + DWORD *pExpNames = (DWORD *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, pExpDir->AddressOfNames, 0); + pExpNames += pExpDir->NumberOfNames - 1; + lastName = *pExpNames; + } + *lpulOffset = firstName; + char *name = (char *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, lastName, 0); + *lpulSize = lastName + strlen(name) + 1 - firstName; + bDone = TRUE; + } + IMAGEHLP->UnMapAndLoad(&li); + return bDone; } -// structures are undocumented -typedef struct -{ - // Addr +0 = start of import declaration - // Addr +1,+2 are -1 always - // Addr +3 = virtual name-of-dll - // Addr +4 = ??? - ULONG Addr[5]; -} IMPS0; - BOOL WINAPI GetDllImportNames( LPCSTR pszFilename, ULONG* lpulOffset, ULONG* lpulSize ) { - if( !CanUseImagehelpDll() ) + struct IMAGEHLP *IMAGEHLP = ::IMAGEHLP; + if (IMAGEHLP == 0) return FALSE; LOADED_IMAGE li; - if( !fMapAndLoad( (LPSTR) pszFilename, NULL, &li, TRUE, TRUE ) ) + if (!IMAGEHLP->MapAndLoad((LPSTR)pszFilename, NULL, &li, TRUE, TRUE)) return FALSE; - PVOID pExpDir = (LPVOID)(li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); - if( !pExpDir ) - return FALSE; - - IMPS0* p = (IMPS0*)IRTV(pExpDir); - pExpDir = (PVOID)IRTV(p->Addr[0]); - pExpDir = (PVOID)IRTV(*(ULONG*)pExpDir); - *lpulOffset = (ULONG)pExpDir - (ULONG) li.MappedAddress; - - LPBYTE lpbEnd = (LPBYTE) pExpDir; - while(!( !lpbEnd[0] && !lpbEnd[1] && !lpbEnd[2] && !lpbEnd[3] )) + BOOL bDone = FALSE; + if (DWORD dw = li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress) { - lpbEnd++; + IMAGE_IMPORT_DESCRIPTOR *pDescriptor = (IMAGE_IMPORT_DESCRIPTOR *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, dw, 0); + DWORD lower = ULONG_MAX; + DWORD upper = 0; + while (pDescriptor->FirstThunk) + { + if (lower > pDescriptor->Name) //OriginalFirstThunk) + lower = pDescriptor->Name; //OriginalFirstThunk; + char *name = (char *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, pDescriptor->Name, 0); + DWORD end = pDescriptor->Name + strlen(name) + 1; + if (upper < end) + upper = end; + DWORD *pEntry = (DWORD *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, pDescriptor->FirstThunk, 0); + IMAGE_THUNK_DATA *pThunk = (IMAGE_THUNK_DATA *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, pDescriptor->OriginalFirstThunk, 0); + while (pThunk->u1.Function) + { + if ((*pEntry & 0x80000000) == 0) + { + IMAGE_IMPORT_BY_NAME *pImport = (IMAGE_IMPORT_BY_NAME *) + IMAGEHLP->ImageRvaToVa(li.FileHeader, li.MappedAddress, *pEntry, 0); + DWORD end = *pEntry + sizeof(IMAGE_IMPORT_BY_NAME) + strlen((char *)pImport->Name); + if (lower > *pEntry) + lower = *pEntry; + if (upper < end) + upper = end; + } + ++pThunk; + ++pEntry; + } + ++pDescriptor; + } + if (lower < upper) + { + *lpulOffset = lower; + *lpulSize = upper - lower; + bDone = TRUE; + } } - *lpulSize = (ULONG)lpbEnd - (ULONG) pExpDir; - - fUnMapAndLoad( &li ); - return TRUE; + IMAGEHLP->UnMapAndLoad(&li); + return bDone; } void WINAPI XorEncoder( MEMORY_CODING* p ) @@ -223,7 +209,7 @@ INT_PTR OpenDriveDialog::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) { case WM_INITDIALOG: { - HWND hListbox = GetDlgItem(hDlg, IDC_LIST1); + ShowWindow(hDlg, SW_SHOW); if (PartitionInfoList.IsEmpty()) { if (IPhysicalDrive *Drive = CreatePhysicalDriveInstance()) @@ -232,8 +218,11 @@ INT_PTR OpenDriveDialog::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) delete Drive; } } - ENUMERATE(&PartitionInfoList, PartitionInfo, pi) + HWND hListbox = GetDlgItem(hDlg, IDC_LIST1); + LIST_ENTRY *Flink = &PartitionInfoList; + while ((Flink = Flink->Flink) != &PartitionInfoList) { + PartitionInfo *pi = static_cast(Flink); int i = SendMessage(hListbox, LB_ADDSTRING, 0, (LPARAM)(LPCSTR)pi->GetNameAsString()); SendMessage(hListbox, LB_SETITEMDATA, i, (LPARAM)pi); } diff --git a/Externals/heksedit/gtools.cpp b/Externals/heksedit/gtools.cpp index 9a9f901a3..e95ea0fa0 100644 --- a/Externals/heksedit/gtools.cpp +++ b/Externals/heksedit/gtools.cpp @@ -1,11 +1,8 @@ #include "precomp.h" -#include -#include PList::PList() +: Count(0) { - m_pHead = m_pTail = 0; - m_lCount = 0; } PList::~PList() @@ -13,328 +10,20 @@ PList::~PList() DeleteContents(); } -bool PList::DeleteContents() +void PList::DeleteContents() { - while( m_pHead ) - { - PNode* pNext = m_pHead->m_pNext; - m_pHead->m_pNext = 0; - delete m_pHead; - m_pHead = pNext; - } - m_pHead = m_pTail = 0; - m_lCount = 0; - return true; -} - -bool PList::RemoveContents() -{ - while( m_pHead ) - { - PNode* pNext = m_pHead->m_pNext; - m_pHead->m_pNext = m_pHead->m_pPrevious = 0; - m_pHead = pNext; - } - m_pHead = m_pTail = 0; - m_lCount = 0; - return true; -} - -bool PList::Contains( PNode* p ) -{ - bool bSuccess = false; - if( p != 0 ) - { - for( PNode* q = m_pHead; q; q = q->m_pNext ) - { - if( q == p ) - { - bSuccess = true; - break; - } - } - } - return bSuccess; -} - -bool PList::AddHead( PNode* p ) -{ - p->m_pPrevious = 0; - m_lCount++; - - if( !m_pHead ) - { - m_pHead = m_pTail = p; - p->m_pNext = 0; - } - else - { - p->m_pNext = m_pHead; - m_pHead->m_pPrevious = p; - m_pHead = p; - } - return true; -} - -bool PList::AddTail( PNode* p ) -{ - if( !m_pTail ) - { - m_pHead = m_pTail = p; - p->m_pNext = 0; - m_lCount = 1; - } - else - { - m_lCount++; - p->m_pNext = 0; - p->m_pPrevious = m_pTail; - m_pTail->m_pNext = p; - m_pTail = p; - } - return true; -} - -bool PList::InsertBefore( PNode* p, PNode* q ) -{ - if( !q ) - return AddTail( p ); - - if( !q->m_pPrevious ) - return AddHead( p ); - - ++m_lCount; - p->m_pPrevious = q->m_pPrevious; - p->m_pPrevious->m_pNext = p; - q->m_pPrevious = p; - p->m_pNext = q; - return true; -} - -bool PList::InsertAfter( PNode* p, PNode* q ) -{ - if( !q ) - return AddHead( p ); - - if( !q->m_pNext ) - return AddTail( p ); - - return InsertBefore( p, q->m_pNext ); -} - -void PList::Delete( PNode* p ) -{ - Remove( p ); - delete p; -} - -void PList::Remove( PNode* p ) -{ - m_lCount--; - - if( m_pHead == p ) - m_pHead = p->m_pNext; - - if( m_pTail == p ) - m_pTail = p->m_pPrevious; - - if( p->m_pNext ) - p->m_pNext->m_pPrevious = p->m_pPrevious; - - if( p->m_pPrevious ) - p->m_pPrevious->m_pNext = p->m_pNext; - - p->m_pNext = p->m_pPrevious = 0; -} - -bool PList::IsEmpty() -{ - return m_pHead ? false : true; -} - -PNode* PList::Find( long lZeroBasedIndex ) -{ - long lIndex = 0; - for( PNode* p = m_pHead; p; p = p->m_pNext ) - if( lIndex++ == lZeroBasedIndex ) - return p; - - return 0; -} - -bool PList::Merge( PList& s ) -{ - while( s.m_pHead ) - { - PNode* pNode = s.m_pHead; - s.Remove( s.m_pHead ); - AddTail( pNode ); - } - return true; -} - -//Reduce if your crap OS cannot handle tit - it ;( -#define BUFFERSIZE_FOR_SPRINTF 10480 - -PString::PString() -{ - m_iStringLength = 0; - m_lpszData = 0; -} - -inline void PString::CopyStringData(const char* lpszFrom) -{ - if( lpszFrom ) - { - m_iStringLength = strlen( lpszFrom )+1; - if( m_iStringLength < sizeof(m_szFixedBuffer) ) - { - m_lpszData = m_szFixedBuffer; - strcpy( m_lpszData, lpszFrom ); - } - else if( m_iStringLength > 0 ) - { - m_lpszData = new char[ m_iStringLength ]; - if( m_lpszData != 0 ) - strcpy( m_lpszData, lpszFrom ); - else m_iStringLength = 0; - } - else m_lpszData = 0; - } - else - { - m_lpszData = 0; - m_iStringLength = 0; - } -} - -inline void PString::DeleteStringData() -{ - if( (m_lpszData != m_szFixedBuffer) && m_lpszData ) - delete m_lpszData; - m_lpszData = 0; - m_iStringLength = 0; + while (Flink != this) + delete static_cast(Flink); + Count = 0; } - -void PString::Append( LPCSTR pString, DWORD dwSize ) +void PList::AddTail(PNode *p) { - // *NOT* optimized - - DWORD dwCombinedLength = m_iStringLength + dwSize; - if( dwCombinedLength && dwSize ) - { - char* lpszData = new char[ dwCombinedLength + 2 ]; - if( m_lpszData && m_iStringLength ) - strcpy( lpszData, m_lpszData ); - strncpy( lpszData+m_iStringLength, pString, dwSize ); - lpszData[dwCombinedLength] = 0; - DeleteStringData(); - CopyStringData(lpszData); - delete lpszData; - - } -} - - -PString::PString( const char* lpszArgument ) -{ - CopyStringData( lpszArgument ); -} - -PString::PString( const PString& objectSrc ) -{ - CopyStringData( objectSrc.m_lpszData ); -} - -PString::PString( int, const char* szFormat, ... ) -{ - if( szFormat ) - { - char buffer[BUFFERSIZE_FOR_SPRINTF]; - va_list argptr; - va_start( argptr, szFormat ); - ::vsprintf(buffer,szFormat,argptr); - buffer[BUFFERSIZE_FOR_SPRINTF-1]=0; - CopyStringData( buffer ); - } - else - { - m_iStringLength = 0; - m_lpszData = 0; - } -} - -PString::~PString() -{ - DeleteStringData(); -} - -void PString::sprintf( const char* szFormat, ... ) -{ - DeleteStringData(); - m_lpszData = 0; - m_iStringLength = 0; - if( szFormat ) - { - char buffer[BUFFERSIZE_FOR_SPRINTF]; - va_list argptr; - va_start( argptr, szFormat ); - ::vsprintf(buffer,szFormat,argptr); - buffer[BUFFERSIZE_FOR_SPRINTF-1]=0; - CopyStringData( buffer ); - } -} - -void PString::vsprintf( const char* szFormat, va_list args ) -{ - DeleteStringData(); - m_lpszData = 0; - m_iStringLength = 0; - if( szFormat ) - { - char buffer[BUFFERSIZE_FOR_SPRINTF]; - ::vsprintf(buffer,szFormat,args); - buffer[BUFFERSIZE_FOR_SPRINTF-1]=0; - CopyStringData( buffer ); - } -} - -PString& PString::operator=( const char* objectSrc ) -{ - if( objectSrc != m_lpszData ) - { - DeleteStringData(); - CopyStringData( objectSrc ); - } - return *this; -} - -PString& PString::operator=( PString& objectSrc ) -{ - if( this != &objectSrc ) - { - DeleteStringData(); - CopyStringData( objectSrc.m_lpszData ); - } - return *this; -} - -PString GetLastErrorString() -{ - PString strResult; - LPVOID lpMsgBuf = NULL; - - if( FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, - GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ) && lpMsgBuf ) - { - strResult = (LPCSTR) lpMsgBuf; - LocalFree( lpMsgBuf ); - LPSTR p = strResult; - while( isspace(p[strlen(p)-1]) ) - p[strlen(p)-1] = 0; - } - return strResult; + p->Flink = Blink->Flink; + p->Blink = Blink; + Blink->Flink = p; + Blink = p; + ++Count; } void TRACE(const char* pszFormat,...) diff --git a/Externals/heksedit/gtools.h b/Externals/heksedit/gtools.h index 97e43a09a..228c03053 100644 --- a/Externals/heksedit/gtools.h +++ b/Externals/heksedit/gtools.h @@ -1,97 +1,45 @@ #ifndef gtools_h #define gtools_h -#define THIS_BASED_ADDRESS(__MEMBERVARIABLE__) \ - (LPBYTE)(((LPBYTE)(&(__MEMBERVARIABLE__)))-((LPBYTE)this)) - -#define ENUMERATE(l,c,o) for(c* o=(c*)((PList*)(l))->m_pHead;o;o=(c*)((PNode*)o)->m_pNext) -#define ENUMERATE_BACKWARDS(l,c,o) for(c* o=(c*)((PList*)(l))->m_pTail;o;o=(c*)((PNode*)o)->m_pPrevious ) -#define ENUMERATE_POINTER(l,c,o) for(o=(c*)((PList*)(l))->m_pHead;o;o=(c*)((PNode*)o)->m_pNext) -#define ENUMERATE_POINTER_BACKWARDS(l,c,o) for(o=(c*)((PList*)(l))->m_pTail;o;o=(c*)((PNode*)o)->m_pPrevious) - -class PNode +class PNode : public LIST_ENTRY { public: - PNode(): m_pNext(0), m_pPrevious(0) { } - - virtual ~PNode() { } - - PNode* m_pNext; - PNode* m_pPrevious; + PNode() + { + Flink = Blink = this; + } + virtual ~PNode() + { + Blink->Flink = Flink; + Flink->Blink = Blink; + } +private: + PNode(const PNode &); // disallow copy construction + void operator=(const PNode &); // disallow assignment }; -typedef unsigned long ULONG; - class PList : public PNode { public: PList(); virtual ~PList(); - virtual bool DeleteContents(); - virtual bool RemoveContents(); - PNode* Find( long lZeroBasedIndex ); - bool Contains(PNode* pNode); - bool AddHead(PNode* pNode); - bool AddTail(PNode* pNode); - void Remove(PNode* pNode); - void Delete(PNode* pNode); - bool InsertBefore(PNode *pInsert,PNode* pBeforeThis); - bool InsertAfter(PNode* pInsert, PNode* pAfterThis); - bool Swap(PNode* pNodeA,PNode* pNodeB); - bool Move(PNode* pNodeA,PNode* pNodeB); - bool IsEmpty(); - bool Merge( PList& objectSource ); - - PNode* m_pHead; - PNode* m_pTail; - long m_lCount; + void AddTail(PNode *); + bool IsEmpty() + { + return Flink == this; + } + void DeleteContents(); + long Count; }; -class PString : public PNode +template +class PString { + TCHAR buffer[n]; public: - PString(); - PString( const char* szFormat ); - PString( int, const char* szFormat, ... ); - PString( const PString& objectSrc ); - virtual ~PString(); - void sprintf( const char* szFormat, ... ); - void vsprintf( const char* szFormat, va_list args ); - PString& operator=( const char* objectSrc ); - PString& operator=( PString& objectSrc ); - - void Append( LPCSTR pString, DWORD dwSize ); - - inline operator char*() - { - return m_lpszData; - } - - /*inline operator const char*() const - { - return m_lpszData; - }*/ - - inline int GetLength() - { - return m_iStringLength; - } - -protected: - void DeleteStringData(); - void CopyStringData(const char* lpszFrom); - - int m_iStringLength; - char* m_lpszData; - char m_szFixedBuffer[256]; + operator LPTSTR() { return buffer; } }; -#define IsEmptyString(x) (!(x)||!*(x)) -PString GetLastErrorString(); - - void TRACE(const char* pszFormat,...); - #endif // gtools_h - diff --git a/Externals/heksedit/heksedit.dsp b/Externals/heksedit/heksedit.dsp index 29adf8391..8d5b1790a 100644 --- a/Externals/heksedit/heksedit.dsp +++ b/Externals/heksedit/heksedit.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=heksedit - Win32 Release +CFG=heksedit - Win32 Debug !MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE !MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl !MESSAGE @@ -13,7 +13,7 @@ CFG=heksedit - Win32 Release !MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben !MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: !MESSAGE -!MESSAGE NMAKE /f "heksedit.mak" CFG="heksedit - Win32 Release" +!MESSAGE NMAKE /f "heksedit.mak" CFG="heksedit - Win32 Debug" !MESSAGE !MESSAGE Für die Konfiguration stehen zur Auswahl: !MESSAGE @@ -55,6 +55,12 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 version.lib comctl32.lib wininet.lib shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # SUBTRACT LINK32 /pdb:none +# Begin Special Build Tool +IntDir=.\../../BuildTmp/heksedit/Release +TargetPath=\svnroot2\trunk\Build\heksedit\Release\heksedit.dll +SOURCE="$(InputPath)" +PreLink_Cmds=PreLink.bat $(IntDir) $(TargetPath) +# End Special Build Tool !ELSEIF "$(CFG)" == "heksedit - Win32 Debug" @@ -82,6 +88,12 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 imagehlp.lib version.lib comctl32.lib wininet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib +# Begin Special Build Tool +IntDir=.\../../BuildTmp/heksedit/Debug +TargetPath=\svnroot2\trunk\Build\heksedit\Debug\heksedit.dll +SOURCE="$(InputPath)" +PreLink_Cmds=PreLink.bat $(IntDir) $(TargetPath) +# End Special Build Tool !ENDIF @@ -134,6 +146,10 @@ SOURCE=.\dllmain.cpp # End Source File # Begin Source File +SOURCE=.\DllProxies.cpp +# End Source File +# Begin Source File + SOURCE=.\EnterDecimalValueDlg.cpp # End Source File # Begin Source File @@ -186,6 +202,10 @@ SOURCE=.\InvokeHtmlHelp.cpp # End Source File # Begin Source File +SOURCE=.\LangArray.cpp +# End Source File +# Begin Source File + SOURCE=.\LoadHexFile.cpp # End Source File # Begin Source File @@ -271,6 +291,10 @@ SOURCE=.\clipboard.h # End Source File # Begin Source File +SOURCE=.\DllProxies.h +# End Source File +# Begin Source File + SOURCE=.\gktools.h # End Source File # Begin Source File @@ -307,6 +331,10 @@ SOURCE=.\idt.h # End Source File # Begin Source File +SOURCE=.\LangArray.h +# End Source File +# Begin Source File + SOURCE=.\LoadHexFile.h # End Source File # Begin Source File @@ -361,6 +389,10 @@ SOURCE=.\UpgradeDlg.h SOURCE=.\version.h # End Source File +# Begin Source File + +SOURCE=.\VersionData.h +# End Source File # End Group # Begin Group "Resource Files" diff --git a/Externals/heksedit/heksedit.h b/Externals/heksedit/heksedit.h index 1c8409f38..2e098229d 100644 --- a/Externals/heksedit/heksedit.h +++ b/Externals/heksedit/heksedit.h @@ -1,3 +1,6 @@ +// This is frhed vCURRENT_VERSION.SUB_RELEASE_NO +#include "version.h" + class IHexEditorWindow { public: @@ -58,4 +61,5 @@ public: virtual void STDMETHODCALLTYPE CMD_edit_clear() = 0; virtual BOOL STDMETHODCALLTYPE select_next_diff(BOOL bFromStart) = 0; virtual BOOL STDMETHODCALLTYPE select_prev_diff(BOOL bFromEnd) = 0; + virtual BOOL STDMETHODCALLTYPE load_lang(LANGID) = 0; }; diff --git a/Externals/heksedit/heksedit.rc b/Externals/heksedit/heksedit.rc index f83994022..b8d4c9439 100644 --- a/Externals/heksedit/heksedit.rc +++ b/Externals/heksedit/heksedit.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "resource.h" @@ -13,11 +13,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources +// English (U.S.) resources -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 @@ -26,7 +26,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // Menu // -IDR_MAINMENU MENU DISCARDABLE +IDR_MAINMENU MENU BEGIN POPUP "&File" BEGIN @@ -174,11 +174,11 @@ BEGIN BEGIN MENUITEM "&Help topics...\tF1", IDM_HELP_TOPICS MENUITEM SEPARATOR - MENUITEM "&About heksedit...", IDM_ABOUT + MENUITEM "&About frhed...", IDM_ABOUT END END -IDR_CONTEXTMENU MENU DISCARDABLE +IDR_CONTEXTMENU MENU BEGIN POPUP "0" BEGIN @@ -211,20 +211,20 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE DISCARDABLE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE DISCARDABLE +2 TEXTINCLUDE BEGIN "#include ""winres.h""\r\n" "\0" END -3 TEXTINCLUDE DISCARDABLE +3 TEXTINCLUDE BEGIN - "\r\n" + "#include ""version.rc""\r\n" "\0" END @@ -236,7 +236,7 @@ END // Accelerator // -IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +IDR_ACCELERATOR1 ACCELERATORS BEGIN "A", IDM_SELECT_ALL, VIRTKEY, CONTROL, NOINVERT "A", IDM_ADOPT_COLOURS, VIRTKEY, SHIFT, CONTROL, @@ -326,10 +326,11 @@ END // Dialog // -IDD_GOTODIALOG DIALOG DISCARDABLE 0, 0, 244, 66 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_GOTODIALOG DIALOGEX 0, 0, 244, 66 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU CAPTION "Go to" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Start with ""+"" or ""-"" (minus) for relative jump.", IDC_STATIC,7,10,139,8 @@ -341,10 +342,11 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,187,38,50,14 END -IDD_FINDDIALOG DIALOG DISCARDABLE 0, 0, 279, 138 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_FINDDIALOG DIALOGEX 0, 0, 279, 138 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU CAPTION "Find" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Find what: (please refer to the online help's Using the Special Syntax section for searching for binary values)", IDC_STATIC,7,7,265,16 @@ -362,32 +364,28 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,222,117,50,14 END -IDD_ABOUTDIALOG DIALOG DISCARDABLE 0, 0, 212, 229 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION "About heksedit" -FONT 8, "MS Sans Serif" +IDD_ABOUTDIALOG DIALOGEX 0, 0, 212, 191 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_CAPTION +CAPTION "About frhed" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,80,212,50,14 - CTEXT "heksedit 0.00",IDC_ST_VERSION,6,6,198,8 - CTEXT "A humble effort by Jochen Neubeck\nto create a dll version of Raihan Kibria's frhed\nfor use as a control in other applications", - IDC_STATIC,6,20,198,24 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,54,198,1 - ICON 109,IDC_STATIC,7,66,20,20 - LTEXT "frhed - free hex editor for 32-bit Windows\nVersion 1.1.xxx\n(c) Raihan Kibria 2002\nFill with by Pabs Dec 1999\r\nDisk-Access, Code/Decode Extension and some other bits by Gerson Kurz.", - IDC_STATIC1,36,64,167,53 - LTEXT "eMail:",IDC_STATIC,5,112,20,8 - EDITTEXT IDC_EDIT1,6,122,198,25,ES_MULTILINE | ES_AUTOHSCROLL | + DEFPUSHBUTTON "OK",IDOK,80,171,50,14 + ICON 32512,IDC_APPICON,7,9,20,20 + LTEXT "",IDC_STATIC1,37,7,167,66 + LTEXT "eMail:",IDC_STATIC,5,71,20,8 + EDITTEXT IDC_EDIT1,6,81,198,25,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY - GROUPBOX "Homepage",IDC_STATIC,6,152,198,52 - EDITTEXT IDC_EDIT2,22,162,167,12,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_EDIT2,22,121,167,12,ES_AUTOHSCROLL | ES_READONLY + GROUPBOX "Homepage",IDC_STATIC,6,111,198,52 PUSHBUTTON "Open frhed's homepage in Internet browser",IDC_BUTTON1, - 30,181,150,14 + 30,140,150,14 END -IDD_HEXDUMPDIALOG DIALOG DISCARDABLE 0, 0, 163, 161 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_HEXDUMPDIALOG DIALOGEX 0, 0, 163, 161 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Export hexdump" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Use hexadecimal notation without prefix.",IDC_STATIC,7, 7,128,8 @@ -412,10 +410,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,105,90,50,14 END -IDD_DECIMALDIALOG DIALOG DISCARDABLE 0, 0, 204, 111 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_DECIMALDIALOG DIALOGEX 0, 0, 204, 111 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enter decimal value" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Enter decimal value:",IDC_STATIC,7,7,65,8 EDITTEXT IDC_EDIT1,7,16,97,12,ES_AUTOHSCROLL @@ -436,9 +434,9 @@ BEGIN END IDD_PASTEDIALOG DIALOGEX 0, 0, 291, 145 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Paste with dialogue" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Clipboard content (text):",IDC_STATIC,7,7,76,8 EDITTEXT IDC_EDIT1,7,18,277,65,ES_MULTILINE | WS_VSCROLL, @@ -459,10 +457,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,234,112,50,14 END -IDD_CUTDIALOG DIALOG DISCARDABLE 0, 0, 169, 159 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CUTDIALOG DIALOGEX 0, 0, 169, 159 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Cut" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Start cutting at offset: (prefix offsets with x for hex)", IDC_STATIC,7,7,157,8 @@ -481,10 +479,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,112,138,50,14 END -IDD_COPYDIALOG DIALOG DISCARDABLE 0, 0, 158, 154 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_COPYDIALOG DIALOGEX 0, 0, 158, 154 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Copy" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Prefix offsets with x for hex.",IDC_STATIC,7,7,86,8 LTEXT "Start copying at offset:",IDC_STATIC,7,20,72,8 @@ -501,10 +499,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,82,131,50,14 END -IDD_VIEWSETTINGSDIALOG DIALOG DISCARDABLE 0, 0, 229, 167 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VIEWSETTINGSDIALOG DIALOGEX 0, 0, 229, 167 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "View Settings" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Number of bytes to display per line:",IDC_STATIC,7,7, 110,8 @@ -533,10 +531,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,171,97,50,14 END -IDD_APPENDDIALOG DIALOG DISCARDABLE 0, 0, 192, 46 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_APPENDDIALOG DIALOGEX 0, 0, 192, 46 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Append" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Append how many bytes to end of file:",IDC_STATIC,7,7, 121,8 @@ -546,9 +544,9 @@ BEGIN END IDD_MANIPBITSDIALOG DIALOGEX 0, 0, 257, 84 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Manipulate bits" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "statictext",IDC_STATIC1,7,7,243,8 CONTROL "Bit 7",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, @@ -580,25 +578,26 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,132,63,50,14 END -IDD_CHARACTERSETDIALOG DIALOG DISCARDABLE 0, 0, 172, 81 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CHARACTERSETDIALOG DIALOGEX 0, 0, 172, 81 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | + WS_SYSMENU CAPTION "Character Set" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Choose character set",IDC_STATIC,7,7,101,40 CONTROL "ANSI",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP, 25,19,33,10 CONTROL "OEM",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,25,32,32,10 - LTEXT "Font size in points:",IDC_STATIC,7,53,59,8 + LTEXT "Font size in points:",IDC_STATIC,7,53,101,8 EDITTEXT IDC_EDIT1,7,62,65,12,ES_AUTOHSCROLL | ES_NUMBER DEFPUSHBUTTON "OK",IDOK,115,24,50,14 PUSHBUTTON "Cancel",IDCANCEL,115,41,50,14 END -IDD_CHOOSEDIFFDIALOG DIALOG DISCARDABLE 0, 0, 258, 231 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CHOOSEDIFFDIALOG DIALOGEX 0, 0, 258, 231 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Choose area of difference to display" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "file_sizes",IDC_STATIC2,7,7,244,8 LTEXT "number_of_diffs",IDC_STATIC1,7,18,244,8 @@ -609,10 +608,10 @@ BEGIN PUSHBUTTON "Copy above list",IDCOPY,187,210,64,14 END -IDD_BINARYMODEDIALOG DIALOG DISCARDABLE 0, 0, 183, 58 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_BINARYMODEDIALOG DIALOGEX 0, 0, 183, 58 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Binary mode setting" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Choose binary mode",IDC_STATIC,7,7,104,44 CONTROL "Little-endian (Intel)",IDC_RADIO1,"Button", @@ -623,10 +622,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,126,29,50,14 END -IDD_SELECT_BLOCK_DIALOG DIALOG DISCARDABLE 0, 0, 207, 68 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_SELECT_BLOCK_DIALOG DIALOGEX 0, 0, 207, 68 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Select block" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Offset of start of selection: (prefix x for hex)", IDC_STATIC,7,7,134,8 @@ -638,10 +637,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,150,35,50,14 END -IDD_ADDBMK_DIALOG DIALOG DISCARDABLE 0, 0, 193, 65 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_ADDBMK_DIALOG DIALOGEX 0, 0, 193, 65 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add bookmark" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Offset of bookmark: (prefix x for hex)",IDC_STATIC,7,7, 114,8 @@ -652,10 +651,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,136,33,50,14 END -IDD_REMOVEBMK_DIALOG DIALOG DISCARDABLE 0, 0, 209, 167 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_REMOVEBMK_DIALOG DIALOGEX 0, 0, 209, 167 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Remove bookmark" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Remove which bookmark:",IDC_STATIC,7,7,84,8 LISTBOX IDC_LIST1,7,17,195,123,LBS_SORT | LBS_NOINTEGRALHEIGHT | @@ -664,10 +663,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,109,146,50,14 END -IDD_OPEN_PARTIAL_DIALOG DIALOG DISCARDABLE 0, 0, 221, 135 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_OPEN_PARTIAL_DIALOG DIALOGEX 0, 0, 221, 135 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Open partially" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Start opening partially...",IDC_STATIC,7,7,207,60 CONTROL "At offset relative to beginning of file: (prefix x for hex)", @@ -685,10 +684,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,110,115,50,14 END -IDD_FASTPASTE_DIALOG DIALOG DISCARDABLE 0, 0, 267, 146 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_FASTPASTE_DIALOG DIALOGEX 0, 0, 267, 146 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Paste" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Paste mode",IDC_STATIC,7,7,64,35 CONTROL "Overwrite",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | @@ -712,10 +711,10 @@ BEGIN PUSHBUTTON "Refresh",IDC_REFRESH,210,45,50,15 END -IDD_TMPL_RESULT_DIALOG DIALOG DISCARDABLE 0, 0, 304, 175 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_TMPL_RESULT_DIALOG DIALOGEX 0, 0, 304, 175 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Template" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Result of template application:",IDC_STATIC,7,7,96,8 EDITTEXT IDC_EDIT1,7,17,290,132,ES_MULTILINE | ES_AUTOVSCROLL | @@ -724,10 +723,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,154,154,50,14 END -IDD_REPLACEDIALOG DIALOG DISCARDABLE 0, 0, 208, 226 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_REPLACEDIALOG DIALOGEX 0, 0, 208, 226 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Replace" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Find what:",IDC_STATIC,7,7,34,8 EDITTEXT IDC_TO_REPLACE_EDIT,7,16,194,62,ES_MULTILINE | @@ -749,10 +748,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,147,205,54,14 END -IDD_FILL_WITH DIALOG DISCARDABLE 0, 0, 382, 103 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_FILL_WITH DIALOGEX 0, 0, 382, 103 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Fill selection with:",IDC_STATIC,5,5,56,8 COMBOBOX IDC_TYPE,65,5,35,35,CBS_DROPDOWNLIST | WS_VSCROLL | @@ -790,10 +789,10 @@ BEGIN EDITTEXT IDC_R,325,84,50,12,ES_AUTOHSCROLL | ES_READONLY END -IDD_CHANGEINST DIALOG DISCARDABLE 0, 0, 247, 76 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CHANGEINST DIALOGEX 0, 0, 247, 76 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Change Instance" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Load the following instance data:",IDC_STATIC,5,5,105, 15,SS_CENTERIMAGE @@ -813,10 +812,10 @@ BEGIN IDC_STATIC,5,45,235,25 END -IDD_ENCODE_DECODE_DIALOG DIALOG DISCARDABLE 0, 0, 236, 169 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_ENCODE_DECODE_DIALOG DIALOGEX 0, 0, 236, 169 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Encode / Decode Data" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Algorithms:",IDC_STATIC,4,4,172,8 LISTBOX IDC_LIST1,4,16,172,108,LBS_SORT | LBS_NOINTEGRALHEIGHT | @@ -831,10 +830,10 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,180,20,50,14 END -IDD_OPEN_DRIVE_DIALOG DIALOG DISCARDABLE 0, 0, 236, 133 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_OPEN_DRIVE_DIALOG DIALOGEX 0, 0, 236, 133 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Open Drive" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LISTBOX IDC_LIST1,4,4,172,124,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP @@ -842,10 +841,11 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,180,20,50,14 END -IDD_GOTO_TRACK_DIALOG DIALOG DISCARDABLE 0, 0, 244, 133 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_GOTO_TRACK_DIALOG DIALOGEX 0, 0, 244, 133 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU CAPTION "Go to Track" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Drive Information:",-1,4,4,168,12 EDITTEXT IDC_EDIT3,4,20,172,80,ES_MULTILINE | ES_AUTOHSCROLL | @@ -857,9 +857,9 @@ BEGIN END IDD_SHORTCUTS DIALOGEX 0, 0, 217, 166 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Shortcuts" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Paths of shortcuts to frhed:",IDC_STATIC,5,5,86,8 CONTROL "Links to frhed",IDC_LIST,"SysListView32",LVS_REPORT | @@ -889,9 +889,9 @@ BEGIN END IDD_UPGRADE DIALOGEX 0, 0, 377, 242 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Upgrade" -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Version list:",IDC_STATIC,5,5,36,8 CONTROL "Versions",IDC_VERS,"SysListView32",LVS_REPORT | @@ -923,10 +923,10 @@ BEGIN IDC_STATIC,45,215,270,25 END -IDD_MOVE_COPY DIALOG DISCARDABLE 0, 0, 163, 156 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_MOVE_COPY DIALOGEX 0, 0, 163, 156 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Move/Copy bytes" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Offset of one end of the block:",IDC_STATIC,5,15,97,8, SS_CENTERIMAGE @@ -959,9 +959,9 @@ BEGIN END IDD_DRAG_DROP DIALOGEX 0, 0, 202, 121 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Drag-drop" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Clipboard format[s] to use:",-1,5,5,82,8 CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | @@ -977,10 +977,10 @@ BEGIN 10 END -IDD_DRAG_DROP_OPTIONS DIALOG DISCARDABLE 0, 0, 312, 116 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_DRAG_DROP_OPTIONS DIALOGEX 0, 0, 312, 116 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "OLE Drag-drop options" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "General",IDC_STATIC,5,0,145,75 CONTROL "Enable drop input",IDC_ENABLE_DROP,"Button", @@ -1031,7 +1031,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_GOTODIALOG, DIALOG BEGIN @@ -1054,7 +1054,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 205 TOPMARGIN, 7 - BOTTOMMARGIN, 222 + BOTTOMMARGIN, 192 END IDD_HEXDUMPDIALOG, DIALOG @@ -1264,72 +1264,25 @@ BEGIN END #endif // APSTUDIO_INVOKED - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,0,0 - PRODUCTVERSION 1,1,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x23L -#else - FILEFLAGS 0x22L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040704b0" - BEGIN - VALUE "Comments", "Homepage: http://www.kibria.de, http://zip.to/pabs3\0" - VALUE "CompanyName", "(c) Raihan Kibria 2000\0" - VALUE "FileDescription", "heksedit - free hex editor dll 1.1.0\0" - VALUE "FileVersion", "1, 1, 0\0" - VALUE "InternalName", "heksedit\0" - VALUE "LegalCopyright", "GNU General Public License v2.0\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "heksedit.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "frhed\0" - VALUE "ProductVersion", "1, 1, 0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x407, 1200 - END -END - -#endif // !_MAC - - ///////////////////////////////////////////////////////////////////////////// // // Bitmap // -IDB_TOOLBAR BITMAP DISCARDABLE "Toolbar.bmp" +IDB_TOOLBAR BITMAP "res/Toolbar.bmp" ///////////////////////////////////////////////////////////////////////////// // // String Table // -STRINGTABLE DISCARDABLE +STRINGTABLE BEGIN IDM_OPEN "Open" IDM_NEW "New" END -STRINGTABLE DISCARDABLE +STRINGTABLE BEGIN IDM_SAVE "Save" IDM_FIND "Find" @@ -1339,12 +1292,12 @@ BEGIN IDM_EDIT_CUT "Cut" END -STRINGTABLE DISCARDABLE +STRINGTABLE BEGIN IDM_REPLACE "Replace" END -STRINGTABLE DISCARDABLE +STRINGTABLE BEGIN ID_DISK_GOTONEXTTRACK "Goto next sector" ID_DISK_GOTOPREVIOUSTRACK "Goto previous sector" @@ -1352,7 +1305,7 @@ BEGIN ID_DISK_GOTOLASTTRACK "Goto last sector" END -#endif // Deutsch (Deutschland) resources +#endif // Englisch (USA) resources ///////////////////////////////////////////////////////////////////////////// @@ -1362,7 +1315,7 @@ END // // Generated from the TEXTINCLUDE 3 resource. // - +#include "version.rc" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/Externals/heksedit/heksedit.vcproj b/Externals/heksedit/heksedit.vcproj index 7ccfeb603..aa9309a65 100644 --- a/Externals/heksedit/heksedit.vcproj +++ b/Externals/heksedit/heksedit.vcproj @@ -13,8 +13,8 @@ @@ -22,13 +22,15 @@ Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS" + StringPooling="TRUE" + ExceptionHandling="FALSE" RuntimeLibrary="3" UsePrecompiledHeader="3" PrecompiledHeaderThrough="precomp.h" - PrecompiledHeaderFile=".\../../BuildTmp/heksedit/Debug/heksedit.pch" - AssemblerListingLocation=".\../../BuildTmp/heksedit/Debug/" - ObjectFile=".\../../BuildTmp/heksedit/Debug/" - ProgramDataBaseFileName=".\../../BuildTmp/heksedit/Debug/" + PrecompiledHeaderFile=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\heksedit.pch" + AssemblerListingLocation=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" + ObjectFile=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" + ProgramDataBaseFileName=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE" @@ -38,13 +40,13 @@ + Name="VCPreLinkEventTool" + CommandLine="PreLink.bat $(IntDir) $(TargetPath)"/> @@ -87,13 +90,15 @@ Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS" + StringPooling="TRUE" + ExceptionHandling="FALSE" RuntimeLibrary="2" UsePrecompiledHeader="3" PrecompiledHeaderThrough="precomp.h" - PrecompiledHeaderFile=".\../../BuildTmp/heksedit/Release/heksedit.pch" - AssemblerListingLocation=".\../../BuildTmp/heksedit/Release/" - ObjectFile=".\../../BuildTmp/heksedit/Release/" - ProgramDataBaseFileName=".\../../BuildTmp/heksedit/Release/" + PrecompiledHeaderFile=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\heksedit.pch" + AssemblerListingLocation=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" + ObjectFile=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" + ProgramDataBaseFileName=".\..\..\BuildTmp\heksedit\$(ConfigurationName)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="TRUE"/> @@ -102,12 +107,12 @@ + Name="VCPreLinkEventTool" + CommandLine="PreLink.bat $(IntDir) $(TargetPath)"/> @@ -172,7 +178,7 @@ @@ -191,7 +197,7 @@ @@ -210,7 +216,7 @@ @@ -229,7 +235,7 @@ @@ -248,7 +254,7 @@ @@ -267,7 +273,7 @@ @@ -286,7 +292,7 @@ @@ -305,7 +311,7 @@ @@ -324,7 +330,7 @@ + + @@ -362,7 +371,7 @@ @@ -381,7 +390,7 @@ @@ -400,7 +409,7 @@ @@ -419,7 +428,7 @@ @@ -438,7 +447,7 @@ @@ -457,7 +466,7 @@ @@ -476,7 +485,7 @@ @@ -495,7 +504,7 @@ @@ -514,7 +523,7 @@ @@ -533,7 +542,7 @@ @@ -552,7 +561,7 @@ @@ -571,7 +580,7 @@ + + @@ -609,7 +621,7 @@ @@ -628,7 +640,7 @@ @@ -647,7 +659,7 @@ @@ -666,7 +678,7 @@ @@ -685,7 +697,7 @@ @@ -704,7 +716,7 @@ @@ -723,7 +735,7 @@ @@ -742,7 +754,7 @@ @@ -751,7 +763,7 @@ @@ -763,7 +775,7 @@ @@ -782,7 +794,7 @@ @@ -801,7 +813,7 @@ @@ -820,7 +832,7 @@ @@ -839,7 +851,7 @@ @@ -858,7 +870,7 @@ @@ -877,7 +889,7 @@ @@ -896,7 +908,7 @@ @@ -915,7 +927,7 @@ @@ -938,6 +950,9 @@ RelativePath="clipboard.h"> + + + RelativePath=".\LangArray.h"> + RelativePath="LoadHexFile.h"> @@ -1006,6 +1021,9 @@ + + -#include -#include -#include "toolbar.h" +#include "VersionData.h" #include "hexwnd.h" #include "hexwdlg.h" #include "shtools.h" @@ -15,6 +12,7 @@ #include "clipboard.h" #include "BinTrans.h" #include "LoadHexFile.h" +#include "LangArray.h" /*In the following headers: ULONG m_cRefCount; //The reference count that all objects based on IUnknown must have @@ -25,7 +23,7 @@ #include "ids.h" #include "ido.h" -static const char appname[] = "heksedit"; +static const char appname[] = "frhed"; //CF_RTF defined in Richedit.h, but we don't include it cause that would be overkill #ifndef CF_RTF @@ -37,7 +35,12 @@ const CLIPFORMAT CF_RICH_TEXT_FORMAT = (CLIPFORMAT)RegisterClipboardFormat(CF_RT BOOL ShowHtmlHelp(UINT uCommand, DWORD dwData, HWND hParentWindow); -//unsigned int iStartPL, iNumBytesPl, iPLFileLen, bShowFileStatsPL; +int HexEditorWindow::MouseOpDist = GetProfileInt("Windows", "DragMinDist", DD_DEFDRAGMINDIST); +int HexEditorWindow::MouseOpDelay = GetProfileInt("Windows", "DragDelay", DD_DEFDRAGDELAY); +//We use the size of the font instead +//int HexEditorWindow::ScrollInset = GetProfileInt("Windows", "DragScrollInset", DD_DEFSCROLLINSET); +int HexEditorWindow::ScrollDelay = GetProfileInt("Windows", "DragScrollDelay", DD_DEFSCROLLDELAY); +int HexEditorWindow::ScrollInterval = GetProfileInt("Windows", "DragScrollInterval", DD_DEFSCROLLINTERVAL); int HexEditorWindow::iPasteAsText = 0; int HexEditorWindow::iPasteTimes = 1; @@ -75,13 +78,6 @@ HexEditorWindow::HexEditorWindow() bCenterCaret = FALSE; bMakeBackups = 0; - MouseOpDist = GetProfileInt( "Windows", "DragMinDist", DD_DEFDRAGMINDIST ); - MouseOpDelay = GetProfileInt( "Windows", "DragDelay", DD_DEFDRAGDELAY ); - //We use the size of the font instead - //ScrollInset = GetProfileInt( "Windows", "DragScrollInset", DD_DEFSCROLLINSET ); - ScrollDelay = GetProfileInt( "Windows", "DragScrollDelay", DD_DEFSCROLLDELAY ); - ScrollInterval = GetProfileInt( "Windows", "DragScrollInterval", DD_DEFSCROLLINTERVAL ); - enable_drop = TRUE; enable_drag = TRUE; enable_scroll_delay_dd = TRUE; @@ -218,48 +214,52 @@ int HexEditorWindow::translate_accelerator(MSG *pMsg) return TranslateAccelerator(hwnd, hAccel, pMsg); } +static LangArray langArray; + +BOOL HexEditorWindow::load_lang(LANGID langid) +{ + return langArray.Load(hMainInstance, langid); +} + //-------------------------------------------------------------------------------------------- int HexEditorWindow::load_file(const char *fname) { WaitCursor wc; int bLoaded = FALSE; - if (file_is_loadable(fname)) + int filehandle = _open(fname, _O_RDONLY|_O_BINARY); + if (filehandle != -1) { - int filehandle = _open (fname,_O_RDONLY|_O_BINARY,_S_IREAD|_S_IWRITE); - if (filehandle != -1) + int filelen = _filelength(filehandle); + DataArray.ClearAll(); + // Try to allocate memory for the file. + if (DataArray.SetSize(filelen)) { - int filelen = _filelength(filehandle); - DataArray.ClearAll(); - // Try to allocate memory for the file. - if (DataArray.SetSize(filelen)) + DataArray.ExpandToSize(); + // If read-only mode on opening is enabled or the file is read only: + bReadOnly = bOpenReadOnly || -1 == _access(fname, 02); //Pabs added call to _access + // Load the file. + if (filelen == 0 || _read(filehandle, DataArray, filelen) != -1) { - DataArray.ExpandToSize(); - // If read-only mode on opening is enabled or the file is read only: - bReadOnly = bOpenReadOnly || -1 == _access(fname, 02); //Pabs added call to _access - // Load the file. - if (filelen == 0 || _read(filehandle, DataArray, filelen) != -1) - { - // This is an empty file. Don't need to read anything. - GetLongPathNameWin32(fname, filename); - bLoaded = TRUE; - } - else - { - MessageBox(hwnd, "Error while reading from file.", "Load error", MB_ICONERROR); - } + // This is an empty file. Don't need to read anything. + GetLongPathNameWin32(fname, filename); + bLoaded = TRUE; } else { - MessageBox(hwnd, "Not enough memory to load file.", "Load error", MB_ICONERROR); + MessageBox(hwnd, "Error while reading from file.", "Load error", MB_ICONERROR); } - _close(filehandle); } else { - char buf[500]; - sprintf(buf, "Error code 0x%x occured while opening file %s.", errno, fname); - MessageBox(hwnd, buf, "Load error", MB_ICONERROR); + MessageBox(hwnd, "Not enough memory to load file.", "Load error", MB_ICONERROR); } + _close(filehandle); + } + else + { + char buf[500]; + sprintf(buf, "Error code 0x%x occured while opening file %s.", errno, fname); + MessageBox(hwnd, buf, "Load error", MB_ICONERROR); } if (bLoaded) { @@ -283,20 +283,17 @@ int HexEditorWindow::load_file(const char *fname) } //-------------------------------------------------------------------------------------------- -int HexEditorWindow::file_is_loadable (const char* fname) +int HexEditorWindow::file_is_loadable(const char *fname) { - int filehandle; - if ((filehandle = _open (fname,_O_RDONLY|_O_BINARY,_S_IREAD|_S_IWRITE)) != -1) - { - _close (filehandle); - return TRUE; - } - else + int filehandle = _open(fname, _O_RDONLY|_O_BINARY); + if (filehandle == -1) return FALSE; + _close(filehandle); + return TRUE; } //-------------------------------------------------------------------------------------------- -int HexEditorWindow::at_window_create (HWND hw, HINSTANCE hI) +int HexEditorWindow::at_window_create(HWND hw, HINSTANCE hI) { hwnd = hw; hInstance = hI; @@ -311,14 +308,12 @@ int HexEditorWindow::at_window_create (HWND hw, HINSTANCE hI) iCurNibble = 0; target = new CDropTarget(*this); - if( target ) + if (target) { - CoLockObjectExternal( target, TRUE, FALSE ); - if( enable_drop ) - RegisterDragDrop( hwnd, target ); + CoLockObjectExternal(target, TRUE, FALSE); + if (enable_drop) + RegisterDragDrop(hwnd, target); } - if( !target || !enable_drop || ( enable_drop && prefer_CF_HDROP ) ) - DragAcceptFiles( hwnd, TRUE ); // Accept files dragged into window. return TRUE; } @@ -477,19 +472,18 @@ int HexEditorWindow::snap_caret() int adjusth = 0; int adjustv = 0; - int column; - + int col = iMaxOffsetLen + iByteSpace; if (bSelecting ? area == AREA_BYTES : iEnteringMode == BYTES) - column = BYTES_LOGICAL_COLUMN; + col += (iCurByte % iBytesPerLine) * 3 + iCurNibble; //BYTES_LOGICAL_COLUMN; else - column = CHARS_LOGICAL_COLUMN; + col += iBytesPerLine * 3 + iCharSpace + iCurByte % iBytesPerLine; //CHARS_LOGICAL_COLUMN; - if (column >= iHscrollPos + cxBuffer) + if (col >= iHscrollPos + cxBuffer) { - iHscrollPos = column - (cxBuffer - 1); + iHscrollPos = col - (cxBuffer - 1); adjusth = 1; } - else if (column < iHscrollPos) + else if (col < iHscrollPos) { iHscrollPos = column; adjusth = 1; @@ -501,15 +495,15 @@ int HexEditorWindow::snap_caret() repall = 1; } - int line = iCurByte / iBytesPerLine; - if (line < iVscrollPos) + int row = iCurByte / iBytesPerLine; + if (row < iVscrollPos) { - iVscrollPos = line; + iVscrollPos = row; adjustv = 1; } - else if (line >= iVscrollPos + cyBuffer) + else if (row >= iVscrollPos + cyBuffer) { - iVscrollPos = line - (cyBuffer - 1); + iVscrollPos = row - (cyBuffer - 1); if (iVscrollPos < 0) iVscrollPos = 0; adjustv = 1; @@ -914,7 +908,7 @@ void HexEditorWindow::hscroll(int cmd) int HexEditorWindow::paint() { PAINTSTRUCT ps; - HDC hdc = BeginPaint (hwnd, &ps); + HDC hdc = BeginPaint(hwnd, &ps); //------------------------------------------------------- HideCaret (hwnd); // Delete remains of last position. @@ -922,7 +916,7 @@ int HexEditorWindow::paint() int b = iVscrollPos + ps.rcPaint.bottom / cyChar; if (b >= iNumlines) b = iNumlines - 1; - int iBkColor = PALETTERGB (GetRValue(iBkColorValue),GetGValue(iBkColorValue),GetBValue(iBkColorValue)); + int iBkColor = PALETTERGB(GetRValue(iBkColorValue), GetGValue(iBkColorValue), GetBValue(iBkColorValue)); RECT rc; HBRUSH hbr = CreateSolidBrush(iBkColor); // Delete lower border if there are empty lines on screen. @@ -954,18 +948,18 @@ int HexEditorWindow::paint() SelectObject(hdc, oldpen); DeleteObject(sep_pen); SelectObject(hdc, oldfont); - ShowCaret (hwnd); - EndPaint (hwnd, &ps); + ShowCaret(hwnd); + EndPaint(hwnd, &ps); return 0; } //-------------------------------------------------------------------------------------------- // Receives WM_COMMAND messages and passes either them to their handler functions or // processes them here. -int HexEditorWindow::command(int cmd) +void HexEditorWindow::command(int cmd) { if (!queryCommandEnabled(cmd)) - return 0; + return; HMENU hMenu = GetMenu(hwndMain); switch (cmd) { @@ -1020,7 +1014,7 @@ int HexEditorWindow::command(int cmd) int res,r,r0;r=r0=0;//r&r0 used to determine if the user has removed all frhed data res = MessageBox(hwnd, "Are you sure you want to remove frhed ?", "Remove frhed", MB_YESNO); if (res != IDYES) - return 0; + return; //Can assume registry data exists res = linkspresent(); if (res) @@ -1142,56 +1136,65 @@ int HexEditorWindow::command(int cmd) static_cast*>(this)->DoModal(hwnd); break; case IDM_CONTEXT: - if(MF_CHECKED==GetMenuState(hMenu,IDM_CONTEXT,0)){ - RegDeleteKey( HKEY_CLASSES_ROOT, "*\\shell\\Open in frhed\\command" ); //WinNT requires the key to have no subkeys - RegDeleteKey( HKEY_CLASSES_ROOT, "*\\shell\\Open in frhed" ); + if (MF_CHECKED == GetMenuState(hMenu, IDM_CONTEXT, 0)) + { + RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shell\\Open in frhed\\command"); //WinNT requires the key to have no subkeys + RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shell\\Open in frhed"); } - else{ + else + { HKEY key1; - LONG res = RegCreateKey( HKEY_CLASSES_ROOT, + LONG res = RegCreateKey(HKEY_CLASSES_ROOT, "*\\shell\\Open in frhed\\command", - &key1 ); - if( res == ERROR_SUCCESS ){ - char cmd[_MAX_PATH]; - strcpy(cmd, _pgmptr ); - strcat(cmd," %1"); - RegSetValue( key1, NULL, REG_SZ, cmd, strlen(cmd)); + &key1); + if (res == ERROR_SUCCESS) + { + char cmd[MAX_PATH]; + int len = sprintf(cmd, "%s %%1", _pgmptr); + RegSetValue(key1, NULL, REG_SZ, cmd, len); } } break; case IDM_UNKNOWN: - if(MF_CHECKED==GetMenuState(hMenu,IDM_UNKNOWN,0)){ + if (MF_CHECKED == GetMenuState(hMenu, IDM_UNKNOWN, 0)) + { HKEY hk; - RegDeleteKey( HKEY_CLASSES_ROOT, "Unknown\\shell\\Open in frhed\\command" ); //WinNT requires the key to have no subkeys - RegDeleteKey( HKEY_CLASSES_ROOT, "Unknown\\shell\\Open in frhed" ); - if(ERROR_SUCCESS==RegOpenKey(HKEY_CLASSES_ROOT,"Unknown\\shell",&hk)){ - RegDeleteValue(hk,NULL); + RegDeleteKey(HKEY_CLASSES_ROOT, "Unknown\\shell\\Open in frhed\\command"); //WinNT requires the key to have no subkeys + RegDeleteKey(HKEY_CLASSES_ROOT, "Unknown\\shell\\Open in frhed"); + if (ERROR_SUCCESS == RegOpenKey(HKEY_CLASSES_ROOT, "Unknown\\shell", &hk)) + { + RegDeleteValue(hk, NULL); RegCloseKey(hk); } } - else{ + else + { HKEY key1; - LONG res = RegCreateKey( HKEY_CLASSES_ROOT, + LONG res = RegCreateKey(HKEY_CLASSES_ROOT, "Unknown\\shell\\Open in frhed\\command", - &key1 ); - if( res == ERROR_SUCCESS ){ - char cmd[_MAX_PATH]; - strcpy(cmd, _pgmptr ); - strcat(cmd," %1"); - RegSetValue( key1, NULL, REG_SZ, cmd, strlen(cmd)); + &key1); + if (res == ERROR_SUCCESS) + { + char cmd[MAX_PATH]; + int len = sprintf(cmd, "%s %%1", _pgmptr); + RegSetValue(key1, NULL, REG_SZ, cmd, len); } } break; case IDM_DEFAULT: - if(MF_CHECKED==GetMenuState(hMenu,IDM_DEFAULT,0)){ + if (MF_CHECKED == GetMenuState(hMenu, IDM_DEFAULT, 0)) + { HKEY hk; - if(ERROR_SUCCESS==RegOpenKey(HKEY_CLASSES_ROOT,"Unknown\\shell",&hk)){ - RegDeleteValue(hk,NULL); + if (ERROR_SUCCESS == RegOpenKey(HKEY_CLASSES_ROOT, "Unknown\\shell", &hk)) + { + RegDeleteValue(hk, NULL); RegCloseKey(hk); } } else - RegSetValue( HKEY_CLASSES_ROOT, "Unknown\\shell", REG_SZ, "Open in frhed", 13); + { + RegSetValue(HKEY_CLASSES_ROOT, "Unknown\\shell", REG_SZ, "Open in frhed", 13); + } break; //end case IDM_REPLACE: @@ -1213,7 +1216,7 @@ int HexEditorWindow::command(int cmd) break; case IDM_BMK_COLOR: - CMD_color_settings( &iBmkColor ); + CMD_color_settings(&iBmkColor); break; case IDM_RESET_COLORS: @@ -1221,11 +1224,8 @@ int HexEditorWindow::command(int cmd) break; case IDM_EDIT_READONLYMODE: - if( bReadOnly == FALSE ) - bReadOnly = TRUE; - else - bReadOnly = FALSE; - resize_window(); + bReadOnly = !bReadOnly; + set_wnd_title(); break; case IDM_APPLYTEMPLATE: @@ -1273,53 +1273,43 @@ int HexEditorWindow::command(int cmd) case IDM_READFLOAT: { -//Pabs optimized - since sprintf returns the string len we can use a pointer, save 46 bytes & not call strcat so many times - char buf[500],* buf2 = buf; - buf[0] = 0; - float floatval;//Pabs replaced 4 with sizeof(floatval) - if (DataArray.GetLength()-iCurByte >= sizeof(floatval)) + char buf[500]; + char *buf2 = buf; + buf[0] = '\0'; + union + { + float fval; + double dval; + BYTE bytes[1]; + } u; + int iBytesAhead = DataArray.GetLength() - iCurByte; + if (iBytesAhead >= sizeof u.fval) { // Space enough for float. - if (iBinaryMode == LITTLEENDIAN_MODE) - { - floatval = *((float*)&(DataArray[iCurByte])); - } - else // BIGENDIAN_MODE - { - char* pf = (char*) &floatval; - int i;//Pabs replaced 4 with sizeof(floatval) - for (i=0; i= sizeof(dval)) + { + buf2 += sprintf(buf2, "Not enough space for float size value.\n"); + } + if (iBytesAhead >= sizeof u.dval) { // Space enough for double. - if (iBinaryMode == LITTLEENDIAN_MODE) - { - dval = *((double*)&(DataArray[iCurByte])); - } - else // BIGENDIAN_MODE - { - char* pd = (char*) &dval; - int i;//Pabs replaced 8 with sizeof(dval) - portability - for (i=0; i\n", ); - strcat(buf,buf2); - }*/ - char buf[4000],* buf2 = buf; - buf2 += sprintf (buf2, "Data length: %d\n", DataArray.GetLength ()); - buf2 += sprintf (buf2, "Upper Bound: %d\n", DataArray.GetUpperBound ()); - buf2 += sprintf (buf2, "Data size: %d\n", DataArray.GetSize ()); - buf2 += sprintf (buf2, "cxChar: %d\n", cxChar ); - buf2 += sprintf (buf2, "cyChar: %d\n", cyChar ); - buf2 += sprintf (buf2, "iNumlines: %d\n", iNumlines); - buf2 += sprintf (buf2, "iVscrollPos: %d\n", iVscrollPos); - buf2 += sprintf (buf2, "iCurByte: %d\n", iCurByte); - buf2 += sprintf (buf2, "cyBuffer: %d\n", cyBuffer ); -//Pabs inserted - buf2 += sprintf (buf2, "cxBuffer: %d\n", cxBuffer ); -//end - buf2 += sprintf (buf2, "iMRU_count: %d\n", iMRU_count); + char buf[4000]; + char *buf2 = buf; + buf2 += sprintf(buf2, "Data length: %d\n", DataArray.GetLength()); + buf2 += sprintf(buf2, "Upper Bound: %d\n", DataArray.GetUpperBound()); + buf2 += sprintf(buf2, "Data size: %d\n", DataArray.GetSize()); + buf2 += sprintf(buf2, "cxChar: %d\n", cxChar); + buf2 += sprintf(buf2, "cyChar: %d\n", cyChar); + buf2 += sprintf(buf2, "iNumlines: %d\n", iNumlines); + buf2 += sprintf(buf2, "iVscrollPos: %d\n", iVscrollPos); + buf2 += sprintf(buf2, "iCurByte: %d\n", iCurByte); + buf2 += sprintf(buf2, "cyBuffer: %d\n", cyBuffer); + buf2 += sprintf(buf2, "cxBuffer: %d\n", cxBuffer); + buf2 += sprintf(buf2, "iMRU_count: %d\n", iMRU_count); int i; - for (i=0; i iNumlines-cyBuffer) - iVscrollPos=iNumlines-cyBuffer; - if (iVscrollPos < 0) - iVscrollPos=0; - if (icl != iVscrollPos){ - adjust_vscrollbar(); - repaint(); - } - } - break; + case IDM_SCROLL_NEXT: + vscroll(SB_PAGEDOWN); + break; case IDM_SCROLL_UP: - if (iVscrollPos > 0) - { - iVscrollPos--; - adjust_vscrollbar (); - repaint (); - } + vscroll(SB_LINEUP); break; case IDM_SCROLL_DOWN: - if (iVscrollPos < iNumlines-cyBuffer) - { - iVscrollPos++; - adjust_vscrollbar (); - repaint (); - } + vscroll(SB_LINEDOWN); break; case IDM_SCROLL_LEFT: - if (iHscrollPos > 0) - { - iHscrollPos--; - adjust_hscrollbar (); - repaint (); - } + hscroll(SB_LINELEFT); break; case IDM_SCROLL_RIGHT: - if (iHscrollPos < iGetCharsPerLine() - cxBuffer) - { - iHscrollPos++; - adjust_hscrollbar (); - repaint(); - } + hscroll(SB_LINERIGHT); break; case IDM_OPEN: @@ -1575,23 +1510,21 @@ int HexEditorWindow::command(int cmd) break; default: - {//Pabs replaced NULL w hwnd + { char buf[500]; - sprintf (buf, "Unknown COMMAND-ID %d.", cmd); - MessageBox (hwnd, buf, "frhed ERROR", MB_OK); - }//end + sprintf(buf, "Unknown COMMAND-ID %d.", cmd); + MessageBox(hwnd, buf, "frhed ERROR", MB_OK); + } break; } - return 0; } - //-------------------------------------------------------------------------------------------- -int HexEditorWindow::destroy_window () +int HexEditorWindow::destroy_window() { - DragAcceptFiles(hwnd,FALSE); RevokeDragDrop(hwnd); - if (target) CoLockObjectExternal(target, FALSE, TRUE); + if (target) + CoLockObjectExternal(target, FALSE, TRUE); return 0; } @@ -2042,10 +1975,12 @@ void HexEditorWindow::print_line(HDC hdc, int line, HBRUSH hbr) int i = sprintf(linbuf, "%*.*x", iMinOffsetLen, iMinOffsetLen, bPartialStats ? startpos + iPartialOffset : startpos); memset(linbuf + i, ' ', m - i); - SetTextColor (hdc, iTextColor); - SetBkColor (hdc, iBkColor); + SetTextColor(hdc, iTextColor); + SetBkColor(hdc, iBkColor); print_text(hdc, x, y, linbuf, m); + RECT r; + x += m; int z = x + (iByteSpace + 1) * iBytesPerLine + iCharSpace; @@ -2085,24 +2020,20 @@ void HexEditorWindow::print_line(HDC hdc, int line, HBRUSH hbr) u = '.'; } } - else if (i > length) - { - linbuf[0] = linbuf[1] = ' '; - } else { - linbuf[0] = linbuf[1] = '_'; + linbuf[0] = linbuf[1] = i == length ? '_' : ' '; } bool bDiff = i < length && i < sibling_length && buffer[i] != sibling_buffer[i]; if (bSelected && i >= iSelLower && i <= iSelUpper) { - SetTextColor (hdc, bDiff ? iSelDiffTextColor : iSelTextColor); - SetBkColor (hdc, bDiff ? iSelDiffBkColor : iSelBkColor); + SetTextColor(hdc, bDiff ? iSelDiffTextColor : iSelTextColor); + SetBkColor(hdc, bDiff ? iSelDiffBkColor : iSelBkColor); } else { - SetTextColor (hdc, bDiff ? iDiffTextColor : iTextColor); - SetBkColor (hdc, bDiff ? iDiffBkColor : iBkColor); + SetTextColor(hdc, bDiff ? iDiffTextColor : iTextColor); + SetBkColor(hdc, bDiff ? iDiffBkColor : iBkColor); } m = iByteSpace; if (i < endpos) @@ -2115,27 +2046,24 @@ void HexEditorWindow::print_line(HDC hdc, int line, HBRUSH hbr) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Separators. - for (i = 0; i <= iBytesPerLine / 4 ; i++) + r.top = (line - iVscrollPos) * cyChar; + r.bottom = r.top + cyChar; + for (i = 0 ; i <= iBytesPerLine ; i += 4) { -//Pabs replaced "iOffsetLen" with "iMaxOffsetLen" - m = (iMaxOffsetLen+iByteSpace)*cxChar - cxChar/2 + 3*cxChar*4*i - cxChar*iHscrollPos; -//end - MoveToEx (hdc, m, (line-iVscrollPos)*cyChar, NULL); - LineTo (hdc, m, (line-iVscrollPos+1)*cyChar); + r.left = r.right = (iMaxOffsetLen + iByteSpace - iHscrollPos + i * 3) * cxChar - cxChar / 2; + Polyline(hdc, (LPPOINT)&r, 2); } // Separator for chars. - m = CHARSTART*cxChar - cxChar*iHscrollPos - 2; - MoveToEx (hdc, m, (line-iVscrollPos)*cyChar, NULL); - LineTo (hdc, m, (line-iVscrollPos+1)*cyChar); + r.left = r.right = (iMaxOffsetLen + iByteSpace - iHscrollPos + iBytesPerLine * 3 + iCharSpace) * cxChar - cxChar / 2 - 1; + Polyline(hdc, (LPPOINT)&r, 2); // Second separator. - MoveToEx (hdc, m+2, (line-iVscrollPos)*cyChar, NULL); - LineTo (hdc, m+2, (line-iVscrollPos+1)*cyChar); + OffsetRect(&r, 2, 0); + Polyline(hdc, (LPPOINT)&r, 2); // Print bookmark indicators. // Are there bookmarks in this line? int el = startpos + iBytesPerLine - 1; int chpos; - RECT r; // Brush for bookmark borders. for( i = 0; i < iBmkCount; i++ ) { @@ -2170,29 +2098,32 @@ void HexEditorWindow::print_line(HDC hdc, int line, HBRUSH hbr) //-------------------------------------------------------------------------------------------- // Set horizontal scroll position so that caret is visible. -void HexEditorWindow::adjust_view_for_caret () +void HexEditorWindow::adjust_view_for_caret() { - int log_column; + int col = iMaxOffsetLen + iByteSpace; if (iEnteringMode == BYTES) - log_column = BYTES_LOGICAL_COLUMN; + col += (iCurByte % iBytesPerLine) * 3 + iCurNibble; //BYTES_LOGICAL_COLUMN; else - log_column = CHARS_LOGICAL_COLUMN; + col += iBytesPerLine * 3 + iCharSpace + iCurByte % iBytesPerLine; //CHARS_LOGICAL_COLUMN; //Pabs changed to put cursor in center of screen - if ( log_column >= iHscrollPos + cxBuffer - || log_column < iHscrollPos ) - iHscrollPos = log_column - cxBuffer/2; + if ( col < iHscrollPos + || col >= iHscrollPos + cxBuffer ) + iHscrollPos = col - cxBuffer / 2; if( iHscrollPos > iHscrollMax - cxBuffer + 1 ) iHscrollPos = iHscrollMax - cxBuffer + 1; - if( iHscrollPos < 0 ) iHscrollPos = 0; - adjust_hscrollbar (); - if( BYTELINE < iVscrollPos - || BYTELINE > iVscrollPos + cyBuffer - 1 ) - iVscrollPos = BYTELINE - cyBuffer/2; + if( iHscrollPos < 0 ) + iHscrollPos = 0; + adjust_hscrollbar(); + int row = iCurByte / iBytesPerLine; + if( row < iVscrollPos + || row >= iVscrollPos + cyBuffer ) + iVscrollPos = row - cyBuffer / 2; if( iVscrollPos > iVscrollMax - cyBuffer + 1 ) iVscrollPos = iVscrollMax - cyBuffer + 1; - if( iVscrollPos < 0 ) iVscrollPos = 0; - adjust_vscrollbar (); + if( iVscrollPos < 0 ) + iVscrollPos = 0; + adjust_vscrollbar(); //end } @@ -2359,7 +2290,6 @@ int HexEditorWindow::initmenupopup(WPARAM w, LPARAM l) // Handler on window closing. int HexEditorWindow::close(const char *caption) { -//Pabs changed - restructured so that help file is always closed on exit & the user can save&exit, exit | not exit if file changed if (iFileChanged) { int res = MessageBox(hwnd, "Do you want to save your changes?", @@ -2368,15 +2298,6 @@ int HexEditorWindow::close(const char *caption) //User doesn't want to quit or User wants to save and the save was unsuccessful return 0;//Don't exit } -// else -// { - // If help was open close it. -// ShowHtmlHelp(HELP_QUIT, 0, hwnd); -// } -//end - - // Destroy window. -// DestroyWindow( hwnd ); return 1; } @@ -2386,41 +2307,24 @@ BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) switch (iMsg) { case WM_INITDIALOG: - if (HRSRC hRes = ::FindResource(hMainInstance, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION)) - { - struct VersionData - { - WORD wLength; - WORD wValueLength; - WORD wType; - WCHAR szKey[sizeof"VS_VERSION_INFO"]; - VS_FIXEDFILEINFO FixedFileInfo; - }; - C_ASSERT(sizeof(struct VersionData) % sizeof(int) == 0); - if (struct VersionData *pRes = (struct VersionData *)::LoadResource(hMainInstance, hRes)) - { - TCHAR szVersion[40]; - int cch = wsprintf(szVersion, TEXT("heksedit %u.%02u"), UINT HIWORD(pRes->FixedFileInfo.dwFileVersionMS), UINT LOWORD(pRes->FixedFileInfo.dwFileVersionMS)); - if (pRes->FixedFileInfo.dwFileFlags & VS_FF_PRERELEASE) - szVersion[cch++] = 'b'; - if (pRes->FixedFileInfo.dwFileFlags & VS_FF_DEBUG) - szVersion[cch++] = 'D'; - szVersion[cch] = '\0'; - ::SetDlgItemText(hDlg, IDC_ST_VERSION, szVersion); - } - } + TranslateDialog(hDlg); // Set the version information. SetDlgItemText(hDlg, IDC_STATIC1, "frhed - free hex editor for 32-bit Windows\nVersion "CURRENT_VERSION"." - SUB_RELEASE_NO "\n(c) Raihan Kibria 2000" + SUB_RELEASE_NO"\n(c) Raihan Kibria 2000" "\nFill with by Pabs Dec 1999" - "\nDisk-Access, Code/Decode Extension and some other bits by Gerson Kurz."); + "\nDisk-Access, Code/Decode Extension and some other bits by Gerson Kurz." + "\nDLL interface by Jochen Neubeck."); // Set the email-addresses. SetDlgItemText(hDlg, IDC_EDIT1, "rkibria@hrz1.hrz.tu-darmstadt.de" "\r\nPabs: pabs3@zip.to"); // Set the homepage URL. SetDlgItemText(hDlg, IDC_EDIT2, "http://www.kibria.de"); + // Set the icon. + if (HWND hwndParent = GetParent(hDlg)) + if (DWORD dwIcon = GetClassLong(hwndParent, GCL_HICON)) + SendDlgItemMessage(hDlg, IDC_APPICON, STM_SETICON, dwIcon, 0); return TRUE; case WM_COMMAND: @@ -2434,7 +2338,7 @@ BOOL CALLBACK AboutDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM) case IDC_BUTTON1: { HINSTANCE hi = ShellExecute(hDlg, "open", "http://www.kibria.de", 0, NULL, SW_SHOWNORMAL); - if ((UINT)hi <= 32) + if ((UINT)hi <= HINSTANCE_ERROR) MessageBox(hDlg, "Could not call browser.", "Go to homepage", MB_ICONERROR); } } @@ -2588,19 +2492,19 @@ int HexEditorWindow::mousemove(int xPos, int yPos) if (bLButtonDown) { - if (bSelecting) { fix_scroll_timers(xPos, yPos); int lastbyte = DataArray.GetUpperBound(); - if( new_pos > lastbyte ) new_pos = lastbyte; - if( iEndOfSelection != new_pos ) + if (new_pos > lastbyte) + new_pos = lastbyte; + if (iEndOfSelection != new_pos) { bSelected = TRUE; int oeos = iEndOfSelection; iEndOfSelection = new_pos; - repaint(oeos/iBytesPerLine,new_pos/iBytesPerLine); + repaint(oeos / iBytesPerLine, new_pos / iBytesPerLine); } } /*else if (bPullScrolling) @@ -2622,7 +2526,9 @@ int HexEditorWindow::mousemove(int xPos, int yPos) else { SetCursor(LoadCursor(NULL, - enable_drag && bSelected && IN_BOUNDS(new_pos, iStartOfSelection, iEndOfSelection) ? + enable_drag && bSelected && + new_pos >= iGetStartOfSelection() && + new_pos <= iGetEndOfSelection() ? IDC_ARROW : IDC_IBEAM)); } @@ -3075,14 +2981,13 @@ int HexEditorWindow::CMD_copy_hexdump(int iCopyHexdumpMode, int iCopyHexdumpType } else return 0; - if(mem) + if (mem) return 1; if (iCopyHexdumpMode == 0) { // to file. char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; - strcpy (szFileName, "hexdump.txt"); + strcpy(szFileName, "hexdump.txt"); HGLOBAL hg = NULL; if( iCopyHexdumpType == IDC_EXPORTRTF ){ hg = (HGLOBAL)pMem; @@ -3096,42 +3001,27 @@ int HexEditorWindow::CMD_copy_hexdump(int iCopyHexdumpMode, int iCopyHexdumpType // to file. OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; - if (GetSaveFileName (&ofn)) + if (GetSaveFileName(&ofn)) { - int filehandle; - if ((filehandle = _open (szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE)) != -1) + int filehandle = _open(szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY, _S_IREAD|_S_IWRITE); + if (filehandle != -1) { // Write file. - if ((_write (filehandle, pMem, buflen-1)) != -1) - {//Pabs replaced NULL w hwnd - MessageBox (hwnd, "Hexdump saved.", "Export hexdump", MB_ICONINFORMATION); - } + if (_write(filehandle, pMem, buflen - 1) != -1) + MessageBox(hwnd, "Hexdump saved.", "Export hexdump", MB_ICONINFORMATION); else - MessageBox (hwnd, "Could not save Hexdump.", "Export hexdump", MB_ICONERROR); - _close (filehandle); + MessageBox(hwnd, "Could not save Hexdump.", "Export hexdump", MB_ICONERROR); + _close(filehandle); } else - MessageBox (hwnd, "Could not save Hexdump.", "Export hexdump", MB_ICONERROR); + MessageBox(hwnd, "Could not save Hexdump.", "Export hexdump", MB_ICONERROR); }//end if (iCopyHexdumpType == IDC_EXPORTRTF) { @@ -3197,7 +3087,7 @@ void HexEditorWindow::CMD_edit_enterdecimalvalue() // Return: Length of resulting string. // ppd = pointer to pointer to result, must be delete[]-ed later. // If the input string was empty, no translated array is created and zero is returned. -int HexEditorWindow::create_bc_translation (char** ppd, char* src, int srclen) +int HexEditorWindow::create_bc_translation(char **ppd, char *src, int srclen) { int destlen = Text2BinTranslator::iLengthOfTransToBin(src, srclen); if (destlen > 0) @@ -3268,35 +3158,22 @@ int HexEditorWindow::CMD_new(const char *title) //------------------------------------------------------------------- int HexEditorWindow::CMD_save_as() { - char szFileName[_MAX_PATH] = ""; - char szTitleName[_MAX_FNAME + _MAX_EXT] = ""; + char szFileName[_MAX_PATH]; + szFileName[0] = '\0'; if (Drive == 0) strcpy(szFileName, filename); OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (!GetSaveFileName(&ofn)) return 0; WaitCursor w1; - int filehandle = _open(szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE); + int filehandle = _open(szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY, _S_IREAD|_S_IWRITE); if (filehandle == -1) { MessageBox(hwnd, "Could not save file.", "Save as", MB_ICONERROR); @@ -3354,7 +3231,7 @@ int HexEditorWindow::CMD_save() // File is partially loaded => must be saved partially or saved as. if (bPartialOpen) { - int filehandle = _open (filename, _O_RDWR|_O_BINARY,_S_IREAD|_S_IWRITE); + int filehandle = _open(filename, _O_RDWR|_O_BINARY); if (filehandle == -1) { MessageBox(hwnd, "Could not save partially opened file.", "Save", MB_ICONERROR); @@ -3417,15 +3294,15 @@ int HexEditorWindow::CMD_save() return done; } - int filehandle = _open(filename, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE); + int filehandle = _open(filename, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY, _S_IREAD|_S_IWRITE); if (filehandle == -1) { - MessageBox (hwnd, "Could not save file.", "Save", MB_ICONERROR); + MessageBox(hwnd, "Could not save file.", "Save", MB_ICONERROR); return 0; } if (_write(filehandle, DataArray, DataArray.GetLength()) == -1) { - MessageBox (hwnd, "Could not write data to file.", "Save", MB_ICONERROR); + MessageBox(hwnd, "Could not write data to file.", "Save", MB_ICONERROR); } else { @@ -3446,29 +3323,15 @@ void HexEditorWindow::CMD_open() if (!close("Open")) return; char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szFileName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (GetOpenFileName(&ofn)) load_file(szFileName); } @@ -3478,6 +3341,7 @@ void HexEditorWindow::adjust_view_for_selection() { if( bSelected ) { + int iCharStart = iMaxOffsetLen + iByteSpace + iBytesPerLine * 3 + iCharSpace; //Pabs changed to put selection in center of screen int iStartOfSelSetting = iStartOfSelection; int iEndOfSelSetting = iEndOfSelection; @@ -3496,8 +3360,8 @@ void HexEditorWindow::adjust_view_for_selection() } else { - soscol = CHARSTART + ( iStartOfSelSetting % iBytesPerLine ); - eoscol = CHARSTART + ( iEndOfSelSetting % iBytesPerLine ); + soscol = iCharStart + iStartOfSelSetting % iBytesPerLine; + eoscol = iCharStart + iEndOfSelSetting % iBytesPerLine; maxcols = iBytesPerLine; } @@ -3527,8 +3391,8 @@ void HexEditorWindow::adjust_view_for_selection() maxcol = iMaxOffsetLen + iByteSpace + ( iBytesPerLine - 1 ) * 3 + 2; } else{ - mincol = CHARSTART; - maxcol = CHARSTART + iBytesPerLine; + mincol = iCharStart; + maxcol = iCharStart + iBytesPerLine; } } iHscrollPos = mincol - (cxBuffer - (maxcol-mincol) )/2; @@ -3554,7 +3418,7 @@ void HexEditorWindow::CMD_view_settings() //------------------------------------------------------------------- // Change the color indicated by pColor. -void HexEditorWindow::CMD_color_settings (COLORREF* pColor) +void HexEditorWindow::CMD_color_settings(COLORREF *pColor) { CHOOSECOLOR cc; COLORREF crCustColors[16]; @@ -3642,18 +3506,13 @@ void HexEditorWindow::read_ini_data(char *key) res = RegQueryValueEx( key1, "iMRU_count", NULL, NULL, (BYTE*) &iMRU_count, &datasize ); int i; - char fname[64]; - for( i = 1; i <= MRUMAX; i++ ) + for (i = 0 ; i < MRUMAX ; i++) { - sprintf( fname, "MRU_File%d", i ); - datasize = _MAX_PATH + 1; - res = RegQueryValueEx( key1, fname, NULL, NULL, (BYTE*) &szPath, &datasize ); - strcpy( &( strMRU[i-1][0] ), szPath ); + char fname[64]; + sprintf(fname, "MRU_File%d", i + 1); + datasize = _MAX_PATH; + res = RegQueryValueEx(key1, fname, NULL, NULL, (BYTE*) strMRU[i], &datasize); } - - // if( res != ERROR_SUCCESS )//Pabs replaced NULL w hwnd - // MessageBox( hwnd, "Could not read value", appname, MB_OK ); - // Close registry. RegCloseKey(key1); } @@ -4230,32 +4089,18 @@ void HexEditorWindow::CMD_open_partially() if (!close("Open partially")) return; char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szFileName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (!GetOpenFileName(&ofn)) return; - OpenPartiallyDlg::filehandle = _open(szFileName,_O_RDONLY|_O_BINARY,_S_IREAD|_S_IWRITE); + OpenPartiallyDlg::filehandle = _open(szFileName, _O_RDONLY|_O_BINARY); if (OpenPartiallyDlg::filehandle == -1) { char buf[500]; @@ -4335,7 +4180,7 @@ void HexEditorWindow::dropfiles(HDROP hDrop) UINT i = 0; if (numfiles > 1) { - i = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_REMOVEBMK_DIALOG), hwnd, MultiDropDlgProc, (LPARAM)hDrop); + i = ShowModalDialog(IDD_REMOVEBMK_DIALOG, hwnd, MultiDropDlgProc, hDrop); if (i >= numfiles) { DragFinish(hDrop); @@ -4386,29 +4231,16 @@ void HexEditorWindow::CMD_apply_template() } // Get name of template file. char szTemplateName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szTemplateName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "Template files (*.tpl)\0*.tpl\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szTemplateName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = "Choose template file"; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (GetOpenFileName(&ofn)) { // szTemplateName contains name of chosen tpl file. @@ -4420,7 +4252,7 @@ void HexEditorWindow::CMD_apply_template() void HexEditorWindow::apply_template(char *pcTemplate) { // Load template file. - int filehandle = _open(pcTemplate, _O_RDONLY|_O_BINARY, _S_IREAD|_S_IWRITE); + int filehandle = _open(pcTemplate, _O_RDONLY|_O_BINARY); if (filehandle == -1) { char buf[500]; @@ -4453,7 +4285,7 @@ void HexEditorWindow::apply_template(char *pcTemplate) TplResult.Append('\0'); // Display template data. char *pcTmplText = TplResult; - DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_TMPL_RESULT_DIALOG), hwnd, TmplDisplayDlgProc, (LPARAM)pcTmplText); + ShowModalDialog(IDD_TMPL_RESULT_DIALOG, hwnd, TmplDisplayDlgProc, pcTmplText); } else//Pabs replaced NULL w hwnd MessageBox(hwnd, "Template file could not be loaded.", "Template error", MB_ICONERROR); @@ -4822,11 +4654,28 @@ HRESULT HexEditorWindow::ResolveIt(LPCSTR lpszLinkFile, LPSTR lpszPath) return ::ResolveIt(hwndMain, lpszLinkFile, lpszPath); } +void NTAPI TranslateDialog(HWND hwnd) +{ + if (IsWindowUnicode(hwnd)) + langArray.TranslateDialogW(hwnd); + else + langArray.TranslateDialogA(hwnd); +} + +INT_PTR NTAPI ShowModalDialog(UINT idd, HWND hwnd, DLGPROC dlgproc, LPVOID param) +{ + HINSTANCE hinst = langArray.m_hLangDll ? langArray.m_hLangDll : hMainInstance; + return IsWindowUnicode(hwnd) + ? DialogBoxParamW(hinst, MAKEINTRESOURCEW(idd), hwnd, dlgproc, (LPARAM)param) + : DialogBoxParamA(hinst, MAKEINTRESOURCEA(idd), hwnd, dlgproc, (LPARAM)param); +} + //------------------------------------------------------------------- void HexEditorWindow::CMD_colors_to_default() -{//Pabs replaced NULL w hwnd - if( MessageBox( hwnd, "Really reset colors to default values?", appname, MB_YESNO | MB_ICONQUESTION ) == IDYES ) - {//end +{ + if (MessageBox(hwnd, "Really reset colors to default values?", + appname, MB_YESNO | MB_ICONQUESTION) == IDYES) + { iBmkColor = RGB( 255, 0, 0 ); iSelBkColorValue = RGB( 255, 255, 0 ); iSelTextColorValue = RGB( 0, 0, 0 ); @@ -4838,7 +4687,6 @@ void HexEditorWindow::CMD_colors_to_default() } } - void HexEditorWindow::CMD_GotoDllExports() { ULONG ulOffset, ulSize; @@ -5016,29 +4864,19 @@ void HexEditorWindow::CMD_findnext() if (FindDlg::pcFindDlgBuffer) { // There is a findstring. Create its translation. - char* pcFindstring; + char *pcFindstring; int srclen = strlen(FindDlg::pcFindDlgBuffer); if (int destlen = create_bc_translation(&pcFindstring, FindDlg::pcFindDlgBuffer, srclen)) { SetCursor(LoadCursor(NULL, IDC_WAIT)); - int i = find_bytes( - (char *)&DataArray[iCurByte + 1], + int i = find_bytes((char *)&DataArray[iCurByte + 1], DataArray.GetLength() - iCurByte - 1, pcFindstring, destlen, 1, FindDlg::iFindDlgMatchCase ? equal : lower_case); - if (i != -1) - iCurByte += i + 1; - SetCursor(LoadCursor(NULL, IDC_ARROW)); - if( i != -1 ) + if (i != -1) { - /* OLD - // Caret will be vertically centered if line of found string is not visible. - if( iCurByte/iBytesPerLine < iVscrollPos || iCurByte/iBytesPerLine > iVscrollPos + cyBuffer ) - iVscrollPos = max( 0, iCurByte/iBytesPerLine-cyBuffer/2 ); - adjust_vscrollbar(); - */ - + iCurByte += i + 1; bSelected = TRUE; iStartOfSelection = iCurByte; iEndOfSelection = iCurByte + destlen - 1; @@ -5046,8 +4884,9 @@ void HexEditorWindow::CMD_findnext() repaint(); } else + { MessageBox(hwnd, "Could not find any more occurances.", "Find next", MB_ICONERROR); - + } delete [] pcFindstring; } else @@ -5104,32 +4943,23 @@ void HexEditorWindow::CMD_findprev() if (FindDlg::pcFindDlgBuffer) { // There is a findstring. Create its translation. - char* pcFindstring; + char *pcFindstring; int srclen = strlen(FindDlg::pcFindDlgBuffer); if (int destlen = create_bc_translation(&pcFindstring, FindDlg::pcFindDlgBuffer, srclen)) { - SetCursor( LoadCursor( NULL, IDC_WAIT ) ); + SetCursor(LoadCursor(NULL, IDC_WAIT)); // Search the array starting at index 0 to the current byte, // plus the findstring-length minus 1. If // you are somewhere in the middle of the findstring with the caret // and you choose "find previous" you usually want to find the beginning // of the findstring in the file. - int i = find_bytes((char *) &DataArray[0], - min( iCurByte + (destlen - 1), DataArray.GetLength() ), + int i = find_bytes((char *)&DataArray[0], + min(iCurByte + (destlen - 1), DataArray.GetLength()), pcFindstring, destlen, -1, FindDlg::iFindDlgMatchCase ? equal : lower_case); + SetCursor(LoadCursor(NULL, IDC_ARROW)); if (i != -1) - iCurByte = i; - - SetCursor( LoadCursor( NULL, IDC_ARROW ) ); - if( i != -1 ) { - /* OLD - // Caret will be vertically centered if line of found string is not visible. - if( iCurByte/iBytesPerLine < iVscrollPos || iCurByte/iBytesPerLine > iVscrollPos + cyBuffer ) - iVscrollPos = max( 0, iCurByte/iBytesPerLine-cyBuffer/2 ); - adjust_vscrollbar(); - */ - + iCurByte = i; bSelected = TRUE; iStartOfSelection = iCurByte; iEndOfSelection = iCurByte + destlen - 1; @@ -5137,7 +4967,9 @@ void HexEditorWindow::CMD_findprev() repaint(); } else + { MessageBox(hwnd, "Could not find any more occurances.", "Find previous", MB_ICONERROR); + } delete [] pcFindstring; } else @@ -5192,11 +5024,11 @@ int HexEditorWindow::OnWndMsg( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara break; case WM_LBUTTONDOWN: - lbuttondown( wParam, LOWORD( lParam ), HIWORD( lParam ) ); + lbuttondown(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_LBUTTONUP: - lbuttonup( LOWORD( lParam ), HIWORD( lParam ) ); + lbuttonup(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; // GK20AUG2K @@ -5205,15 +5037,15 @@ int HexEditorWindow::OnWndMsg( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara break; case WM_MOUSEMOVE: - mousemove( (int) (short) LOWORD( lParam ), (int) (short) HIWORD( lParam ) ); + mousemove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_KEYDOWN: - keydown( wParam ); + keydown(wParam); break; case WM_CHAR: - character( (char) wParam ); + character((char)wParam); break; case WM_VSCROLL: @@ -5229,7 +5061,7 @@ int HexEditorWindow::OnWndMsg( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara return 0; case WM_COMMAND: - command( LOWORD( wParam ) ); + command(LOWORD(wParam)); break; case WM_TIMER: @@ -5240,7 +5072,7 @@ int HexEditorWindow::OnWndMsg( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lPara destroy_window(); break; } - return DefWindowProc (hwnd, iMsg, wParam, lParam); + return DefWindowProc(hwnd, iMsg, wParam, lParam); } //Pabs changed - removed CMD_explorersettings @@ -5345,7 +5177,7 @@ void HexEditorWindow::CMD_revert() } if (bPartialOpen) { - int filehandle = _open (filename,_O_RDONLY|_O_BINARY,_S_IREAD|_S_IWRITE); + int filehandle = _open(filename, _O_RDONLY|_O_BINARY); if (filehandle != -1) { _lseek(filehandle, iPartialOffset, 0); @@ -5405,29 +5237,15 @@ void HexEditorWindow::CMD_deletefile() void HexEditorWindow::CMD_insertfile() { char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szFileName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (!GetOpenFileName(&ofn)) return; // RK: don't allow inserting same file we're editing right now. @@ -5520,53 +5338,31 @@ void HexEditorWindow::CMD_insertfile() void HexEditorWindow::CMD_saveselas() { char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; + szFileName[0] = '\0'; OPENFILENAME ofn; - szTitleName[0] = szFileName[0] = '\0'; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (GetSaveFileName(&ofn)) { const char *complain = "Could not save file."; - int filehandle = _open(szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE); + int filehandle = _open(szFileName, _O_RDWR|_O_CREAT|_O_TRUNC|_O_BINARY, _S_IREAD|_S_IWRITE); if (filehandle != -1) { - SetCursor (LoadCursor (NULL, IDC_WAIT)); - int iStartOfSelSetting; - int iEndOfSelSetting; + WaitCursor wc; + int lower = 0; + int upper = DataArray.GetUpperBound(); if (bSelected) { - iStartOfSelSetting = iStartOfSelection; - iEndOfSelSetting = iEndOfSelection; + lower = iGetStartOfSelection(); + upper = iGetEndOfSelection(); } - else - { - iStartOfSelSetting = 0; - iEndOfSelSetting = DataArray.GetUpperBound(); - } - if (iStartOfSelSetting > iEndOfSelSetting) - swap(iStartOfSelSetting, iEndOfSelSetting); - if (_write(filehandle, &DataArray[iStartOfSelSetting], iEndOfSelSetting - iStartOfSelSetting + 1) != -1) + if (_write(filehandle, &DataArray[lower], upper - lower + 1) != -1) complain = 0; - SetCursor (LoadCursor (NULL, IDC_ARROW)); _close(filehandle); } if (complain) @@ -5689,29 +5485,15 @@ void HexEditorWindow::CMD_open_hexdump() //Import from file //Initialize the struct char szFileName[_MAX_PATH]; - char szTitleName[_MAX_FNAME + _MAX_EXT]; szFileName[0] = '\0'; OPENFILENAME ofn; - ofn.lStructSize = sizeof (OPENFILENAME); + ZeroMemory(&ofn, sizeof ofn); + ofn.lStructSize = sizeof ofn; ofn.hwndOwner = hwnd; - ofn.hInstance = NULL; ofn.lpstrFilter = "Hex Dump files(*.txt,*.hex)\0*.txt;*.hex\0All Files (*.*)\0*.*\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nMaxCustFilter = 0; - ofn.nFilterIndex = 0; ofn.lpstrFile = szFileName; ofn.nMaxFile = _MAX_PATH; - ofn.lpstrFileTitle = szTitleName; - ofn.nMaxFileTitle = _MAX_FNAME + _MAX_EXT; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = NULL; ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT; - ofn.nFileOffset = 0; - ofn.nFileExtension = 0; - ofn.lpstrDefExt = NULL; - ofn.lCustData = 0L; - ofn.lpfnHook = NULL; - ofn.lpTemplateName = NULL; if (!GetOpenFileName(&ofn)) return; //Set up variables for the function @@ -6079,7 +5861,8 @@ void HexEditorWindow::status_bar_click(bool left) { //In bits section //Find the end of " Bits=" - for ( ; i < len && st[i] != '=' ; i++); + while (i < len && st[i] != '=') + ++i; //Are we in the actual bits or " Bits=" if (cn <= i) @@ -6096,7 +5879,6 @@ void HexEditorWindow::status_bar_click(bool left) len = i + 1; GetTextExtentPoint32(dc, text, len, &s); r = rt.left + s.cx; - //Flip the equivalent of a "bit" for (i = 0 ; i < 7 ; i++) { @@ -6104,21 +5886,19 @@ void HexEditorWindow::status_bar_click(bool left) if (p.x <= r + s.cx + 1) break; } - if (st[i] == '0') - st[i] = '1'; - else if (st[i] == '1') - st[i] = '0'; - + st[i] ^= '0' ^ '1'; //Assemble all the "bits" - DataArray[iCurByte] = 0x00; - for( i = 0; i < 8; i++){ - if( st[i] == '1' ) DataArray[iCurByte] |= 0x01; - if( i < 7 ) DataArray[iCurByte] <<= 1; + BYTE c = 0x00; + for (i = 0 ; i < 8 ; i++) + { + c <<= 1; + if (st[i] == '1') + c |= 0x01; } - + DataArray[iCurByte] = c; //Redraw the data & status bar etc bFilestatusChanged = iFileChanged = TRUE; - repaint(BYTELINE); + repaint(iCurByte / iBytesPerLine); }//In actual bits }//In bits section @@ -6648,7 +6428,8 @@ HGLOBAL HexEditorWindow::RTF_hexdump(int start, int end, DWORD* plen){ //If the current line contains a bookmark else for (bi = 0 ; bi < iBmkCount ; bi++) { - if (IN_BOUNDS(pbmkList[i].offset, l, l + iBytesPerLine - 1)) + int offset = pbmkList[i].offset; + if (offset >= l && offset < l + iBytesPerLine) { highlights_in_this_line = true; break; diff --git a/Externals/heksedit/hexwnd.h b/Externals/heksedit/hexwnd.h index 9dfa13f0d..7cc55ae00 100644 --- a/Externals/heksedit/hexwnd.h +++ b/Externals/heksedit/hexwnd.h @@ -3,9 +3,15 @@ #include "IDT.h" -// This is frhed vCURRENT_VERSION.SUB_RELEASE_NO -#include "version.h" #include "heksedit.h" + +#define SHARPEN_A(X) #X +#define SHARPEN_W(X) L#X +#define SHARPEN(T,X) SHARPEN_##T(X) + +#define CURRENT_VERSION SHARPEN(A,FRHED_MAJOR_VERSION) "." SHARPEN(A,FRHED_MINOR_VERSION) +#define SUB_RELEASE_NO SHARPEN(A,FRHED_SUB_RELEASE_NO) + #include "PhysicalDrive.h" #include "PMemoryBlock.h" @@ -17,10 +23,8 @@ BOOL CALLBACK TmplDisplayDlgProc(HWND, UINT, WPARAM, LPARAM); //-------------------------------------------------------------------------------------------- -#define swapxor(x, y) ((x) < (y) ? 0 : (x) ^ (y)) -#define bitval(base,pos) ((base)[(pos)/8]&(1<<((pos)%8))) #define ANSI_SET ANSI_FIXED_FONT -#define OEM_SET OEM_FIXED_FONT +#define OEM_SET OEM_FIXED_FONT #define LITTLEENDIAN_MODE 0 #define BIGENDIAN_MODE 1 #define SCROLL_TIMER_ID 1 @@ -31,7 +35,6 @@ BOOL CALLBACK TmplDisplayDlgProc(HWND, UINT, WPARAM, LPARAM); #define BMKTEXTMAX 256 #define TPL_TYPE_MAXLEN 16 #define TPL_NAME_MAXLEN 128 -#define FINDDLG_BUFLEN (64*1024) typedef struct { @@ -43,10 +46,10 @@ typedef struct // Global variables. #include "simparr.h" -HRESULT ResolveIt( HWND hwnd, LPCSTR lpszLinkFile, LPSTR lpszPath ); //-------------------------------------------------------------------------------------------- enum ClickArea { AREA_NONE, AREA_OFFSETS, AREA_BYTES, AREA_CHARS }; enum SCROLL_TYPE { SCROLL_NONE, SCROLL_BACK, SCROLL_FORWARD }; +enum EnteringMode { BYTES, CHARS }; class hexfile_stream; class load_hexfile_0; @@ -124,14 +127,9 @@ public: void set_drag_caret(long x, long y, bool Copying, bool Overwrite ); void fix_scroll_timers(long x, long y); void kill_scroll_timers(); - int lbd_pos; //ClickArea lbd_area; + int lbd_pos; int nibblenum, bytenum, column, line, new_pos, old_pos, old_col, old_row; int bMouseOpDelayTimerSet; - //int ScrollInset; - int ScrollDelay; - int ScrollInterval; - int MouseOpDist; - int MouseOpDelay; SCROLL_TYPE prev_vert; SCROLL_TYPE prev_horz; @@ -151,7 +149,7 @@ public: void apply_template_on_memory( char* pcTpl, int tpl_len, SimpleArray& ResultArray ); void apply_template(char *pcTemplate); void CMD_apply_template(); - void dropfiles(HDROP); + virtual void STDMETHODCALLTYPE dropfiles(HDROP); void CMD_open_partially(); void CMD_clear_all_bmk(); void CMD_remove_bkm(); @@ -225,6 +223,7 @@ public: Settings *STDMETHODCALLTYPE get_settings(); Status *STDMETHODCALLTYPE get_status(); int STDMETHODCALLTYPE translate_accelerator(MSG *); + BOOL STDMETHODCALLTYPE load_lang(LANGID); virtual int STDMETHODCALLTYPE load_file(const char* fname); int file_is_loadable(const char* fname); @@ -238,10 +237,10 @@ public: void vscroll(int cmd); void hscroll(int cmd); int paint(); - int command(int cmd); + virtual void STDMETHODCALLTYPE command(int cmd); int destroy_window(); virtual void STDMETHODCALLTYPE set_wnd_title(); - void set_caret_pos (); + void set_caret_pos(); void print_text(HDC hdc, int x, int y, char *pch, int cch); virtual HRESULT STDMETHODCALLTYPE ResolveIt(LPCSTR lpszLinkFile, LPSTR lpszPath); @@ -257,6 +256,10 @@ protected: //Pabs inserted int bMakeBackups;//Backup the file when saving //end + static int ScrollDelay; + static int ScrollInterval; + static int MouseOpDist; + static int MouseOpDelay; static SimpleString TexteditorName; static SimpleString EncodeDlls; static int iPasteAsText; @@ -267,7 +270,7 @@ protected: int iBmkCount; bookmark pbmkList[BMKMAX]; int iMRU_count; - char strMRU[MRUMAX][_MAX_PATH+1]; + char strMRU[MRUMAX][_MAX_PATH]; int bFilestatusChanged; int bScrollTimerSet; int iMouseX, iMouseY; @@ -297,6 +300,9 @@ protected: void reverse_bytes(BYTE *, BYTE *); +void NTAPI TranslateDialog(HWND); +INT_PTR NTAPI ShowModalDialog(UINT, HWND, DLGPROC, LPVOID); + class WaitCursor { private: @@ -318,13 +324,16 @@ class dialog : public T static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_INITDIALOG) + { SetWindowLong(hWnd, DWL_USER, lParam); + TranslateDialog(hWnd); + } return ((T *)GetWindowLong(hWnd, DWL_USER))->DlgProc(hWnd, uMsg, wParam, lParam); } public: INT_PTR DoModal(HWND hWnd) { - return DialogBoxParam(hMainInstance, MAKEINTRESOURCE(IDD), hWnd, DlgProc, (LPARAM)this); + return ShowModalDialog(IDD, hWnd, DlgProc, this); } }; @@ -335,25 +344,6 @@ template inline void swap(T& x, T& y) y = temp; } -//-------------------------------------------------------------------------------------------- -// MAKROS -//Pabs replaced iOffsetLen w iMaxOffsetLen -#define CHARSTART (iMaxOffsetLen + iByteSpace + iBytesPerLine * 3 + iCharSpace) -#define BYTEPOS (iCurByte % iBytesPerLine) -#define BYTELINE (iCurByte / iBytesPerLine) -#define BYTES_LOGICAL_COLUMN (iMaxOffsetLen + iByteSpace + BYTEPOS * 3 + iCurNibble) -//end -#define CHARS_LOGICAL_COLUMN (CHARSTART + BYTEPOS) -#define STARTSELECTION_LINE (iStartOfSelection / iBytesPerLine) -#define ENDSELECTION_LINE (iEndOfSelection / iBytesPerLine) -#define IN_BOUNDS( i, a, b ) ( ( i >= a && i <= b ) || ( i >= b && i <= a ) ) -#define BYTES 0 // for EnteringMode -#define CHARS 1 -#define WM_F1DOWN (WM_USER+1) - -//============================================================================================ -// The main window object. - extern HINSTANCE hMainInstance; extern int iMovePos; enum OPTYP { OPTYP_MOVE, OPTYP_COPY }; diff --git a/Externals/heksedit/ido.cpp b/Externals/heksedit/ido.cpp index fc7ab0c16..52566a67b 100644 --- a/Externals/heksedit/ido.cpp +++ b/Externals/heksedit/ido.cpp @@ -1,7 +1,6 @@ #include "precomp.h" #include "ido.h" #include "hexwnd.h" -#include /*The #ifndef __CYGWIN__s are there because cygwin/mingw doesn't yet have certain APIs in their import libraries. Specifically _wremove, _wopen & GetEnhMetaFileBits.*/ diff --git a/Externals/heksedit/idt.cpp b/Externals/heksedit/idt.cpp index d5ca632e7..dd683ca23 100644 --- a/Externals/heksedit/idt.cpp +++ b/Externals/heksedit/idt.cpp @@ -35,7 +35,7 @@ INT_PTR DragDropDlg::DlgProc(HWND h, UINT m, WPARAM w, LPARAM l) if (numformatetcs && formatetcs) { LVCOLUMN col; - Zero(col); + ZeroMemory(&col, sizeof col); ListView_InsertColumn(list, 0, &col); char szFormatName[100]; UINT i; @@ -105,26 +105,26 @@ INT_PTR DragDropDlg::DlgProc(HWND h, UINT m, WPARAM w, LPARAM l) { case IDOK: { - effect = IsDlgButtonChecked( h, IDC_MOVE ) ? false : true; + effect = !IsDlgButtonChecked(h, IDC_MOVE); HWND list = GetDlgItem(h, IDC_LIST); numformats = ListView_GetSelectedCount(list); - if( numformats ){ - for(;;) + if (numformats) + { + formats = (UINT*)malloc(numformats * sizeof *formats); + if (formats == 0) { - formats = (UINT*)malloc( numformats*sizeof(*formats) ); - if(formats) break; - numformats--; //numformats/=2; //Or this + MessageBox(h, "Not enough memory", "Drag-drop", MB_ICONERROR); + return TRUE; } - if( formats ){ - LVITEM temp; - Zero(temp); - temp.mask = LVIF_PARAM; - temp.iItem = -1; - for( UINT i = 0; i < numformats; i++ ){ - temp.iItem = ListView_GetNextItem(list, temp.iItem, LVNI_SELECTED); - ListView_GetItem(list,&temp); - formats[i] = temp.lParam; - } + LVITEM temp; + ZeroMemory(&temp, sizeof temp); + temp.mask = LVIF_PARAM; + temp.iItem = -1; + for (UINT i = 0 ; i < numformats ; i++) + { + temp.iItem = ListView_GetNextItem(list, temp.iItem, LVNI_SELECTED); + ListView_GetItem(list, &temp); + formats[i] = temp.lParam; } } EndDialog (h, 1); @@ -138,8 +138,7 @@ INT_PTR DragDropDlg::DlgProc(HWND h, UINT m, WPARAM w, LPARAM l) { HWND list = GetDlgItem(h, IDC_LIST); LVITEM item[2]; - Zero(item[0]); - Zero(item[1]); + ZeroMemory(item, sizeof item); //If anyone knows a better way to swap two items please send a patch item[0].iItem = ListView_GetNextItem(list, (UINT)-1, LVNI_SELECTED); if(item[0].iItem==-1) item[0].iItem = ListView_GetNextItem(list, (UINT)-1, LVNI_FOCUSED); @@ -652,12 +651,11 @@ STDMETHODIMP CDropTarget::Drop( IDataObject* pDataObject, DWORD grfKeyState, POI //Get data switch( stm.tymed ){ case TYMED_HGLOBAL:{ - LPVOID pmem = GlobalLock( stm.hGlobal ); - if( pmem ){ - try{ memcpy( data, pmem, len ); } - catch(...){} + if (LPVOID pmem = GlobalLock(stm.hGlobal)) + { + memcpy(data, pmem, len); gotdata = true; - GlobalUnlock( stm.hGlobal ); + GlobalUnlock(stm.hGlobal); } } break; #ifndef __CYGWIN__ @@ -691,15 +689,12 @@ STDMETHODIMP CDropTarget::Drop( IDataObject* pDataObject, DWORD grfKeyState, POI } } break;//HBITMAP case TYMED_MFPICT:{ - METAFILEPICT*pMFP=(METAFILEPICT*)GlobalLock( stm.hMetaFilePict ); - if( pMFP ){ - try{ - memcpy( data, pMFP, sizeof(*pMFP) ); - GetMetaFileBitsEx( pMFP->hMF, len - sizeof(*pMFP), &data[sizeof(*pMFP)] ); - GlobalUnlock( stm.hMetaFilePict ); - gotdata = true; - } - catch(...){} + if (METAFILEPICT *pMFP = (METAFILEPICT *)GlobalLock(stm.hMetaFilePict)) + { + memcpy(data, pMFP, sizeof *pMFP); + GetMetaFileBitsEx( pMFP->hMF, len - sizeof(*pMFP), &data[sizeof(*pMFP)] ); + GlobalUnlock( stm.hMetaFilePict ); + gotdata = true; } } break;//HMETAFILE #ifndef __CYGWIN__ @@ -736,9 +731,9 @@ STDMETHODIMP CDropTarget::Drop( IDataObject* pDataObject, DWORD grfKeyState, POI len = *(DWORD*)data; DataToInsert += 4; } else if( fe.cfFormat == CF_TEXT || fe.cfFormat == CF_OEMTEXT ){ - try { len = strlen( (char*)data ); } catch(...){} + len = strlen( (char*)data ); } else if( fe.cfFormat == CF_UNICODETEXT ){ - try { len = sizeof(wchar_t)*wcslen( (wchar_t*)data ); } catch(...){} + len = sizeof(wchar_t)*wcslen( (wchar_t*)data ); } //Insert/overwrite data into DataArray diff --git a/Externals/heksedit/main.cpp b/Externals/heksedit/main.cpp index 7104e0bf8..a08641a3c 100644 --- a/Externals/heksedit/main.cpp +++ b/Externals/heksedit/main.cpp @@ -7,10 +7,22 @@ #include "toolbar.h" static const char szMainClass[] = "frhed wndclass"; -static const char szHexClass[] = "frhed hexclass"; +static const char szHexClassA[] = "hekseditA_" CURRENT_VERSION "." SUB_RELEASE_NO; +static const char szHexClassW[] = "hekseditW_" CURRENT_VERSION "." SUB_RELEASE_NO; HINSTANCE hMainInstance; -LRESULT CALLBACK MainWndProc (HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM); + +static BOOL NTAPI IsNT() +{ + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof osvi); + osvi.dwOSVersionInfoSize = sizeof osvi; + if (!GetVersionEx(&osvi)) + osvi.dwPlatformId = 0; + return osvi.dwPlatformId == VER_PLATFORM_WIN32_NT; +} + static BOOL CALLBACK WndEnumProcCountInstances(HWND hwnd, LPARAM lParam) { @@ -32,6 +44,7 @@ static HexEditorWindow *pHexWnd = 0; int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) { + OleInitialize(NULL); InitCommonControls(); hMainInstance = LoadLibrary("heksedit.dll"); @@ -41,7 +54,7 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) MSG msg; WNDCLASS wndclass; - Zero(wndclass); + ZeroMemory(&wndclass, sizeof wndclass); //Register the main window class wndclass.style = CS_HREDRAW | CS_VREDRAW; @@ -54,8 +67,6 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) RegisterClass(&wndclass); - OleInitialize(NULL); - int iInstCount = 0; EnumWindows(WndEnumProcCountInstances, (LPARAM)&iInstCount); @@ -85,7 +96,7 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) ShowWindow(hwndMain, pHexWnd->iWindowShowCmd); UpdateWindow(hwndMain); - if (szCmdLine != NULL && strlen(szCmdLine) != 0) + if (*szCmdLine != '\0') { // Command line not empty: open a file on startup. char *p = szCmdLine; @@ -126,7 +137,7 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) if (SUCCEEDED(hres)) { // Trying to open a link file: decision by user required. - int ret = MessageBox( hwndMain, + int ret = MessageBox(hwndMain, "You are trying to open a link file.\n" "Click on Yes if you want to open the file linked to,\n" "or click on No if you want to open the link file itself.\n" @@ -148,7 +159,8 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) { pHexWnd->load_file(szCmdLine); } - if (dwEnd) pHexWnd->CMD_setselection(dwStart, dwEnd); + if (dwEnd) + pHexWnd->CMD_setselection(dwStart, dwEnd); } while (GetMessage(&msg, NULL, 0, 0)) @@ -160,45 +172,55 @@ int WINAPI WinMain(HINSTANCE hIconInstance, HINSTANCE, char *szCmdLine, int) } } + FreeLibrary(hMainInstance); OleUninitialize(); - + _CrtDumpMemoryLeaks(); return msg.wParam; } //-------------------------------------------------------------------------------------------- // The main window procedure. -LRESULT CALLBACK MainWndProc( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) +LRESULT CALLBACK MainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { - switch (iMsg) { - case WM_CREATE: - hwndMain = hwnd; - DragAcceptFiles(hwnd, TRUE); // Accept files dragged into main window. - hwndToolBar = CreateTBar(hwnd, hMainInstance); - hwndHex = CreateWindowEx(WS_EX_CLIENTEDGE, szHexClass, 0, - WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, - 10, 10, 100, 100, hwnd, 0, hMainInstance, 0); - pHexWnd = (HexEditorWindow *)GetWindowLong(hwndHex, GWL_USERDATA); - hwndStatusBar = CreateStatusWindow( - CCS_BOTTOM | WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, - "Ready", hwnd, 2); - pHexWnd->hwndMain = hwnd; - pHexWnd->hwndToolBar = hwndToolBar; - pHexWnd->hwndStatusBar = hwndStatusBar; - pHexWnd->bSaveIni = TRUE; - pHexWnd->bCenterCaret = TRUE; - pHexWnd->set_wnd_title(); + switch (iMsg) + { + case WM_CREATE: + hwndMain = hwnd; + DragAcceptFiles(hwnd, TRUE); // Accept files dragged into main window. + hwndToolBar = CreateTBar(hwnd, hMainInstance); + hwndHex = CreateWindowEx(WS_EX_CLIENTEDGE, + IsNT() ? szHexClassW : szHexClassA, 0, + WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, + 10, 10, 100, 100, hwnd, 0, hMainInstance, 0); + pHexWnd = (HexEditorWindow *)GetWindowLong(hwndHex, GWL_USERDATA); + hwndStatusBar = CreateStatusWindow( + CCS_BOTTOM | WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, + "Ready", hwnd, 2); + pHexWnd->hwndMain = hwnd; + pHexWnd->hwndToolBar = hwndToolBar; + pHexWnd->hwndStatusBar = hwndStatusBar; + pHexWnd->bSaveIni = TRUE; + pHexWnd->bCenterCaret = TRUE; + pHexWnd->set_wnd_title(); + return 0; + case WM_COMMAND: + pHexWnd->command(LOWORD(wParam)); + break; + case WM_DROPFILES: + pHexWnd->dropfiles(reinterpret_cast(wParam)); + break; + case WM_SETFOCUS: + SetFocus(hwndHex); + break; + case WM_CLOSE: + if (!pHexWnd->close()) return 0; - case WM_COMMAND: return SendMessage(hwndHex, iMsg, wParam, lParam); - case WM_SETFOCUS: SetFocus(hwndHex); break; - case WM_CLOSE: - if (!pHexWnd->close()) - return 0; - break; - //return SendMessage(hwndHex, iMsg, wParam, lParam); - case WM_INITMENUPOPUP: pHexWnd->initmenupopup( wParam, lParam ); return 0; - case WM_DROPFILES: return SendMessage(hwndHex, iMsg, wParam, lParam); - - case WM_SIZE:{ + break; + case WM_INITMENUPOPUP: + pHexWnd->initmenupopup(wParam, lParam); + break; + case WM_SIZE: + { SendMessage(hwndStatusBar, WM_SIZE, 0 , 0); //Moves status bar back to the bottom SendMessage(hwndToolBar, WM_SIZE, 0 , 0); //Moves tool bar back to the top @@ -215,46 +237,35 @@ LRESULT CALLBACK MainWndProc( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam int iToolbarHeight = rect.bottom - rect.top; GetClientRect(hwndStatusBar, &rect); MoveWindow(hwndHex, 0, iToolbarHeight, LOWORD(lParam), HIWORD(lParam)-rect.bottom-iToolbarHeight, TRUE); - break; } - - case WM_NOTIFY:{ - //See if someone sent us invalid data - HWND h; - UINT code; - try{ - //Attempt to dereference - NMHDR& pn = *(NMHDR*)lParam; - h = pn.hwndFrom; - code = pn.code; - } - catch(...){ return 0; } - - if (h == hwndStatusBar) + break; + case WM_NOTIFY: + { + NMHDR *pn = (NMHDR *)lParam; + HWND hwndFrom = pn->hwndFrom; + UINT code = pn->code; + if (hwndFrom == hwndStatusBar) { - if(code == NM_CLICK || code == NM_RCLICK) + if (code == NM_CLICK || code == NM_RCLICK) pHexWnd->status_bar_click(code == NM_CLICK); } - else if (h == hwndToolBar) + else if (hwndFrom == hwndToolBar) { - if (code == TBN_GETINFOTIPA || code == TBN_GETINFOTIPW) + if (code == TBN_GETINFOTIPA) { - try{ - if(code == TBN_GETINFOTIPA){ - NMTBGETINFOTIPA& pi = *(NMTBGETINFOTIPA*) lParam; - LoadStringA(hMainInstance,pi.iItem,pi.pszText,pi.cchTextMax); - } else { - NMTBGETINFOTIPW& pi = *(NMTBGETINFOTIPW*) lParam; - LoadStringW(hMainInstance,pi.iItem,pi.pszText,pi.cchTextMax); - } - } - catch(...){} + NMTBGETINFOTIPA *pi = (NMTBGETINFOTIPA *)lParam; + LoadStringA(hMainInstance, pi->iItem, pi->pszText, pi->cchTextMax); + } + else if (code == TBN_GETINFOTIPW) + { + NMTBGETINFOTIPW *pi = (NMTBGETINFOTIPW *)lParam; + LoadStringW(hMainInstance, pi->iItem, pi->pszText, pi->cchTextMax); } } } - return 0; - - case WM_DESTROY: { + break; + case WM_DESTROY: + { // Store window position for next startup. WINDOWPLACEMENT wndpl; wndpl.length = sizeof(WINDOWPLACEMENT); @@ -268,21 +279,7 @@ LRESULT CALLBACK MainWndProc( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam DragAcceptFiles(hwndMain, FALSE); PostQuitMessage(0); } - return 0; - + break; } return DefWindowProc(hwnd, iMsg, wParam, lParam ); } - -// The hex window procedure. -/*LRESULT CALLBACK HexWndProc( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) -{ - if (iMsg == WM_NCCREATE) - SetWindowLong(hwnd, GWL_USERDATA, (LONG)new HexEditorWindow); - HexEditorWindow *pHexWnd = (HexEditorWindow *)GetWindowLong(hwnd, GWL_USERDATA); - LRESULT lResult = pHexWnd->OnWndMsg( hwnd, iMsg, wParam, lParam ); - if (iMsg == WM_NCDESTROY) - delete pHexWnd; - return lResult; -}*/ -//============================================================================================ diff --git a/Externals/heksedit/precomp.h b/Externals/heksedit/precomp.h index 2d90638c6..99791f7e4 100644 --- a/Externals/heksedit/precomp.h +++ b/Externals/heksedit/precomp.h @@ -1,5 +1,9 @@ #define _WIN32_WINNT 0x0501 #include +#include +#include +#include +#include #include #include #include @@ -7,8 +11,7 @@ #include #include #include -#include +#include #include #include #include "gtools.h" -#define Zero(a) memset(&(a),0,sizeof(a)) diff --git a/Externals/heksedit/res/Toolbar.bmp b/Externals/heksedit/res/Toolbar.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2285caea1b8ea22a0c77802074403e804957f8c0 GIT binary patch literal 1782 zcmc(eJ#O1T5QR68kS$m+s#Lm78Nex21_1$9L9Vg_h)m&z0COO9D%|J@ISLIBX_;@{ zlCmjCcB*8w-2a_7@6G7zx8LuB><9fvzF&MF_}+yzeF*JzuEnBjIb@@4^FYruoK7c3 zKN!`*IQoo_pKsCG|1#phqFHqrK~rHV5E|WnvoTZ0>hk8bHE%FekN0%%t5vkd>ZaBM z`RBqK{zK{=rw{ul$MMdJ1Ml9n#OtxQaF2aj;?#{^H}b#ReIBanHjXq9V8YAX@+b{5 zPPuZRxZpG6^dStX>wXFkx-J2dZTusWB=3$h&CHzhwDj=>PLVPp=@!tc{5X!M)zjq}n}$64dg61;gaqfr%<8Jv@qpWj&oF=!C!FmiP7;oi z?Kn|ujn6p61CbL`<|CXhz0D#K~%l&-Xg*WF)l@s%>gImvu;wgb#k!iHWycx|K&) zZNVps6nw_9veY?`PQ@c#_Nq4?9HI#M>m1qbIso5GgrMTHZYla!>dSRSL8P4r;oa;H z&0IEcXyWr`U6&rYTbgjhObH@CI!#@BC|2+>mfE@78qHAc%*W*C{3p!`=8ANr4#dT{ z6(<~*EX_FiG~mwfU-GfyQTg#OUo*fYD|hnW%k%Jp&-ql@z2XT6vm94W|Mk`%tJ;gM literal 0 HcmV?d00001 diff --git a/Externals/heksedit/res/icon1.ico b/Externals/heksedit/res/icon1.ico new file mode 100644 index 0000000000000000000000000000000000000000..35a6307fe4ce67f2b6753e33ad422aae6ffac58a GIT binary patch literal 1078 zcmdT@J5B>J5PfTq=*V`Vi!}v`wnCz$2uI--6e-vnMv4Ti6R3wN<5ei~> zv)&cRN=cJhkKg<}UR%#V0SE6(n7lgRl313>pBBLR2{2{MQ*WsSPB~Lpdsu3K19hE% zGfgy2L$ri;1FB|G`B})O;}_nF7xBKkFCM4zF2opu3+Zg;2a#W&b`VsR@AE8(Tc!lak&W@e|lw1FJLs_lQR!g6}<7i(7s* IVf_sF0W$Z^cmMzZ literal 0 HcmV?d00001 diff --git a/Externals/heksedit/resource.h b/Externals/heksedit/resource.h index 9f2ab8288..2045f5364 100644 --- a/Externals/heksedit/resource.h +++ b/Externals/heksedit/resource.h @@ -1,5 +1,5 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. +// Microsoft Visual C++ generated include file. // Used by heksedit.rc // #define IDC_UP 100 @@ -85,7 +85,6 @@ #define IDC_STATIC4 169 #define IDC_BUTTON1 170 #define IDC_FINDNEXT_BUTTON 171 -#define IDC_ST_VERSION 171 #define IDC_TYPE 172 #define IDC_FINDPREVIOUS_BUTTON 173 #define IDC_BROWSE 174 @@ -244,6 +243,7 @@ #define IDC_TEXT_DISPLAY 1079 #define IDC_ENABLE_DROP 1080 #define IDC_EXPORTDIGITS 1081 +#define IDC_APPICON 1082 #define IDM_OLE_DRAG_DROP 40142 // Next default values for new objects @@ -253,7 +253,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 145 #define _APS_NEXT_COMMAND_VALUE 40143 -#define _APS_NEXT_CONTROL_VALUE 1082 +#define _APS_NEXT_CONTROL_VALUE 1083 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Externals/heksedit/shtools.cpp b/Externals/heksedit/shtools.cpp index 3661f0f37..99cdf5133 100644 --- a/Externals/heksedit/shtools.cpp +++ b/Externals/heksedit/shtools.cpp @@ -1,5 +1,4 @@ #include "precomp.h" -#include #include "shtools.h" /*Pabs inserted func Create link files for registry menu diff --git a/Externals/heksedit/toolbar.cpp b/Externals/heksedit/toolbar.cpp index 7b36873d2..5c89d44f7 100644 --- a/Externals/heksedit/toolbar.cpp +++ b/Externals/heksedit/toolbar.cpp @@ -28,23 +28,6 @@ TBBUTTON tbButtons[] = // Array defining the toolbar buttons { 12, ID_DISK_GOTOLASTTRACK, 0, TBSTYLE_BUTTON, 0, 0 } }; -/*LRESULT HexEditorWindow::SetTooltipText(LPTOOLTIPTEXT lpToolTipText) -{ - UNREFERENCED_PARAMETER( hWnd ); - static char szBuffer[64]; - if ((lpToolTipText->hdr.code == TTN_NEEDTEXTA) || - (lpToolTipText->hdr.code == TTN_NEEDTEXTW)) - { - LoadString(hMainInstance, - lpToolTipText->hdr.idFrom, // string ID == command ID - szBuffer, - sizeof(szBuffer)); - - lpToolTipText->lpszText = szBuffer; - } - return 0; -}*/ - HWND CreateTBar(HWND hWnd, HINSTANCE hInst) { HWND hwndToolBar = CreateToolbarEx(hWnd, diff --git a/Externals/heksedit/version.h b/Externals/heksedit/version.h index 63dcf0560..10e35cdd1 100644 --- a/Externals/heksedit/version.h +++ b/Externals/heksedit/version.h @@ -1,2 +1,3 @@ -#define CURRENT_VERSION "1.1" -#define SUB_RELEASE_NO "0" +#define FRHED_MAJOR_VERSION 1 +#define FRHED_MINOR_VERSION 2 +#define FRHED_SUB_RELEASE_NO 1 diff --git a/Externals/heksedit/version.rc b/Externals/heksedit/version.rc new file mode 100644 index 000000000..74877484f --- /dev/null +++ b/Externals/heksedit/version.rc @@ -0,0 +1,45 @@ +#include "version.h" + +#define SHARPEN_A(X) #X +#define SHARPEN_W(X) L#X +#define SHARPEN(T,X) SHARPEN_##T(X) + +#define CURRENT_VERSION SHARPEN(A,FRHED_MAJOR_VERSION) "." SHARPEN(A,FRHED_MINOR_VERSION) +#define SUB_RELEASE_NO SHARPEN(A,FRHED_SUB_RELEASE_NO) + +VS_VERSION_INFO VERSIONINFO + FILEVERSION FRHED_MAJOR_VERSION,FRHED_MINOR_VERSION,FRHED_SUB_RELEASE_NO,0 + PRODUCTVERSION FRHED_MAJOR_VERSION,FRHED_MINOR_VERSION,FRHED_SUB_RELEASE_NO,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "Homepage: http://www.kibria.de, http://zip.to/pabs3\0" + VALUE "CompanyName", "(c) Raihan Kibria 2000\0" + VALUE "FileDescription", "frhed - free hex editor " CURRENT_VERSION "." SUB_RELEASE_NO + VALUE "FileVersion", CURRENT_VERSION "." SUB_RELEASE_NO + VALUE "InternalName", "frhed\0" + VALUE "LegalCopyright", "GNU General Public License v2.0\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "frhed.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "frhed\0" + VALUE "ProductVersion", CURRENT_VERSION "." SUB_RELEASE_NO + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END -- 2.11.0