Jump to content

gioma

Members
  • Content Count

    115
  • Joined

  • Last visited

Posts posted by gioma


  1. 1 hour ago, aehimself said:

    The medium and the format where your data arrives is irrelevant. Just assemble the text in your receiver routine and go on from there.

    in reality that data can be a UTF8 string or a UNICODE string or a file.
    The first character of the data tells me what type of data I have to work with.

    For this reason I have to separate the header from the rest of the message.


  2. 6 minutes ago, Der schöne Günther said:

    Your life will be much easier if you rely on Strings and Chars for text manipulation, not bytes. Convert to bytes when your text manipulation is done, not before that.

    I know, but it's a packet received via datachannel that only transmits byte arrays.


  3. Hi,

    I have this code:

     

    procedure ProcessData(data:PByte, asize:integer);
    var
    	data_pack:TBytes;
        t:TStreamWriter;
        DataType:Char;
    begin
    	nflog:= 'C:\TEST\Log.txt';
        if FileExists(nflog) then
          t := TStreamWriter.Create(nflog, true, TEncoding.UTF8)
        else
          t := TStreamWriter.Create(nflog, false, TEncoding.UTF8);
          
        SetLength(data_pack, asize);
        Move(PByte(data)^, data_pack[0], asize);
    	// here the coding is perfect
        t.WriteLine( TEncoding.Unicode.GetString(data_pack));
        t.Flush;
    
        dataType := TEncoding.unicode.GetChars(data_pack)[0];
        
        delete(data_pack, 0, 1);
        // here the content of datapack has become UTF 8 and therefore does not coding well
        t.WriteLine( TEncoding.Unicode.GetString(data_pack));
        t.flush
        t.free;
        
    end;

    In the "data" variable there is a string in unicode, but when Delphi esxcute the "delete" operation it seems that it convert the contents of the data_pack variable into UTF8 and therefore the print of the second value it's not correct

    does anyone know why?


  4. On 1/19/2024 at 6:33 PM, Lars Fosdal said:

    @gioma I have both D11 and D12 installed. With the Parnassus plugins in both.

     

    You cannot share visual source code between the two versions. If you open your projects in D12 and save the changes, the forms (as well as other visual design components) can have added properties, which will not work with D11.  This is not news. It has always been like this between major versions. 

     

    That the GetIt servers are down is a problem for everybody, and not something this user forum can solve.

    In fact, this is not my problem.
    Delphi 11 has permanently "broken" since I also installed Delphi 12.
    Moving to Delphi 12 is MANDATORY because Embarcadero has completely abandoned Delphi 11 with all its bugs.
    I REPEAT: The problem with Delphi 11 is that the more you use it, the more it corrupts, until it becomes almost unusable!
    For a development team having to move from Delphi 11 to Delphi 12 is risky as you don't know what other issues may emerge that can make your application unstable.
    Without forgetting the fact that it is also expensive, as all third-party components must be repurchased.

    • Confused 1

  5. 8 hours ago, Lars Fosdal said:

     

    My case is not so simple, because all libraries are been renamed perfectly!
    I had to delete them, I DEFINITELY UNINSTALLED DELPHI 11 AND REBUYED THE COMPONENTS TO UPDATE THEM TO DELPHI 12..
    Now I managed to uninstall this crap from Delphi 12 and everything works as before, except my pockets!

     

     

    among other things, now with Delphi 12 the SOAP calls that I made with Delphi 11 no longer work (Interface not supported) and I MUST find a solution as soon as possible..
    Embarcadero does not understand the damage it is causing to its customers.. this is simply EMBARRASSING!
    Delphi11 left to itself (the more you use it, the more it messes up something in the management of the IDE until it becomes completely unusable...).. they come out with Delphi12 which, once installed, definitely kills Delphi11.. the time I'm wasting solving their problems it's really a lot.. TOO MUCH..


  6. 11 minutes ago, DelphiUdIT said:

    P.S.: Do not attempt to redefine the methods, they are already defined in the indicated unit that comes with Delphi.

    Do you mean the "WTSQuerySessionInformation()" function? What is the unit in Delphi where it is already defined?

    11 minutes ago, DelphiUdIT said:

    Another tip: try disabling the "support high-entropy 64 bit address ..." item in the project options (Delphi compiler / Linking

    I tried, unfortunately nothing changes.


  7. 10 hours ago, Remy Lebeau said:

    Your declaration of WTSQuerySessionInformation() is wrong.  It should be like this instead:

    
    function WTSQuerySessionInformation(
      hServer: THandle;
      SessionId: DWORD;
      WTSInfoClass: WTS_INFO_CLASS;
      var ppBuffer: LPWSTR;
      var pBytesReturned: DWORD): BOOL; stdcall; external 'Wtsapi32.dll' name {$IFDEF UNICODE}'WTSQuerySessionInformationW'{$ELSE}'WTSQuerySessionInformationA'{$ENDIF};
     

    And technically, both WTSEnumerateSessions() and WTSQuerySessionInformation() should be using 'out' parameters instead of 'var' parameters.  But that is not important here.

    Hi Remy, I tried but I always get error code 87.
    I also tried using this version:

     

    function WTSQuerySessionInformation(
      hServer: THandle;
      SessionId: DWORD;
      WTSInfoClass: WTS_INFO_CLASS;
      var ppBuffer: Pointer;
      var pBytesReturned: Pointer): BOOL; stdcall; external 'Wtsapi32.dll' name {$IFDEF UNICODE}'WTSQuerySessionInformationW'{$ELSE}'WTSQuerySessionInformationA'{$ENDIF};

    obviously it doesn't work! 😭

     

    The strangest thing is that sometimes it works (with the first version), but then suddenly it stops working and there is no way to make it work anymore.
    What I'm wondering is because compiling in 32 bit always works, while compiling in 64 bit doesn't!

     

    Is the structure not large enough for the result? But Microsoft's documentation indicates to use those data types.

    There is no documentation online on the use of this API for 64-bit applications! 😭😭

     

     


  8. Hi,

    I have a big problem.
    I have a service that monitors sessions on a PC/Server.
    If I develop the application in 32 bit and it works, but if I develop the application in 64 bit it goes into error (but not always!!):
    Error 87 : The Parameter is incorrect

    This is my code:

     

    Unit Wtsapi32:

    unit UN_Wtsapi32;
    interface
    uses 
    	Windows;
    const
      WINSTATIONNAME_LENGTH = 32;
      DOMAIN_LENGTH = 17;
      USERNAME_LENGTH = 20;
      CLIENTNAME_LENGTH = 20;
      CLIENTADDRESS_LENGTH = 30;
    
    type
      WTS_INFO_CLASS = (
        WTSInitialProgram,
        WTSApplicationName,
        WTSWorkingDirectory,
        WTSOEMId,
        WTSSessionId,
        WTSUserName,
        WTSWinStationName,
        WTSDomainName,
        WTSConnectState,
        WTSClientBuildNumber,
        WTSClientName,
        WTSClientDirectory,
        WTSClientProductId,
        WTSClientHardwareId,
        WTSClientAddress,
        WTSClientDisplay,
        WTSClientProtocolType,
        WTSIdleTime,
        WTSLogonTime,
        WTSIncomingBytes,
        WTSOutgoingBytes,
        WTSIncomingFrames,
        WTSOutgoingFrames,
        WTSClientInfo,
        WTSSessionInfo,
        WTSSessionInfoEx,
        WTSConfigInfo,
        WTSValidationInfo,
        WTSSessionAddressV4,
        WTSIsRemoteSession
      );
    
     WTS_CONNECTSTATE_CLASS = (
        WTSActive,
        WTSConnected,
        WTSConnectQuery,
        WTSShadow,
        WTSDisconnected,
        WTSIdle,
        WTSListen,
        WTSReset,
        WTSDown,
        WTSInit
      );
    {$IFDEF UNICODE}
    PWTS_INFO = ^WTS_INFO;
      WTS_INFO = record
        State:WTS_CONNECTSTATE_CLASS ;
        SessionId: DWORD;
        IncomingBytes :DWORD;
        OutgoingBytes :DWORD;
        IncomingFrames:DWORD;
        OutgoingFrames:DWORD;
        IncomingCompressedBytes:DWORD;
        OutgoingCompressedBytes:DWORD;
        WinStationName: array[0..WINSTATIONNAME_LENGTH - 1] of WCHAR;
        Domain: array[0..DOMAIN_LENGTH - 1] of WCHAR;
        UserName:array[0..USERNAME_LENGTH - 1] of WCHAR;
        ConnectTime:LARGE_INTEGER;
        DisconnectTime:LARGE_INTEGER;
        LastInputTime:LARGE_INTEGER;
        LogonTime:LARGE_INTEGER;
        CurrentTime:LARGE_INTEGER;
      end;
     {$ENDIF}
      
    function WTSEnumerateSessions(
      hServer: THandle;
      Reserved: DWORD;
      Version: DWORD;
      var ppSessionInfo:PWTS_SESSION_INFO;
      var pCount: DWORD
      ): BOOL; stdcall; external 'Wtsapi32.dll' name {$IFDEF UNICODE}'WTSEnumerateSessionsW'{$ELSE}'WTSEnumerateSessionsA'{$ENDIF};
    
    function WTSQuerySessionInformation(
      hServer: NativeUInt;
      SessionId: DWORD;
      WTSInfoClass: WTS_INFO_CLASS;
      var ppBuffer: PLPWSTR;
      var pBytesReturned: PDWORD): BOOL; stdcall; external 'Wtsapi32.dll' name {$IFDEF UNICODE}'WTSQuerySessionInformationW'{$ELSE}'WTSQuerySessionInformationA'{$ENDIF};
      

    unit test:

     

    //... 
    
    function GetSessionInfo(id:DWORD):TSessionInfo;
    var
      wpSessionInfo:PWTS_INFO;
      pSessionInfo:PLPWSTR;
      pBytesReturned:PDWORD;
      iderr:integer;
    begin
    
      Result.ID:=-1;
      if id >0 then
      begin
        try
          if (WTSQuerySessionInformation (
                                WTS_CURRENT_SERVER_HANDLE,
                                id,
                                WTS_INFO_CLASS.WTSSessionInfo,
                                pSessionInfo,
                                pBytesReturned) ) then
          begin
            Result.ID := id;
            wpSessionInfo:=PWTS_INFO(pSessionInfo);
            //user name
            Result.user:= wpSessionInfo.UserName;
            //station name
            Result.StationName:= wpSessionInfo.WinStationName;
            //domain name
            Result.domain:=wpSessionInfo.Domain;
            //connection status
            Result.ConnectState:=wpSessionInfo.State;
    
          end
          else begin
            idErr:=GetLastError;
            GV_TxtFileLog.Log('[GetSessionInfo] id '+intTostr(id)+' ERR :  '+ intToStr(idErr)+' '+SysErrorMessage(idErr),true);
          end;
    
        except
           on e:exception do
            GV_TxtFileLog.Log('[GetSessionInfo] id '+intTostr(id)+' EX : '+ e.Message,true);
        end;
      end;
    
    
    end;
    
    function SF_GetOpenedSessions(var codeErr:integer) :TSessionsInfo;
    var
      Sessions, Session: PWTS_SESSION_INFO;
      NumSessions:DWORD;
      I:DWORD;
      SessionInfo:TSessionInfo;
      pSessionInfo:PLPWSTR;
      pBytesReturned:PDWORD;
      wpSessionInfo:PWTS_INFO;
      id:DWORD;
    begin
      SetLength(result,0);
      codeErr:=0;
      if WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, Sessions, NumSessions) then
      begin
        try
          if NumSessions > 0 then
          begin
            Session := Sessions;
            for i := 0 to NumSessions do
            begin
              id:=Session.SessionId;
              if id > 0 then
              begin
                GV_TxtFileLog.Log('[SF_GetOpenedSessions] GetSessionInfo '+ intToStr(id) );
                SessionInfo := GetSessionInfo(id);
                if SessionInfo.ID>0 then
                begin
                  SetLength(result, length(Result)+1);
                  Result[length(Result)-1]:= SessionInfo;
                end;
                
              end;
              Inc(Session);
            end;
    
          end;
        except
          codeErr:=GetLastError;
          GV_TxtFileLog.Log('[SF_GetOpenedSessions] WTSQuerySessionInformation err : '+IntToStr(codeErr)+' '+SysErrorMessage(codeErr), true);
        end;
        WTSFreeMemory(Sessions);
      end
      else begin
        codeErr:=GetLastError;
        GV_TxtFileLog.Log('[SF_GetOpenedSessions] WTSEnumerateSessions err : '+IntToStr(codeErr)+' '+SysErrorMessage(codeErr), true);
      end;
    
    
    
    
    end;

     

     

    When I call the "SF_GetOpenedSessions" function I get error 87 when this function then calls the "GetSessionInfo" function.
    While if I use "GetSessionInfo" passing it the SID of the program it works perfectly... does anyone have an idea why? (I'm going crazy about it!)

    Compiling in 32 Bit, however, I have no problem.


  9. Just now, mvanrijnen said:

    but is i read it correctly how to solve this, it's just plain old DLL hell, not so difficult to solve ....

      

    yes but it shouldn't be up to us to solve it..

     

    1 hour ago, Uwe Raabe said:

    And before someone claims that could have been found during the beta: Most of the GetIt stuff is not available during beta until almost the last day and the majority of beta testers install in a dedicated environment without any prior Delphi version present. Also, not everyone makes use of all what is available in GetIt.

    perhaps it is precisely this approach that is wrong... I read that people are not surprised by this behavior, which means that over time these mistakes have been repeated over and over again!
    As I wrote in the post "Delphi 11.3 Forsaken", I don't like this policy of not releasing fixes for months and then coming out with a new version of Delphi that still carries the bugs of the previous one with new features that add new bugs..
    they should concentrate their efforts on solving macroscopic bugs and then think about making a new version of Delphi, otherwise it's just a joke..

    I find all this unprofessional... the world moves on, Delphi just pretends to, but still remains anchored to a way of doing things that should be extinct because it is not very functional!

     


  10. 9 hours ago, Uwe Raabe said:

    To have the Parnassus plugins work in Delphi 12 as well as Delphi 11.3 on the same machine you need to do either of this depending on your situation:

    • Before installing the Delphi 12 plugin: In folder c:\Program Files (x86)\Common Files\ParnassusShared rename ParnassusCoreEditor.dll into ParnassusCoreEditor_XAlexandria.dll
    • After installing the Delphi 12 plugin: Copy the 11 version of ParnassusCoreEditor.dll from the appropriate CatalogRepository folder as ParnassusCoreEditor_XAlexandria.dll into the mentioned folder

    thanks, it solved it.
    But what seems normal to you? I don't know..


  11. I installed Delphi 12 at home, not on the production PC where I also have Delphi 11.3.
    Result: DELPHI 11.3 goes into exception and I can no longer open any project with Alexandria

    INCREDIBLE!!!!

     

    image.thumb.png.186becff7984153bd89cfc86123a4c54.png

     

    image.thumb.png.e8dea305055812b203850c4e3b7baea3.png

     

     

    image.thumb.png.9c6c0fce5efe498d8d8308d49d92ef0f.png 

     

     

     

    DO NOT INSTALL DELPHI 12 ON YOUR PRODUCTION PCS!! 

     

    image.png


  12. 21 hours ago, aehimself said:

    The VS2022 you mean which ate up all 16 gigs of memory just when loading the project on all of the developer PCs, finally crashing the OS itself? Not sure if it got fixed since then, but the same project works just fine in 2019; this is why we are not switching. And btw, VS2019 still receives patches.

     

    We are all biased, we all have a preference towards one IDE or an other. The important thing is to stay objective even when we get frustrated.

    Visual Studio 2019 is still getting patches, it has been getting patches for at least 4 years.
    Delphi 13 is no longer receiving patches.

    20 hours ago, Brandon Staggs said:

    I am not aware of any software that I use that refrains from releasing new versions until the current release version is bug free. Perhaps there are exceptions, but that is just not how software development generally works. To be clear, I don't think it's unreasonable to want Embarcadero to fix bugs, I do too. But complaining about Delphi 12 coming just because Delphi 11.3 isn't bug-free is not reasonable or useful, IMO.

    

    That's not what I said or claim.

    The only patch for Delphi 11.3 was released in April and they haven't released anything since.
    After a little over a year, Delphi 11.3 was left to fend for itself.

    Embarcadero's policy so far has been to release new versions and not update older versions. 
    This policy is unacceptable to me, because often subsequent versions not only have new bugs (due to new features), but also carry bugs from previous versions that were never fixed.
    Not to mention the fact that every time you install the new version of Delphi you MUST necessarily install all the components.

    I repeat: I do not pretend that Delphi is bug-free, but that known bugs are fixed, because this is a product we pay dearly for.

     

     


  13. 2 hours ago, Sherlock said:

    Now gee, what do you expect? How many of your clients demand to run your software on their outdated, unsupported and insecure operating systems (Windows 98 SE was sweet)? And what do you tell them? Even Microsoft has abandoned that product. Seriously, as long as you are using Windows 7 you will get nothing but sympathetic nods as every little issue could be blamed on the fact you are trying to run it on an OS that does not meet the requirements. Nevertheless 11.3 is the current version, so some of your issues may have gotten fixed.

    I expect Delphi 11.3 to get updates and bug fixes a year after its release.

    I'm not using Windows 7, I'm using Windows 11 and if you're referring to the joke I wrote above "I can't use Delphi 7 in 2023", it was to say that Delphi 7 is the last Delphi that is not affected by major bugs... but I'm using Delphi 11.3 which hasn't been updated since April 2023, which is UNACCEPTABLE!


  14. 13 hours ago, Brandon Staggs said:

    It's been this way since Delphi 1. May as well not wish for a perfect "bug free" release before a new release comes. They'd be out of business. By now we should all understand that in order to benefit from bug fixes, we need to be on subscription, and we will have to upgrade to new versions with new bugs to watch out for. It is what it is.

     

    And I agree there are frustrating problems with the IDE, but frankly, most of what you described sounds a lot like a misbehaving package you have installed in the IDE. Especially since you say you get freezing while editing a form. If I were in your position I would be looking into figuring out what packages I may be using causing the IDE to be unstable. Remember, this is Delphi, all those design-time packages are DLLs loaded into the process of the IDE...

    I have a subscription.. I understand that Delphi has always done this, but if something is wrong, should we keep doing it until the end of time?

    The IDE is unstable even without packages, but haven't you noticed that the longer you keep it open, the slower it gets? I use it 8-10 hours a day.

     

    10 hours ago, JonRobertson said:

    Although I wish Delphi had fewer defects, I wish my own software did as well. 😉

    My software isn't perfect either, but I fix known bugs, I don't leave them there forever.. Software that doesn't fix giant bugs is dead software.

     

    10 hours ago, JonRobertson said:

     

    Immediately after I installed Delphi 11, I opened Get-It to see what was available. One of the add-ons I installed was Parallel Debugger from Parnassus. Once I uninstalled Parallel Debugger, the IDE immediately became mostly stable. Since uninstalling Parallel Debugger helped so much, I also uninstalled their Bookmarks add-on.

     

    For me now, Delphi 11.3 may throw an exception once a week.

    I have only installed plug-ins developed by Embarcadero included in my subscription.

     

    12 hours ago, aehimself said:

    Even at work, where we have DevExpress and a number of other, chunky components installed the IDE loads our big legacy project up in less than 20 seconds. Add 10-15 more seconds of compiling and I am in debugging.

    Compare that with VS2019, which needs ~1min until IntelliSense kicks in, 1,5 min of compiling, 10 seconds of after-compilation-thinking and finally the project launches.

    VS2019 is obsolete, you can easily switch to VS2022 (I have converted all my projects without any major problems), but in any case I have never had any problems loading projects.

     

    NB:
    My PC has fairly recent and high-performance hardware:
    Intel i7 10700
    16GB DDR4 RAM
    NVIdia Quadro P620
    Samsung SSD 990 PRO

×