Lazarus

Programming => Packages and Libraries => Lazarus Extra Components => Topic started by: crisares on August 11, 2019, 08:13:41 pm

Title: Hexadecimal Editor
Post by: crisares 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
Title: Re: Hexadecimal Editor
Post by: wp 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;  
Title: Re: Hexadecimal Editor
Post by: sstvmaster 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
Title: Re: Hexadecimal Editor
Post by: simone 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. 
Title: Re: Hexadecimal Editor
Post by: wp 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".
Title: Re: Hexadecimal Editor
Post by: crisares 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
Title: Re: Hexadecimal Editor
Post by: simone 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.
Title: Re: Hexadecimal Editor
Post by: wp 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.
Title: Re: Hexadecimal Editor
Post by: crisares 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
Title: Re: Hexadecimal Editor
Post by: crisares 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
Title: Re: Hexadecimal Editor
Post by: korba812 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.
Title: Re: Hexadecimal Editor
Post by: wp 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.  

Title: Re: Hexadecimal Editor
Post by: simone 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.
Title: Re: Hexadecimal Editor
Post by: korba812 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!
Title: Re: Hexadecimal Editor
Post by: wp 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)
Title: Re: Hexadecimal Editor
Post by: PascalDragon on August 15, 2019, 12:01:49 pm
You're looking for this (https://bugs.freepascal.org/view.php?id=34758) one.
TinyPortal © 2005-2018