Jump to content

gioma

Members
  • Content Count

    115
  • Joined

  • Last visited

Everything posted by gioma

  1. 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?
  2. gioma

    Delphi 12 : Encoding Unicode strange behaviour

    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.
  3. gioma

    Delphi 12 : Encoding Unicode strange behaviour

    ok, thanks, then I think this is exactly the problem.
  4. gioma

    Delphi 12 : Encoding Unicode strange behaviour

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

    Delphi 12 : Encoding Unicode strange behaviour

    then if I have a unicode string like this: 'ABCDEFGHI' and I put it inside a byte array if I want to remove the first character from the byte array do I have to remove two bytes and not one?
  6. 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.
  7. 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..
  8. I have a big problem, I can no longer open Delphi 11, I get this error: Runtime error 236 at 2C800AAA
  9. It's incredible, they still haven't solved it. I can't uninstall Parnassuss which conflicted between versions 11 and 12!! It's a real DISASTER!
  10. gioma

    [DELPHI 11] Runtime error 236

    the problem is that Delphi doesn't start up, how can I solve it?
  11. 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.
  12. Now I also understand why I couldn't find it, winapi.wtsapi32 isn't there on delphi 11! I started the project with Delphi 10, then I switched to Delphi 11 and now I've switched to Delphi 12!
  13. you have solved my problem! I used the unit WinApi.Wtsapi32 and the error disappeared! Honestly, I couldn't find this unit so I thought it didn't exist! Thanks thanks thanks.
  14. Do you mean the "WTSQuerySessionInformation()" function? What is the unit in Delphi where it is already defined? I tried, unfortunately nothing changes.
  15. 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! 😭😭
  16. I have a big problem, for some time now when I try to edit the .dpr file of any project the IDE is very slow, it takes seconds to write a single character, making it impossible to work. How can I solve this?
  17. I want to share my disappointment with you. I work with Delphi 11.3 (Patch 1) and every day I see amazing things. Starting with Code Insight, which works 1 out of 3 times. Then, when it stops working, there is no way to reactivate it. The new feature that allows you to highlight the selected words in the code works badly, often when I select a word with a double click the document is moved and becomes unreadable until I scroll through the document, this thing makes me waste a LOT of TIME. It is also dangerous because you risk to write in another part of the code! (it happened to me...) When I am working on the graphical interface of a form, it can happen that the IDE freezes completely and I have to force the PID to close! Sometimes the compiler goes "out of memory" and in the best case you can save and close Delphi, in the worst case Delphi crashes and you lose the work you've done if you haven't saved it. And those are just the biggest problems, I'll leave the rest out. Now I learn that Delphi 12 is being released, but how can Embarcadero offer me a new version of Delphi? And the Delphi 11 bugs, WHO CAN SOLVE THEM? The last update to Delphi 11 was in APRIL!!!! This means that I should update to Delphi 12, which will certainly have NEW BUGS and will not have fixed the bugs of version 11 (as happened to me every time I changed versions...). When do you think we will be able to go on like this? Visual Studio is updated EVERY WEEK. I have to work every day with an IDE that slows me down and most of all with an IDE that NO ONE MAINTAINS! I would like someone like Marco Cantù to explain to me why Embarcadero is destroying the trust of their customers in this way, why they are neglecting the essentials to continue blowing smoke in our faces. Sorry for the outburst, but it's really frustrating to work like this.
  18. gioma

    Delphi 12 is available

    yes but it shouldn't be up to us to solve it.. 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!
  19. gioma

    Delphi 12 is available

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

    Delphi 11.3 : FORSAKEN

    Could you explain better what I should do? Thank you
  21. gioma

    Delphi 11.3 : FORSAKEN

    DO NOT INSTALL DELPHI 12 ON YOUR PRODUCTION PCS!! this is the result: RAD STUDIO 11.3 KO
  22. gioma

    Delphi 12 is available

    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!!!! DO NOT INSTALL DELPHI 12 ON YOUR PRODUCTION PCS!!
  23. gioma

    Delphi 11.3 : FORSAKEN

    Visual Studio 2019 is still getting patches, it has been getting patches for at least 4 years. Delphi 13 is no longer receiving patches. 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.
  24. gioma

    Delphi 11.3 : FORSAKEN

    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!
×