Jump to content

TurboMagic

Members
  • Content Count

    235
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by TurboMagic


  1. Hello,

     

    I've written a small unit for easily adding and removing IDE/Tools menu entries.

    It can also check if there's already some entry for a given executable.

     

    It is open source and can be found here along with a small console application demoing the functionality.

     

    https://github.com/MHumm/AddIDETool

     

    Remember: you need to restart the IDE for the settings changes to become effect.

     

    Now enjoy it 😉

    TurboMagic

    • Like 2

  2. Good news,

     

    I just released version 6.3 of the Delphi Encryption Compendium cryptography library.

    You can fin it here:

     

    https://github.com/MHumm/DelphiEncryptionCompendium/releases/tag/V6.3"]https://github.com/MHumm/DelphiEncryptionCompendium/releases/tag/V6.3

     

    What's new?

     

    • Implemented some bugfixes
    • Added Shake128/256 extensible output hash algorithm implementations
    • Made the 32 bit asm implementations of the MD2, SHA384, Tiger, Snefru128 and Snefru256 hash algorithms compile again and they are used now
      as default for Win32 Delphi projects. In some cases this might double the speed of the hash calculation.

     

    Further details about the changes are found in the VersionHistory.pdf file in Docs subfolder.

     

    The GetIt Lite version should be released within the next few days.

     

    Enjoy


    TurboMagic

    • Like 1
    • Thanks 1

  3. While further working on Delphi Encryption Compendium I stumbled over the freeing mechanism for the class registration mechanism.

    Digging into the history I read something about AddModuleUnloadProc being used in context of packages, which I didn't use yet,

    but I'm not sure why a simple TDECHash.ClassList.Free; should not be sufficient. So any ideas why this is in?

     

    I'm asking, because in that ModuleUnload procedure C++ Builder crashes with "List item not found".
    So if removing that ModuleUnload completely without causing any negative side effects, it might improve C++ Builder compatibility.

     

    nit DECHashBase;
    
    [..]
    
    procedure ModuleUnload(Instance: NativeInt);
    var // automaticaly deregistration/releasing
      i: Integer;
    begin
      if TDECHash.ClassList <> nil then
      begin
        for i := TDECHash.ClassList.Count - 1 downto 0 do
        begin
          if NativeInt(FindClassHInstance(TClass(TDECHash.ClassList[i]))) = Instance then
            TDECHash.ClassList.Remove(TDECHash.ClassList[i].Identity);
        end;
      end;
    end;
    
    initialization
      AddModuleUnloadProc(ModuleUnload);
    
      TDECHash.ClassList := TDECClassList.Create;
    
    finalization
      RemoveModuleUnloadProc(ModuleUnload);
    
      TDECHash.ClassList.Free;
    end. 

     


  4. In order to test something, I'd need to have the Hash_Console Demo console application from

    https://github.com/MHumm/DelphiEncryptionCompendium (DEC) translated to C++ Builder.

     

    Why do I need this?

    In DECOptions.inc there are some switches which would enable 32 bit asm optimized variants of

    some hash algorithms. The previous developers left a comment there that those are commented out
    due to some C++ Builder issue. Now if I could check whether this issue still persists and if yes, whether
    I can selectively disable them via some define, I could improve the library's performance at least

    for Delphi users and if the issue no longer persists maybe even for C++ Builder users.


  5. 16 hours ago, Dany Marmur said:

    Excuse my stressed question (i do not have the time to...) what is the difference between this (OT) and DelphiAST?

     

    TIA,

     

    /Dany

    My variant generates the hierarchy via RTTI (I don't know how DelphiAST works) and it only considers classes and it can render the tree into
    textual form (if you use a font containing the needed glyphs). See the GitHub project page, I added two screenshots now.


  6. 19 hours ago, corneliusdavid said:

    Nice, that works pretty well.

     

    (You accidentally listed the URL twice so you might want to edit your post and correct it.)

     

    Why did you include the DelphiEncryptionCompendium units? Was that just to test? They aren't really needed for the functionality of the app.

     

    It'd be cool if there was a search button so you could quickly find a specific class in the huge generated list.

    Thanks!

     

    I fixed the link. I also had thought I had removed the DEC units...! Grr!
    I wrote this tool because I needed it for generating some tree for DEC's documentation.

     

    If you like to have a search facility you may add this and either create a pull request or contact me otherwise to submit your improvement... 😉


  7. This is the info that I just released a bugfix version 6.2.1 here:

    https://github.com/MHumm/DelphiEncryptionCompendium/releases/tag/V6.2.1

     

    What was fixed?

    • fixes bugs preventing use of the demos on older versions, demos have been tested with XE8 Win32 and newer.
    • fixes a bug introduced by Git in a deployproj file of a demo making it non-loadable completely.

     

    GetIt submission has already been sent...


  8. Hello,

     

    good news is, that I just released a new version of DEC  (Delphi Encryption Compendium):

    inlink.gifhttps://github.com/MHumm/DelphiEncry...eases/tag/V6.2


    What's new?

    • Fixed some regressions, among them some which hindered compilation with older Delphi versions (support for older compilers might be reduced in future versions!)
    • Fixed bugs in the SCOP and SHARK cipher algorithms
    • The unit test for the hash classes got improved by adding original test vectors to those algorithms which didn't already use original test vectors and where we could find those (for most we could)
    • The SHA3 hash algorithm has been added for 224, 256, 384 and 512 bit including support for message lengths not being a multiple of whole bytes. Our implementation uses Eric Grange's
      optimizes permutation kernel ASM implementation on WIn32 and WIn64 (with his friendly permission of course!)
    • A new demo got added: Hash Benchmark FMX


    Now have fun with this. The GetIt provided Lite version should follow within the next few days.

     

    TurboMagic

    • Like 8
    • Thanks 4

  9. Thanks for the answer.
    I changed it to use Move now like this:

    Move(ResStr[1], CalcRes[0], Length(ResStr));

     

    In my Delphi test application it works flawlessly, but the LabView application calling the DLL still crashes it.
    Access violation at address 184E140E ... Read of address 00000003

     

    I will try to log the address of the PChar passed in now and if possible it's contents at that time, but
    I don't know how to read raw RAM for getting a bit more loginfo...


  10. I'm writing a DLL which shall be called by LabView (among other environments).

    Calling a simple function which gets 2 numbers, adds them and returns the result works.
    That one uses calling convention cdecl, as specified by the "client".

     

    But strings are a problem. For getting this tested I developed the following simple function,

    which shall be called by a LabView test application but this always crashes inside the DLL.

    Currently it crashes here: "Exception beim Stringrückliefern", if I make a var parameter out
    of CalcRes it immediately crashes here: "Exception in Berechnung".

     

    What might cause this? The caller shall pass a string which a number of chars allocated for

    and the number of chars he allocated the string for + the #0 terminator in CalcResSize.

    If the result fits in that, it is returned in the string. CalcResSize will represent the number of

    bytes needed for the string including the #0 after the call so if the caller didn't pass a long
    enough string he can call the function again using a longer string.

     

    Here's the code:

     

    uses
      System.SysUtils,
      System.AnsiStrings;
    
    function Add(Number1, Number2: UInt8; CalcRes: PAnsiChar; var CalcResSize: UInt8): UInt16; cdecl;
    var
      Res    : UInt16;
      ResStr : AnsiString;
    begin
      try
        Res    := Number1 + Number2;
        ResStr := AnsiString(Res.ToString);
      except
        On E:Exception do
        begin
          OutputDebugString(PWideChar('Exception in Berechnung: ' + E.Message));
          Result := 2;
          Exit;
        end;
      end;
    
      try
        if Assigned(CalcRes) and ((Length(ResStr) {* SizeOf(Char)} + 1) <= CalcResSize) then
        begin
          System.AnsiStrings.StrPLCopy(CalcRes, ResStr, CalcResSize);
          Result := 0;
        end
        else
          Result := 1;
      except
        On E:Exception do
        begin
          OutputDebugString(PWideChar('Exception beim Stringrückliefern: ' + E.Message + ' / ' +
                            madExcept.GetCrashStackTrace));
          Result := 2;
          Exit;
        end;
      end;
    
      try
        CalcResSize := (Length(ResStr) {* SizeOf(Char)} + 1);
      except
        On E:Exception do
        begin
          OutputDebugString(PWideChar('Exception in CalcResSize Berechnung: ' + E.Message + ' / ' +
                            madExcept.GetCrashStackTrace));
          Result := 2;
          Exit;
        end;
      end;
    end;

     

    Cheers

     

    TurboMagic


  11. Setting UsePNGAlpha and transparency in the PDF settings do the trick for PDF output, but for preview and print output this
    (this = using a PNG image with partial transparent contents) still fails. The watermark image is put into the background and
    then overlapped with everything else.


  12. Thanks in the first place.
     

    1. I do think that image transparent was set to false as I used a PNG. It looked good in designer but not in preview or PDF. I need to check where I can set transparency to true in PDF exportfilter.
        In my case it had simply put the image behind everything else in preview and PDF.

     

    2. About the OverlayBand: I see references to that and find it in designer, but I don't know how it works. I didn't manage to get it working and I didn't find any documentation for this.
        Can you give me more information about what to do with this?


  13. I'm using the Embarcadero FR 6 version in D10.4.2 and want to add a watermark.

     

    Which way looks properly?

     

    I already tried to place a image on top. It contained the text in semi transparent. Image format was PNG.
    It looked ok in designer but at runtime in preview an PDF output everything else was put in front of it!
    Even when I had put these other items into the background in designer!

     

    The other solution found was adding a frxMemo in EndDoc event. It sourt of works but doesn't cut it either.
    I could neither find any way to put it the background as all (but then most likely the TCharts would be placed
    on top in such a fashion that they'd cover my watermark) nor did I see any way to make the text semi transparent.

     

    I read about using an OverlayBand, but no description of how to properly use that. Drop in on the page in
    designer and add a memo with my text to it? Where does it render when? How to make it covering the other things
    but in a semi transparent way?


  14. I just found a little bit of time now and made a new attempt.
    I record what's happening using Wireshark now and that clearly shows that my device receives my message and it sends something back to the local port my socket got assigned by Windows.

    But my application never receives anything.

     

    I used the UDPSend example as starting point. I initially had tried out this 2 sockets solution but since it didn't work I changed it. I added a new socket and dont use the other one at the moment.

    Here's the relevant code part:

     

    procedure TMainForm.SendButtonClick(Sender: TObject);
    begin
      WSocketReceive.Proto      := 'udp';
      WSocketReceive.SocketFamily := sfIPv4;
      WSocketReceive.Port      := '0';
      WSocketReceive.Addr      := '0.0.0.0';
      WSocketReceive.Listen;
    
      MemoReceive.Lines.Add('Local Port: ' + WSocket.LocalPort);
    end;
    
    procedure TMainForm.WSocketReceiveDataAvailable(Sender: TObject; ErrCode: Word);
    begin
     // This is never called!!!
     MemoReceive.Lines.Add(TimeToStr(Now) + ' ' + WSocketReceive.ReceiveStr);
    end;
    
    procedure TMainForm.WSocketReceiveSessionConnected(Sender: TObject;
      ErrCode: Word);
    var
      Src : TSockAddr;
      Str : RawByteString;
    begin
      Src.sin_family := SOCK_DGRAM;
      Src.sin_port   := 8513;
      // I don't know how to write this one less cumbersome:
      Src.sin_addr.S_un_b.s_b1 := #255;
      Src.sin_addr.S_un_b.s_b1 := #255;
      Src.sin_addr.S_un_b.s_b1 := #255;
      Src.sin_addr.S_un_b.s_b1 := #255;
    
      // This gets sent:
      WSocketReceive.SendTo(Src, SizeOf(Src), BytesOf(Str), Length(Str));
    end;
    
    procedure TMainForm.WSocketSessionAvailable(Sender: TObject; ErrCode: Word);
    begin
      // This is never called
      MemoReceive.Lines.Add('Port: ' + WSocketReceive.Port);
    end;

    As you can see I added a memo for output. But the only thing ever shown in it is the 'Local port' message posted directly after Listen.

     

    What am I'm doing wrong?

×