Jump to content

Remy Lebeau

Members
  • Content Count

    2981
  • Joined

  • Last visited

  • Days Won

    134

Posts posted by Remy Lebeau


  1. 6 hours ago, BuilderFox said:

    Unfortunately I have a lot of problems.

    What kind of problems, exactly?

    6 hours ago, BuilderFox said:

    The old projects compiles on my old Windows 7 PC (yep!) without any errors. I suspect that the new compilers are less tolerant.

    Less tolerant of what?

    6 hours ago, BuilderFox said:

    Which compiler versions (for C++Builder AND Delphi, Delphi because I use a lot of 3rd-party components) can I use/select.

    I don't understand the question.

    6 hours ago, BuilderFox said:

    And where in the settings? Especially the "old" ones!

    Huh?


  2. 1 hour ago, DelphiUdIT said:

    EDIT, try this old thing: set the PassThrough of SSLIOHandler to false.

     

    After setting the ChiperList inserto this line:

    
      IdSSLIOHandlerSocketOpenSSL1.PassThrough := false;

     

    That should have no effect on TIdHTTP, as it internally toggles the PassThrough property based on whether an HTTP or HTTPS url is being requested.


  3. 3 hours ago, Del Murray said:

    I'm very puzzled about the reference to SSL3_get error  

    In OpenSSL, SSL 3.0 and TLS 1.x share some common code during the handshake, so you may see references to SSL3 when TLS is actually being used.

    3 hours ago, Del Murray said:

    I set no cipher string in the test.

    Nor should you, except when you have very specific security requirements.  If you don't set a CipherList explicitly, a default one is used, which should usually be suitable for most tasks.

     

    HOWEVER, do note that in July 2018 (between D10.2 and D10.3), there was a behavior change made in Indy.  Maybe that is contributing to your issue?

     

    Prior to the change (ie, in the Indy bundled with XE7), if the CipherList was empty then Indy used a hard-coded cipher list that was taken from the OpenSSL SDK:

     

    'AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH'

     

    After the change, Indy no longer uses that.  It now lets OpenSSL use whatever default cipher list it was compiled with.

    3 hours ago, Del Murray said:

    This code in idSSLOpenSSL is never true ..

      if IsTLSv1_2Available then begin
        if not ( sslvTLSv1_2 in SSLVersions) then begin
          SSL_CTX_set_options(fContext, SSL_OP_NO_TLSv1_2);
        end;
      end;

     

    Which seems to indicate that the libeay32 and ssleay32  may not have TLSV1_2 available. I'm using Libs just downloaded from GitHub

    If IsTLSv1_2Available() returns False, that means the OpenSSL DLLs you are using do not export the TLSv1_2_method(), TLSv1_2_server_method() and, TLSv1_2_client_method() functions.  I can assure you that the OpenSSL 1.0.2 DLLs in Indy's GitHub repo DO export those functions.

     

    Note, if Indy doesn't detect TLS 1.1 and TLS 1.2 are available, it will silently fallback to TLS 1.0.  That might also be contributing to your issue.

     

    Just to check, what does Indy's OpenSSLVersion() function report for you after the DLLs are loaded?  I would also suggest using SysInternals Process Explorer to view your app's process at runtime and verify that your app is actually loading the expected OpenSSL DLLs and not some other incompatible OpenSSL DLLs that may be located elsewhere on your PC.

    • Like 1

  4. 5 hours ago, Squall_FF8 said:

    However when I use the result in Query, I get error - it messes up the syntax of the SQL.

    Then you will have to escape control characters manually, which QuotedStr() doesn't do for you.

     

    But, you really shouldn't be concatenating strings to create SQL queries to begin with. Use a parameterized query instead, letting the DB enging handle all of the escaping and quoting for you. Or, use a blob stream (though, I would use TFQQuery.CreateBlobStream() instead of creating TFDBlobStream directly, but either way works).

    6 hours ago, Squall_FF8 said:

    Since when RTF includes control codes (ASCII < 32)? If that is the case then things like `\par` are nonsense.

    AFAIK, RTF does not use ASCII control characters. Line breaks are handled by \line and \par control words. And there should be no #0 characters at all. That being said, if there are raw line breaks in the RTF, it might be for human reading purposes, but not machine reading.

    6 hours ago, Squall_FF8 said:

    The RTF text states version 2.0. Do you know what version of RichEdit Delphi 12+ uses?

    Delphi 12 uses RichEdit 4.1 (since D11) , which is the current version available from Microsoft at this time. I don't know offhand what version of RTF it supports.

    6 hours ago, Squall_FF8 said:

    I'm not familiar with "RTF using 8bit characters". Does Delpji / Windows RichEdit supports that? Do you know of a program that supports that?

    RTF is encoded in ASCII, which fits in 8bit (AnsiChar) characters in memory, so you don't need to waste memory using 16bit (WideChar) characters to hold it. A Delphi String is 16bit since D2009. This is why I suggested using varchar instead of nvarchar in the DB. Or, a blob field will suffice, too.

     

    • Thanks 1

  5. RTF is encoded in plain ASCII text, where non-ASCII characters are escaped. So, you should not need a blob for this, a simple text field will suffice (although, you might consider a blob if you want to store the RTF using 8bit characters but don't want to use varchar instead of nvarchar).

     

    Have you tried simply saving the RTF from the RichEdit into a UnicodeString (ie nvarchar) or AnsiString (ie varchar) variable and then load it back in, without involving a DB at all?  Set the RichEdit.PlainText property to false to tell the RichEdit to act on RTF, and then use the RichEdit.SaveToStream() and RichEdit.LoadFromStream() methods to get and load the RTF.  You can then expand on that logic to introduce text handling with a DB.


  6. 7 hours ago, Del Murray said:

    I know everyone want Indy 10 to support TLS 3 but does it support TLS1.3.

    No, it does not support OpenSSL 3.x or TLS 1.3 at this time. But, you can use a 3rd party SSLIOHandler that does, such as TaurusTLS (https://github.com/JPeterMugaas/taurustls).

    7 hours ago, Del Murray said:

    Is there a rational reason as to why a client would require all their users who pay them money to change their code at this level just because they moved to different servers ?

    Security requirements change all the time. They have to update their systems every so often to keep up.

    7 hours ago, Del Murray said:

    They did not change the API, Only the location of where they are running from.

    There is much more to HTTP/S than just URLs.

    7 hours ago, Del Murray said:

    Have I just been lucky for 10 years that I never had to fool around at this level.

    Yes.

    5 hours ago, DelphiUdIT said:

    there is a mandatory support to SNI. I don't think if Indy support SNI.

    Yes, it does, at least on the client side, and has for 8 years now.

     

    • Like 2

  7. The TComponent.Components list contains the TComponent objects that are owned by the containing TComponent for memory management purposes. All components created at design-time are owned by the parent TForm/TFrame/TDataModule that they were dropped onto. This is why your TTabSheet's ComponentCount is 0 at runtime as it doesn't own anything.

     

    The TWinControl.Controls list contains the child TControl objects that are nested inside of the containing TWinControl for UI purposes. This is why your code works when you use the TTabSheet's ControlCount as its child controls list is not empty.


  8. UuidCreate() is a Win32 API function, not a Delphi function.  If you can't reach Delphi's declaration, then just make your own declaration in your own code. There is only one physical function to detour (residing in rpcrt4.dll), it doesn't matter how many declarations there are to reach it.

    • Thanks 1

  9. The higher the resolution is, the smaller a 24x24 image is going to look. You need multiple images of different sizes, and then choose the appropriate size for a given resolution.  Are you doing that?  The whole point of TImageCollection is to provide images of different sizes/resolutions, and then TVirtualImageList presents those images at a given size/resolution.  Where are you making adjustments based on the current resolution?


  10. 4 hours ago, radekc said:

    If you want, you can use great mime decoder from synapse

    Why are you copying the Indy PostStream into a separate TMemoryStream?  The PostStream is already a TMemoryStream by default (unless you use the OnCreatePostStream event to use a different stream).  Why not just parse the PostStream as-is?

    4 hours ago, radekc said:

    works with binary data in mime

    Indy's MIME decoder also supports binary data.


  11. Windows doesn't just arbitrarily screw up files. You must have done something to cause the files to be screwed up, ie loading them or saving them with the wrong charset. You need to use the proper charset when saving/loading files. That's where you need to fix the problem, not in the code that has already loaded the files, by then the data is already corrupted. If you have ANSI files, load them with an ANSI charset. If you have UTF-8 files, load them as UTF-8. Period. If you need to differentiate, use a BOM or other metadata, or hieristic analysis. Don't guess the encoding.


  12. 50 minutes ago, Cristian Peța said:

    DataSnap uses Indy and Indy does not work with Windows SChannel.

    That's a little misleading. SChannel can use the SSL/TLS protocol. So, even if the server were using OpenSSL, a client could connect to it using SChannel.

     

    In any case, there is a 3rd party GitHub repo that provides an SChannel IOHandler for Indy. But DataSnap doesn't use that. Also, IIRC, it is only available for clients not servers. 

    Quote

    A solution would be to statically link OpenSSL library into executable like it was done for Android.

    iOS is the only platform that Indy statically links to OpenSSL.  On all other platforms, including Android, it uses OpenSSL libraries that are already present on the device, unless you provide your own lib files with your app.

    • Thanks 1

  13. 2 hours ago, Mauro Botta said:

    but then i call my DataSnap Server, using a TSQLConnection show me a error:   Exception class TDBXError with message 'Loading SSL module failed.

     

    How i can remove the request of these SSL Files on Windows? ( libeay32.dll )

    That error message does not imply OpenSSL specifically. It could be any SSL library. dbExpress itself doesn't use any SSL DLLs, that's the job of the underlying dbExpress driver to decide what it needs. To remove such a dependency, you will likely need to find another dbExpress driver that supports your database engine without that dependency. 


  14. 41 minutes ago, eniomarconcini said:

    Toolbar images, and button images was stored in TImageList components on a DataModule inside images.bpl package. 

    The throuble is: in design-time images in buttons is displayed correctly.  But in runtime, when app.exe is running, toolbar buttons or buttos is displayed without images. 

    Hard to diagnose without seeing your actual setup - how the BPLs load the images, how the EXE loads the BPLs, how the EXE assigns the images to its UI, etc.  Lots of factors here.


  15. 1 hour ago, new-to-dp said:

    Template: the programs that have this issue stem all from a particular template. I would like to conclude then that this template has the issue.

    What does "template" mean from your code's perspective, though? Are your Forms using a common base class? A common styling theme?  Something else?

    1 hour ago, new-to-dp said:

    I have two monitors. Could it be related to that?

    Doubtful, but anything is possible.


  16. The behavior you describe suggests your code is handling certain window messages incorrectly, like WM_(SYS)COMMAND or WM_CLOSE. Or your OnClose event handler is doing something weird. The VCL's default behavior when closing a window is to either terminate the app (if closing the MainForm) or hide the window (non-MainForm). The Win32 API's default behavior when closing a window is to destroy the window.

     

    Hard to diagnose your problem one way or the other without seeing actual code that reproduces the issue.

     

    What does your Exit menu do, exactly? Does it simply close the calling Form, or does it terminate the whole process?

     

    Also, you mention a template, what does that mean, exactly?


  17. 2 minutes ago, ChrisChuah said:

    I think i got it.

    I need to create an instance of the TThriftHashSetImpl but the variable is an Interface itself

    Yes, exactly.

    Quote

    How can i free or release these instances that i have created?

    Wont there be any memory leak?

    By using variables of interface type, you don't need to free the instances yourself, as interfaces are reference-counted. There is no leak in your example.


  18. 14 minutes ago, ChrisChuah said:

    the function 

            function product_get_info(const info_type: IThriftHashSet<TProduct_info_type>): IProduct_info;
     

    requires a parameter which is an Interface of IThriftHashSet<TProduct_info_type>

    That wasn't what was shown originally, but whatever.  My answer is the same.  You need to create an instance of a class that implements the IThriftHashSet interface, and then you can pass that instance into the function. For example:

    var hashSet: IThriftHashSet<TProduct_info_type> := TThriftHashSetImpl<TProduct_info_type>.Create;
    // or:
    var hashSet := TThriftHashSetImpl<TProduct_info_type>.Create as IThriftHashSet<TProduct_info_type>;
    
    hashSet.Add(terminal_packaged_part_number);
    // etc ...
    
    var info: IProduct_info := product_get_info(hashSet);
    // or: var info := product_get_info(hashSet);
    Quote

    How to pass a IThriftHashSet into this function as parameter?

    The only thing i can see is to use the TThriftHashSetImpl<T> constructor to create

    Yes, exactly.  TThriftHashSetImpl implements IThriftHastSet, so that is the correct type to create an instance of.

    Quote

    After which, i cannot use the Add function as it is strict protected.

    Yes, you can. Add() is public in the IThriftHashSet interface itself. It is protected only in the implementation of the interface.  You don't need access to the implementation, only to what the interface provides.  So, it is important that you call Add() on a variable whose type is IThriftHashSet not TThiftHashSetImpl.


  19. 3 hours ago, Vandrovnik said:

    Please is it possible to have memory manager in Delphi 12.3 to call my routine when it is unable to allocate new block of memory?

    There is no callback in the Memory Manager. If it can't allocate memory, it will raise an exception. Period.

     

    If you to customize the behavior, you can provide your own allocation function using SetMemoryManager(), then your function can do whatever you want.

     

    But, know that there can be only 1 Memory Manager installed, so for instance if you want to use FastMM or other 3rd party Memory Manager along with your own, you will have to chain them together manually.

     

    ---

     

    UPDATE: actually there is a callback - the System.ErrorProc callback.  If the Memory Manager fails to allocate, ErrorProc() will be called if assigned, specifying ErrorCode=reOutOfMemory.  A default error handler is installed by the SysUtils unit, and it raises an EOutOfMemory exception.  If no ErrorProc is assigned, the calling process is Halted instead.  So, you could assign your own ErrorProc if you want to do something different, however by the time the Memory Manager calls ErrorProc(), it is too late to retry the allocation.  If you provide your own allocation function using SetMemoryManager() instead, then you can do your own re-allocation attempt if you want to.

    • Like 1
    • Thanks 1

  20. 5 hours ago, ChrisChuah said:

    When i create a variable

    hashset = TThriftHashSetImpl<TProduct_info_type>.create;

    I could not call hashset.add(TProduct_info_type)

    It is expecting you to pass in an instance of the TProduct_info_type class, not the class itself.

    5 hours ago, ChrisChuah said:

    Also how do i handle the return result IProduct_info?

    Should i also call 

    product_info := TProduct_infoImpl.create??

    No. product_get_info() will create the object for you and return an interface pointer to that object. You just need to declare a variable of type IProduct_info to receive it. 


  21. DNS servers are just servers like any other. And the OS acts as a client like any other. Like any client/server system, servers can go down at times, network routes to servers can go down at times, etc. The Internet doesn't have 100% connectivity 100% of the time. Hiccups happen. All you can do is make sure your software is robust enough to handle network errors when (not if) they happen, retry operations as needed, and move on. 


  22. 42 minutes ago, dmitrybv said:

    "Just curious — how did you specify the calling convention cdecl? After all, DoGetValue doesn't contain any parameters for specifying the calling convention."

    I simply used the debugger at runtime to modify the CallingConvention parameter of the internal System.Rtti.Invoke() function that DoGetValue() calls for a getter method.  DoGetValue() is hard-coded to pass in a value of ccReg, I just changed that to ccCdecl instead, and then the AV went away.  That is at least a POC that the issue could be fixed if DoGetValue() were made to be more sensitive to the getter's actual RTTI. And likewise for DoSetValue(), too.

    • Thanks 1
×