WaxfordSqueers
December 22nd, 2007, 02:53
I didn't know whether to post this in Tools, or here. I asked once before about general queries and was told this forum was where to post the simpler stuff. It involves softice but it's not a technical question about softice per se. I'd appreciate comment from anyone who cares to comment.
Please note: this is not a straight 'licence expired' problem. The app is fully functional with the exception that its database is old and can't be renewed. So, I'm not faced with a splash screen looking for a serial. Also, the people who wrote the app are no dummies. I'm sure the solution is quite complicated and that's what interests me. I want to learn something about protections.
1)something strange is happening with the tracing procedure. In one area of code in particular, a call to RegQueryExA brings up a splash screen and a message box indicating the licence has expired. I was trying to track down where the message box is triggered but there's a lot of code and dll loading between the splash screen and the message box.
I have jumped over a zillion RegQuery calls in the past and never triggered an event. As far as I knew, RegQuery was not re-entrant, so there was no way for it to call back into the app's code. I single-stepped it to be sure, and neither the splash screen nor the message box triggered with that approach. I then jumped over a RegClose call and it happened again.
This app is heavy with IPC procedures. There are two threads set up with long GUID-like names, and the app seems to have added a second process thread since it expired. I know that because I checked it many times in Windows Task Manager when it failed to respond in the past. There would be a second thread, and when I killed that thread, everything was OK. So, it only ever had one thread running when it was running well. Now it has two.
Is it possible for one thread to watch another, then trigger the splash screen and message box when another thread queries the registry for a specific event? I'm learning about IPC but I'm still pretty dumb about it. The app is using memory mapping, CreateEvent, Mutexes and Semaphores.
2)I traced the code back from the message box to a GetMessageA function. I am rusty on message loops, but I presume the GetMessage was called in response to a PostMessage call. Or, at least, the GetMessage func was idling till one was posted. At one time I was adept at getting myself out of message loops but now I'm scratching my head a bit.
Since the GetMessage func is in a single process, can I assume it will keep cycling till there are no more messages, at which time it should let me back into the main code? I am trying to trace past the message loop to the calling function but I'm having trouble visualizing the procedure.
Feel free to correct me if I'm wrong, but somewhere along the line, something was done to decide the licence was out of date. If the coder was smart, and I presume he was, that code will be nowhere near any PostMessage funcs. However, once it's decided the licence is out of date, a message 'could' be sent to initiate a message box. If so, is there a relationship between the PostMessage func and the GetMessage func that would allow me to trace back? Or will I have to trace into the GetMessage func looking for a re-entrant point?
Somewhere before the PostMessage func should be a good guy/bad guy point (or many
) and that's what I'm looking for. I realize it's not that simple...there could, and probably is, a long, convoluted math process. What's complicatig the issue this time is the IPC threads. I'm used to Windows apps that follow a straight Window registration procedure then call ShowWindow, or something.
Please note: this is not a straight 'licence expired' problem. The app is fully functional with the exception that its database is old and can't be renewed. So, I'm not faced with a splash screen looking for a serial. Also, the people who wrote the app are no dummies. I'm sure the solution is quite complicated and that's what interests me. I want to learn something about protections.
1)something strange is happening with the tracing procedure. In one area of code in particular, a call to RegQueryExA brings up a splash screen and a message box indicating the licence has expired. I was trying to track down where the message box is triggered but there's a lot of code and dll loading between the splash screen and the message box.
I have jumped over a zillion RegQuery calls in the past and never triggered an event. As far as I knew, RegQuery was not re-entrant, so there was no way for it to call back into the app's code. I single-stepped it to be sure, and neither the splash screen nor the message box triggered with that approach. I then jumped over a RegClose call and it happened again.
This app is heavy with IPC procedures. There are two threads set up with long GUID-like names, and the app seems to have added a second process thread since it expired. I know that because I checked it many times in Windows Task Manager when it failed to respond in the past. There would be a second thread, and when I killed that thread, everything was OK. So, it only ever had one thread running when it was running well. Now it has two.
Is it possible for one thread to watch another, then trigger the splash screen and message box when another thread queries the registry for a specific event? I'm learning about IPC but I'm still pretty dumb about it. The app is using memory mapping, CreateEvent, Mutexes and Semaphores.
2)I traced the code back from the message box to a GetMessageA function. I am rusty on message loops, but I presume the GetMessage was called in response to a PostMessage call. Or, at least, the GetMessage func was idling till one was posted. At one time I was adept at getting myself out of message loops but now I'm scratching my head a bit.
Since the GetMessage func is in a single process, can I assume it will keep cycling till there are no more messages, at which time it should let me back into the main code? I am trying to trace past the message loop to the calling function but I'm having trouble visualizing the procedure.
Feel free to correct me if I'm wrong, but somewhere along the line, something was done to decide the licence was out of date. If the coder was smart, and I presume he was, that code will be nowhere near any PostMessage funcs. However, once it's decided the licence is out of date, a message 'could' be sent to initiate a message box. If so, is there a relationship between the PostMessage func and the GetMessage func that would allow me to trace back? Or will I have to trace into the GetMessage func looking for a re-entrant point?
Somewhere before the PostMessage func should be a good guy/bad guy point (or many
