Kas Ob.
Members-
Content Count
461 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Kas Ob.
-
How do I terminate a thread that doesn't have an Execute method ?
Kas Ob. replied to dormky's topic in Algorithms, Data Structures and Class Design
If TThread destructor being called while the thread is running then it is best to make sure the event handled closed and triggered (aka freed), preventing the thread from blocking on it, other wise it will go performing undefined behavior. -
DataModule should be created fine, the problem is what is on it !!? 1) The OP asked for non visible TForm, invisibility of TForm is irrelevant here, because handles for Windows classes is the prohibited in Windows Services, These Windows services are isolated from the user or interacting with the user. 2) Windows services are console application, this is very important, on top of that they are console application with modified policy to block all the GUI API https://learn.microsoft.com/en-us/windows/win32/services/interactive-services not only they can't create but also they cant open handles. 3) I created hundreds of DataModules in my services, in fact it is the cleanest or most efficient way to build Windows service, but you can't drop one VCL component on it, by that i mean a visible one or the one that create Windows GUI class, i faced some problems with a component should be as non visible component, but this component had hidden form/dialog to ask for a password if needed or programmatically asked to do so, that component was creating that input dialog in the constructor, this component had to be modified to be used in a DataModule in Windows Service. Now to guessing part to what did happen with your DataModule in ISAPI, most likely you have unit in uses clause that do some GUI initialization and does fail or something, see, i don't have the latest Delphi, but reading what have being changed and added, it might be the theming and skinning have something to do with, so in theory (i might be wrong here), you might used some component that is importing some of these units, or you have tested your module in an stand alone EXE and forgot to remove some unit from the uses clause, so i recommend to check the uses part, and track the offending component on that DataModule.
-
Yes i know, and no it is impossible to create any GUI element from IIS ISAPI. The reason is simple your ISAPI is either running in-process or out-of-process of the INET/IIS, in both cases the ISAPI is hosted by Windows Service, all Windows Services are not allowed to create (or interact with) any GUI or have user desktop interaction.
-
So for such cases these is "case" in Pascal/Delphi Case the control is CheckBox then the value is Boolean type Case of TMemo then the value is Base64 Encoded text. Case of something need more than one property then (like DataSet) MyDataSet.XX or MyDataSet_XX is TXX type .....
-
Or if you want to go fancy, then build a class/component (a manager) that do that automatically, i mean enumerate all the controls and create an ini file with them, while it such in design time will enumerate all the controls and have a list at design time that can be checked to include/exclude from saving. Building such component will give you huge experience while being fun.
-
Hi, Do it stupid simple, do you need it to be used or modified by users manually ?!! most likely no.. So, even for both cases (Yes/No) : Name these CheckBoxes with useful and clear names, then use the their names as Ini file Value while use for the Ini file Sections the Form/Frame name ... Don't forget to handle missed value with notification or errors or skip silently.... , For saving (or loading): enumerate all the controls in the form/frame and utilize the tag property to indicate the need to be saved/stored in Ini file or not. Just an idea !
-
The first application i ran was ProcessExplorer https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer ,that way i can see what is going on, also i can do many tasks like kill the Windows Explorer and start it again, this like a rule of thumb for me, as this application most likely went through Microsoft testing also being used by millions, and followed the best practice to the letter. After it worked fine, and i failed to reproduce your black screen, tried few other application with GUI and console and no problem too. So try with it for easier get out of locked desktop.
-
Can't reproduce this behavior on Windows 10.0.17134.706 . Tried many exe's and it worked flawlessly, aka returned to current desktop without a problem, tried some with GUI and console application some finish fast some takes time, everything is OK. One thing though, shouldn't be SwitchDesktop(curDesk) before CloseDesktop(deskHnd), to me this makes more sense instead of leaving it to the OS, also if the exe your are running is locking or using the Desktop it might interact with switching. Now to the guess part : something locked the newly created desktop, something like screen recording or Antivirus, most likely piece of software OS or non-OS based, locked the desktop or ran something on it and prevented desktop closing it, in other words the that desktop was busy. Observation : if i comment SwitchDesktop(curDesk); then after closing the newly ran process the desktop return automatically to my desktop, this indicate closing desktop worked and switching is even not needed. Even when i comment both lines Switching and closing, i still get return to my default desktop as this application after WaitForSingleObject does exit, hence auto closing the desktop handle and return me to my default desktop.
-
function SHA1ofStr or Base64Encode fault output
Kas Ob. replied to xauxag's topic in ICS - Internet Component Suite
If @xauxag can provide some more input about the locale and settings then it is possible to test it. I had being using https://github.com/xupefei/Locale-Emulator for years for the purpose of testing when such problem appear or for testing a specific non internationalized (English) application. -
Network scan in Delphi (Windows), get MAC addresses
Kas Ob. replied to ErikT's topic in Network, Cloud and Web
Well, we have different meaning for hack/hacker as word, as it is like rubber nowadays and have being used not well defined term, it is not bad at all, it is a word describing ..... Wikipedia explain this way better than me https://en.wikipedia.org/wiki/Hacker Have heard about hackathons and their sponsors (like Microsoft, Apple, Google....) it is essential process in advancing technology evolution, to invent, share and spread knowledge also critical in security defense. -
Embarcadero can you please STOP making your install sooooo MARVELOUS?
Kas Ob. replied to alogrep's topic in General Help
What happen when you run the IDE as Administrator ? -
Network scan in Delphi (Windows), get MAC addresses
Kas Ob. replied to ErikT's topic in Network, Cloud and Web
Hi, @ErikT , I would suggest : 1) Make WireShark your close and trusted friend, get familiar with it and use it extensively, depend on its result to diagnose what do you see against what you get. 2) Get familiar with nmap https://nmap.org/ , there is many resources to get you started, it is open source and great tool with many feature, use WireShark to understand its packets and get ideas from it, nmap has many ways (documented and undocumented) to scan an IP and even detect firewall presence on a remote IP. -
Embarcadero can you please STOP making your install sooooo MARVELOUS?
Kas Ob. replied to alogrep's topic in General Help
Hi, @alogrep Did you used "Run as Administrator" on the installer when installed the IDE ? -
CreateSemaphore/FileLock etc
Kas Ob. replied to hsvandrew's topic in Algorithms, Data Structures and Class Design
This way better than depending on creating the file, BUT ... What/where is the locked file ?, who created it ? Here few scenarios should be a protentional problems: 1) Application/installer first run done by an administrator, will the locking file be accessed or lockable by others ? 2) What happen if user using RDP ran the application which either created that file or locked that file ? Anyway, my hate for file or registry locking is the need for more scenarios/situations to consider. -
CreateSemaphore/FileLock etc
Kas Ob. replied to hsvandrew's topic in Algorithms, Data Structures and Class Design
Hi, What should/can happen with file locking in case of the owner application crash or system power failure (eg. unexpected restart) ? I prefer prefer memory locking or shared memory locking, but with extra step like have a background thread acting like watch dog and make sure there is time out or constraints to keep the lock active and control or process -> exiting/finishing/wrapping up/reporting/terminating/(asking the user for interaction).... As or file locking if you prefer it, then make sure to have some data in it like the owner PID (process ID) or the time of system started, both.... You need to think about different scenarios before committing to potentially permanent locking like files and registry, for me they are somehow risky and dangerous. -
İs possible same pointer size for Win32/Win64?
Kas Ob. replied to kosovali's topic in Algorithms, Data Structures and Class Design
Thank you ! That is the word i was looking for. -
function SHA1ofStr or Base64Encode fault output
Kas Ob. replied to xauxag's topic in ICS - Internet Component Suite
Please try this instead procedure TForm1.Button3Click(Sender: TObject); var s: AnsiString; ServerKey: string; begin s := AnsiString(edit1.Text); ServerKey := Base64Encode(SHA1ofStr(s)); Memo1.Lines.Add(ServerKey); end; -
function SHA1ofStr or Base64Encode fault output
Kas Ob. replied to xauxag's topic in ICS - Internet Component Suite
I don't see any bug or wrong here, used the same 3 lines like yours and the same value. On other hand if ICS Base64 encoding is broken then it is amazing to perform anything at all ! -
İs possible same pointer size for Win32/Win64?
Kas Ob. replied to kosovali's topic in Algorithms, Data Structures and Class Design
This means the size of memory being used is very limited, or somehow limited and contained. In this case i would suggest to start to adjust the old code first to maintain huge block of memory enough for these structures, then replace all the pointers with relative address pointers, by that i mean all will point to SOME_ADDR + BASE_ADDRESS, as such the address pointers could be only 32bit, while BASE_ADDRESS is irrelevant and will be applied once by the code after allocating the memory (aka after loading or transferring the whole block). This will allow you to compress the used memory, but under condition that you don't use the default memory manager and allocate these record/structures on you own. But again, before streamed/serialized you could transfer the structures and replace all the pointers with relative ones to the base, which be default could be 0. -
Data structure for Integer ranges
Kas Ob. replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
I really hate that !, "no range no value" does sound like undefined behavior. For me, always one of two for a search result : 1) return (-1) for not found or a valid index in a simple and plain list, array.... , same with pointers and linked list return 0 for not found, can be checked with Assigned. 2) return a boolean true for success with var parameter for index, internal associated data....structures, pointers...could also return a pointer and the next one or the previous in one go... -
The only thing that makes sense given what you have described is if there is a local AV/Firewall running on the client machine that is blocking the connections from TIdHTTP directly, but has an exception which allows Fiddler to make connections. I second that, it is app control by either Windows Firewall or Defender or 3rd party firewall. Remember that the default behavior on Windows can be adjusted with a policy, so the firewall could blocking public access for outgoing, while allowing home network and/or private network, this explain that behavior, so the old application have a policy while the installed local proxy adjusted its firewall role. in other words the application that using this DLL is marked by firewall or some security software, and it might be not visible in the simple outgoing roles setting.
-
Data structure for Integer ranges
Kas Ob. replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Hi, I am having hard time understand the problem or the proposed solution, so to recap what i get you have non-overlapped integer ranges in a list, and want to implement the best solution to check for an integer to get its range if exist, right ? In that case then make sure to sort them by the left side ( the start point of the each range), and check for the middle item in that list for the required value, by checking i mean use >Ri or <Li "here Li and Ri are start of and the end of range i, i in the range [0..Last] which is the list of ranges, starting i with (Last div 2)" then based on these comparison you either get i the range, or the value is in bigger i or smaller i ( i will become i div 2 or i+(Last-i) div 2 ) , repeat. This will should be fast to handle even thousands of ranges. -
For plain text editor it is indeed strange, but NotePad++ is not plain text editor it is more like everything editor with huge plugins database. I think i saw that behavior in editing Word documents and in editing HTML, it was useful to change font style and color in one go. TRichView doesn't support such multi selection, but might be easier to emulate selection by simply highlighting.
-
Designing a Websocket API
Kas Ob. replied to Angus Robertson's topic in ICS - Internet Component Suite
Hi, While having the full HTTP request and including the HTTP header for the response is best for switching between the connections type, you can do this by striping all of that and changing the request to pure and simple JSON ,(like a JSON object with a field called apicmd and its value is codelookup with a second field numhistory ), here i want to point an important thing is to put a separator for this simple API request like one CRLF or double CRLF to indicate the end of the request, same can be with the response, also want to point that is very important and will pay in future to put the request parameters in the response for each request, this will prevent the confusion and remove all the tracking for request-response pairs, web socket allows you to send many request from the client and the server can response when it is ready and doesn't require serialization, some queries might/could be executed on the server different threads but the response always known for the client. Not really important, but i prefer to send one request establishing the timeout and the frequency of the ping to be expected, this way, server have some knowledge on how to handle stale connections, remember that web sockets connection will stale without ping, so the best approach here is make sure the client to ping periodically, and the server will close the connection if this period violated, the ping form the client could be 3 minutes and the server will close the connection on 5-6 minutes if nothing being received in that period(ping or not).