Ernie, Here's a question right up your alley. With windows API, I could create hooks and journalhooks to record keypresses and mouse activity, then play it back at some point to create some sort of macro or more specialized automated test utility. This works until OCX controls are brought into the equation. I've seen articles about creating COM Spy Utilities, but nothing that really behaves like a real "OLE Hook" so-to-speak. Was wondering, would you happen to know of a way that COM activity can be captured and then dealt with dynamically at run time. Here's the application I'm trying to apply: A utility that records keyboard and mouse activity on COM Interfaces (Mainly, VB programs) and can record the properties of a control and then at a later time, playback the activty it captured to create some sort of automated testing, where it could then set the properties, compare the differences, or have some AI to do intelligent things with. The problem I'm encountering is that I don't know how to create a proxy for most ActiveX controls where I can "Spy" on it at run time. I want to create an automated test program and make the source code available because the one commercial product that does this is the biggest piece of crap I've ever worked with and is causing our company thousands of $$$ each month. I really would like to figure this one out and make articles and source available to spark up some competition, or just my own product that I can make freely available as an alternative. Any help would be useful, I have 3 articles on related topics (if you're interested in obtaining a copy). Mainly from Windows Developer's Journal (issues that can't be back ordered currently) and MSJ (which is available online). Thanks, _Shawn PS: is there a way to obtain a listing of all Active Interfaces of a given process and then when activity occurs in a control, know which control it is, and then capture it's properties and state for later use? I know how to use the tlbinf32.dll which will return everything about an interface you ever want to know, but how do I obtain that interface of an out of process control? I've seen two products do it (including a custom COM Spy Utility in WDJ Magazine -- and the other a commercial tool).
Posted on 2001-02-02 18:17:00 by _Shawn
Shawn, Since you've read these articles you're way up on what I know. So here's my off the cuff guesses: If you wanted to spy on some specific control, that's not very difficult. All you need do is: 1) create a proxy object exporting the same interfaces as your subjecy object. 2) Same goes for callback interfaces, you have to tell the server to ding your spy object, then pass the event onto the client. 3) since all messages are now traveling thru your spy object, log them to your own taste. 4) Now, runtime insertion: Actually, the simplest part. Just find the registry setting for your target, and change the InprocServer32 to your spy app. Of course, your spy knows the alias you re-registered the target at, so at creation it can call on COM to create the real object. Admitedly, this is a very simplistic approach. Anything 'real' would mean tricking out the ole32.dll, and I'm ignorant on how to do such. I have no idea how you could determin which interfaces a process is using at runtime. This activity should traverse ole32 at some time, but if the process creates an object for internal use, just calling IMalloc for memory, that would require some sort of dissassembly to determine WHY the process wanted thread safe storage (IE, is it just a bstring or a remotable object?) I would be interested in the articles you have if they are handy and scanned. Ernie
Posted on 2001-02-03 14:02:00 by Ernie
Maybe you'll be interested in COM Log by Elicz
Posted on 2001-02-03 17:23:00 by Amokila
Ernie, Actually, that works for controls which you know about. It can't account for any third party control dynamically. I think that's the whole problem, is that I don't know how to see which Objects a given process is using. However, I do know this, this commercial product is actually using a debugger of some sort which "spies" on what's going on. There has to be an easier way, I know that MS puts dubugging and some sort of way to hook and log everything through the API, I just think someone figured out how to do that with OLE32. I'll scan the articles for you and send them you're way, you'd really get a kick out of it. One article actually creates a COM spy program similar to Spy++ except for COM, but it's only a proxy for known interfaces. I'll get back... Thanks, _Shawn
Posted on 2001-02-04 20:18:00 by _Shawn
Amokila, The COM Thingy doesn't work, it requires an APIHOOKS.DLL which I have no clue how to find... Thanks, _Shawn
Posted on 2001-02-04 20:21:00 by _Shawn
http://www.anticracking.sk/EliCZ/ APIHOOKS.DLL - Another gem by the same talented guy! Try the Export section from his home page above. Hope that helps. Take care, bitRAKE. p.s. If your in a hurry: http://www.anticracking.sk/EliCZ/export/AH31.ZIP is the direct link This message was edited by bitRAKE, on 2/4/2001 11:20:12 PM This message was edited by bitRAKE, on 2/4/2001 11:21:27 PM This message was edited by bitRAKE, on 2/4/2001 11:22:24 PM
Posted on 2001-02-04 23:17:00 by bitRAKE
Ernie, Actually, this commercial program does somehow only know which OCX's are being used by an application and how many of them are active, which (VB) form is active and the such, mainly on the UI side of the coin. It's hard to track down what it's doing, because it's a 200MB install with literally countless dll's. I'll take a look at this COM Spy dll and I'll send you the mag articles, you'd really like them... give me about a week or so, I must use an alternate Internet source until the Phone Company decides that want to transfer my DSL from my old house (I just moved) -- which is also why visualassembler site can't be updated until middle of the month... :( Thanks for all you're help _Shawn PS: In the meantime, if you have any breakthroughs, I'd love to know about it :)
Posted on 2001-02-05 12:59:00 by _Shawn
Shawn, Thanks for your offer to send the docs. However, I'm just looking for them for background, this isn't anything I'm activly interested in or working on. And my docking toolbars thing is turning out to be quite involved.
Posted on 2001-02-05 13:24:00 by Ernie
Thanks, Ernie. If this is something that can be accomplished, sooner or later, my skills will be such that I can accomplish it. In the meantime, I'm at the mercy of one of the most unforgiving, crappy, predorial, 3rd world quality, unrational software company that charges $10k for a license, and $1.5 for support (because they know all the above) and every time it corrupts my system I have to call again and obtain a new license key to install... untill I can make my own that has no limits like theirs... ugh I sometimes can honestly say "corporate America sucks". No, it's not an MS product. This is why I hate IP and monopolies and crappy service policies, support reps who 9 times on 9 different unrelated issues tell me "this is the first time we've had this problem reported" and do nothing to solve it in the meantim, only say "it's you're fault". If it wasn't such a crappy product, I wouldn't constantly have these problems... rant rant rant rant rant rant... I'm glad I'm a programmer. Make my own version of a program these days because that old addage, "if you want it done right, do it yourself"... I just strive to be above them... above the lowest common-denominator -- corporate software america. I won't stoop to their level (this company in particular, and any other commercial company that strives to produce crap). They only care about their pocket books, and without sufficient competition it's obvious they have no motivation to correct the problem or make things better, even at the expense of a lost customer because where will that customer go? I've yet to see a competiting product offer half what this crappy piece does. So I seek to write my own and provide sources to the community so they can stimulate the creative juices. I'll still send you the articles. You'd like them. I can't post them, they are copyrighted, however, not possible to obtain officially these days, either. _Shawn I'll get in touch with you shortly... Thanks This message was edited by Shawn Bullock, on 2/5/2001 1:48:34 PM This message was edited by Shawn Bullock, on 2/5/2001 1:49:27 PM
Posted on 2001-02-05 13:47:00 by _Shawn