Jump to content

EugeneK

Members
  • Content Count

    107
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by EugeneK


  1. 3 hours ago, dwrbudr said:
    
    function Detour_UuidCreate(out guid: TGUID): Longint; stdcall;
    begin
        guid := Default(TGUID);
        Result := 0;
    end;
    
    procedure TForm68.Button1Click(Sender: TObject);
    var myguid: TGUID;
    begin
        InterceptCreate('rpcrt4.dll', 'UuidCreate', @Detour_UuidCreate);
        CreateGUID(myguid);
    end;

     

    So the above code does not work?

    On my side it works if I put a breakpoint in Detour_UuidCreate

    Thanks! I did not know that you can use this form of InterceptCreate


  2. 7 hours ago, Vincent Parrett said:

    Intercepting functions for unit testing is a terrible idea. A better option would be to create abstractions and a concrete implementation (ie actually calls UuidCreate), that abstraction can be easily mocked using Delphi Mocks or Spring4D for uinit tests. The same applies to code that relies on things like Now or NowUTC - e.g - https://github.com/VSoftTechnologies/VSoft.System.TimeProvider 

     

     

    I mostly use abstractions, but using abstractions for Now feels like an overkill, that's the only one I use DDetours for so far. Also until Spring4d uses namespaces I'm not using it.


  3. I'm using DDetours to intercept Windows functions for unit testing purposes, but don't know how to intercept UuidCreate function because its declaration is hidden in implementation section of System.SysUtils unit. Is there a way to do it?


  4. 16 hours ago, fastbike said:

    HI, did you get anything to work - I'm looking at using Azure Relay to expose some functionality on our network to another Azure service.

    No, I'm trying to reverse engineer it. It uses AMQP 1.0 over WebSockets


  5. Yes getIt was down, it hanged IDE when I tried to open it, I killed IDE from taskmanager and it somehow completely deleted my license, so now I can't use IDE at all, and can't login to the portal to get my license number.


  6. I think more consistent with Embarcadero style will be following, since there could be multiple consts/types/vars

     

      TClass = class(TObject)
      private
        FSomeField: integer;
      private
        const
          SomeConstant = 5;
          SomeOtherConstant = 6;
      private
        type
          SomeType = integer;
          SomeOtheType = string;
      private
        class var
          SomeClassVar: integer;
          SomeOtherClassVar: string;
      end;

     

    • Like 1

  7. 10 hours ago, Remy Lebeau said:

    This is actually as designed, managed records (including records with strings) cannot be use for generics restricted to records (where record is in fact traditional memory managed records). It's a restriction from the past, done to avoid bugs

    But this is simply not true because managed records can be used for generics restricted to records in 12.2 and before. I had a lot of code broken because of this change that worked perfectly fine.


  8. Happens when record field has an attribute

    unit UTestGenericsBug;
    
    interface
    
    uses
      System.Rtti,
      Data.DB;
    
    type
      DBField = class(TCustomAttribute)
      strict private
        FFieldType: TFieldType;
        FLength: Integer;
      public
        constructor Create(const AFieldType: TFieldType = ftUnknown; const ALength: Integer = 0);
        property FieldType: TFieldType read FFieldType;
        property Length: Integer read FLength;
      end;
    
      TTestRecord = record
      private
        [DBField(ftString, 20)]
        FTerminalName: string;
      public
      end;
    
      TRecordLoader<T: record> = class sealed
        class function Get: T; static;
      end;
    
    implementation
    
    constructor DBField.Create(const AFieldType: TFieldType = ftUnknown; const ALength: Integer = 0);
    begin
    
    end;
    
    class function TRecordLoader<T>.Get: T;
    begin
      Result := Default(T);
    end;
    
    function Get: TTestRecord;
    begin
      // error here
      Result := TRecordLoader<TTestRecord>.Get;
    end;
    
    end.

    😒


  9. 15 minutes ago, Angus Robertson said:

    What is the benefit of keeping the internal TLS keys?  Wireshark?

     

    Yes, for Wireshark, in next release OpenSSL adds logging directly in the library, but you need to configure it at build time, with these callbacks you can log it with regular build


  10. 3 hours ago, Kazantsev Alexey said:

    Press [Update Local File Cache] in SDK Manager after libgtk-3-dev installed.

    Thank you! that was the problem.


  11. 9 hours ago, havrlisan said:

    Have you installed the gtk library on the linux machine?
     

    
    sudo apt-get install libgtk-3-dev

     

    Yes, but it fails during build, not when deploying, so I don't think it matters. It have to be somewhere on Windows machine


  12. Hi

     

    I'm trying to use FmxLinux in Delphi 12.2 and deploying to WSL, all samples work apart from GtkWindow, it has following code

    procedure gtk_window_set_title(window: Pointer; title: PUtf8Char); cdecl; external 'libgtk-3.so.0';
    
    function gtk_widget_get_window(widget: Pointer): Pointer; cdecl; external 'libgtk-3.so.0';
    procedure gdk_window_process_updates(window: Pointer; update_children: Boolean); cdecl; external 'libgdk-3.so.0';

    and fails with this error when building

    [DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\23.0\bin\ld-linux.exe: error: cannot find -lgdk-3
      C:\Program Files (x86)\Embarcadero\Studio\23.0\bin\ld-linux.exe: error: cannot find -lgtk-3
      

    How can I make Delphi find these libraries?

×