home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / w3_syst / shadow.arj / SHADOW.TXT < prev   
Encoding:
Text File  |  1991-09-25  |  2.9 KB  |  59 lines

  1. The Shadow 1.01 for Windows                     September 25, 1991
  2.  
  3. Written by David Stafford
  4. CIS: 76666,2542 or 72411,2670
  5. MCI: DSTAFFORD
  6.  
  7.  
  8. What evil lurks in the hearts of buggy WinApps.... the Shadow knows!
  9.  
  10. This is one of those little utilities you rarely ever need but when
  11. you need it... you really need it!
  12.  
  13. Basically- it provides a simple way to monitor any API call.  I've
  14. devised a method of hooking into virtually any DLL entry point at
  15. run-time.  The Shadow uses this method to hook a routine which simply
  16. beeps when the API is called.  This can be extremely useful when
  17. you need to know when and if an API is being called.
  18.  
  19. I said "..._virtually_ any DLL entry point...".  There's always a
  20. catch, isn't there!  The Shadow will not work with APIs which play
  21. games with the stack that result in moving the return address around.
  22. There is no reliable way to detect this has occured and The Shadow will
  23. crash when unloading the hook.  Note that the problem occurs _only_
  24. when The Shadow is trying to unload.  If the API is not active at
  25. unload time then there is no problem.  At present- I'm aware of only
  26. one Windows APIs which causes this problem: GetMessage.  If you really
  27. need to monitor GetMessage or some other troublesome API you can
  28. certainly do it- just don't unload The Shadow once you've begun!
  29. (This means do not close The Shadow or beging monitoring another API.)
  30.  
  31. If you run into any troublesome API please let me know!  I may add
  32. support for these to a future version of The Shadow.  There is no
  33. generic solution but I can put together a table of "rude" APIs which
  34. The Shadow could use to locate the return address.
  35.  
  36. For your education and entertainment you can also try monitoring
  37. Windows APIs at random and observing the results.  For example, I
  38. learned that the text in menus is drawn with ExtTextOut and the
  39. little tic mark which indicates a submenu is drawn with BitBlt.
  40. By monitoring CreateWindowEx you can see that submenus on popups are
  41. created dynamically but the main menu is not.  Try monitoring
  42. LocalAlloc and you will find it's a popular API!  Interesting stuff!
  43.  
  44. The Shadow knows about the APIs in KERNEL, GDI and USER- including the
  45. undocumented ones so you do not need to enter a DLL name to trace
  46. these functions.  For other DLLs you must enter the name and you may
  47. have to specify the API as an ordinal number (if the DLL's name table
  48. is not resident).
  49.  
  50. There are only four APIs which you cannot monitor.  These are:
  51. GlobalAlloc, AllocSelector, PrestoChangoSelector, and ChangeSelector.
  52. The reason is that The Shadow uses these during a critical code
  53. section.  The Shadow will not prevent you from _attempting_ to monitor
  54. these four APIs but if you do you will immediately crash.
  55.  
  56. The Shadow is freeware.  I hope it will be as useful to you as it is
  57. to me.  Let me know if you like it.  You can reach me via CompuServe
  58. (76666,2542) or MCI mail (DSTAFFORD).
  59.