Recent

Author Topic: Hexadecimal Editor  (Read 7603 times)

crisares

  • Jr. Member
  • **
  • Posts: 63
Hexadecimal Editor
« on: August 11, 2019, 08:13:41 pm »
Hello everyone!  could someone help me add a tmphexeditor library to lazarus so that I can have an object to view and edit hexadecimal files?  thank you

hola a todos! alguien me podria ayudar a agregar a lazarus alguna libreria tipo tmphexeditor para poder tener un objeto donde visualizar y editar archivos hexadecimales? muchas gracias

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Hexadecimal Editor
« Reply #1 on: August 11, 2019, 10:31:36 pm »
Very interesting. Looks very good, my first impression is that it is better than the KHexEditor which I used so far.

The download site is https://github.com/michalgw/mphexeditor. If you know git you know how to clone the repository, if you don't you can download a snapshot by means of the green "Clone or download" button, then "Download zip".

In order to install go to "Packages" > "Install/Uninstall packages", navigate to the folder which contains the MPHexEditor sources and load the file src/mphexeditorlaz.lpk. Click "Compile". Probably there is a compilation error because function "RenameFileUTF8" is not found in unit mphexeditorex.pas. Add unit "LazFileUtils" to the uses clause of unit mphexeditorex. Compile again - it should work now. Then click "Use" > "Install", confirm to rebuild the IDE. Recompilation of the IDE will take some time. When Lazarus restarts you find the two components, MPHexEditor and MPHexEditorEx, in the component palette under "MPHexEditor". I don't know what the "Ex" is good for (it does look rather Windows-centric although there is a conditional directive for compilation on Windows.)

For testing, I added a TMPHexEditor to a new project's main form and had it load the exe file in the OnCreate event of the form:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   MPHexEditor1.LoadFromFile('project1.exe');
  4. end;  

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: Hexadecimal Editor
« Reply #2 on: August 12, 2019, 12:04:13 am »
I don't know what the "Ex" is good for (it does look rather Windows-centric although there is a conditional directive for compilation on Windows.)

Look at hexeditor.html (trunk directory)

Quote
TMPHexEditor is a TCustomGrid descendant to view and edit binary files in hexadecimal and textual format.

TMPHexEditorEx is an advanced hex editor, is supports OLE drag and drop, printing, print preview and more.

Maik
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Hexadecimal Editor
« Reply #3 on: August 12, 2019, 12:27:08 am »
The installation of component fails with the following compiler error:

mphexeditorex.pas(1559,12) Error: Identifier not found "RenameFileUTF8"

In order to fix this error, in the interface uses clause of mphexeditorex.pas unit, FileUtil must be replaced with LazFileUtils. 
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Hexadecimal Editor
« Reply #4 on: August 12, 2019, 11:10:44 am »
[...] there is a compilation error because function "RenameFileUTF8" is not found in unit mphexeditorex.pas. Add unit "LazFileUtils" to the uses clause of unit mphexeditorex.
The author has accepted and applied my merge request to fix the compilation issue. Now the package should compile correctly "out of the box".
« Last Edit: August 12, 2019, 03:20:59 pm by wp »

crisares

  • Jr. Member
  • **
  • Posts: 63
Re: Hexadecimal Editor
« Reply #5 on: August 13, 2019, 08:51:58 pm »
[...] there is a compilation error because function "RenameFileUTF8" is not found in unit mphexeditorex.pas. Add unit "LazFileUtils" to the uses clause of unit mphexeditorex.
The author has accepted and applied my merge request to fix the compilation issue. Now the package should compile correctly "out of the box".

Hi, the error still exists ...  (mphexeditorex.pas (1559.12) Error: Identifier not found "RenameFileUTF8")
And I can't understand how to solve it
If someone can help me by step I am very grateful

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Hexadecimal Editor
« Reply #6 on: August 13, 2019, 09:06:53 pm »
Have you tried to apply the fix I proposed? In this way I solved the compilation problem.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Hexadecimal Editor
« Reply #7 on: August 13, 2019, 09:11:53 pm »
Or download the package from the author's site again (https://github.com/michalgw/mphexeditor), the error should be fixed now.

crisares

  • Jr. Member
  • **
  • Posts: 63
Re: Hexadecimal Editor
« Reply #8 on: August 13, 2019, 09:45:55 pm »
Have you tried to apply the fix I proposed? In this way I solved the compilation problem.

thank you very much ... I made the mistake of not adding the final S just add Laz at the beginning

crisares

  • Jr. Member
  • **
  • Posts: 63
Re: Hexadecimal Editor
« Reply #9 on: August 13, 2019, 09:47:15 pm »
Or download the package from the author's site again (https://github.com/michalgw/mphexeditor), the error should be fixed now.

the package I was installing was downloaded 2 hours ago, apparently the error is still not fixed

korba812

  • Sr. Member
  • ****
  • Posts: 391
Re: Hexadecimal Editor
« Reply #10 on: August 13, 2019, 10:28:03 pm »
There was one more problem with compiling under windows. I just fixed. Can you check if it works? Be careful. This port is about 50% ready and still requires a lot of work and probably contains a lot of bugs.

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Hexadecimal Editor
« Reply #11 on: August 13, 2019, 11:02:06 pm »
This patch is not good, it works only with FPC trunk or 3.2, but not with 3.0.4 used by the Lazarus release versions. The point is that the older versions still require the "const", but fpc 3.2+ require the "var". I had the same issue with VirtualTreeView...

Code: Pascal  [Select][+][-]
  1. // line 899 (and in the implementation):
  2.     function SetData(const FormatEtc: TFormatEtc;
  3.       {$IF FPC_FullVersion >= 30200}var{$ELSE}const{$IFEND} Medium: TStgMedium;
  4.       FRelease: BOOL): HResult; stdcall;
  5.  


simone

  • Hero Member
  • *****
  • Posts: 573
Re: Hexadecimal Editor
« Reply #12 on: August 14, 2019, 08:53:30 am »
Just for curiosity: What change in the next major release of compiler cause such a break  in backward compatibiity? I'm a little worried for my code base.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

korba812

  • Sr. Member
  • ****
  • Posts: 391
Re: Hexadecimal Editor
« Reply #13 on: August 14, 2019, 10:10:34 am »
This patch is not good, it works only with FPC trunk or 3.2, but not with 3.0.4 used by the Lazarus release versions. The point is that the older versions still require the "const", but fpc 3.2+ require the "var".
Fixed.  Thanks!

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Hexadecimal Editor
« Reply #14 on: August 14, 2019, 10:38:35 am »
Just for curiosity: What change in the next major release of compiler cause such a break  in backward compatibiity? I'm a little worried for my code base.
I can't find a reference for it any more, maybe it was a bug report, I think assigned to marcov. It was exactly this function declared in unit ActiveX where the "const" was replaced by a "var" for Delphi compatibility. If your code uses ActiveX/OLE etc you should test whether it compiles with FPC-trunk (or with still unreleased FPC 3.2)

 

TinyPortal © 2005-2018