home *** CD-ROM | disk | FTP | other *** search
/ The Education Master 1994 (4th Edition) / EDUCATIONS_MASTER_4TH_EDITION.bin / files / progng_c / dmalloc / install.lib / SAMPLE / DEMOTXT.C < prev    next >
Encoding:
Text File  |  1992-11-01  |  10.9 KB  |  202 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*         File : DEMOTXT.C                                                */
  4. /*                                                                         */
  5. /*      Version : 1.0                                                      */
  6. /*         Date : 08/30/91                                                 */
  7. /*                                                                         */
  8. /*       Author : Ernest Vogelsinger                                       */
  9. /*                                                                         */
  10. /*  Description : Explanatory text strings for the DMalloc demo program    */
  11. /*                                                                         */
  12. /*      History : 08/05/92  EV  Texts changed for DMalloc 1.0!             */
  13. /*                                                                         */
  14. /*                                                                         */
  15. /*                  (c) E.Vogelsinger 1991, 1992                           */
  16. /***************************************************************************/
  17.  
  18. char *any_key   = "Please press any key to continue...\n";
  19. char *any_prtsc = "\nPlease press <PrintScreen> now, and, after returning, any key.";
  20.  
  21. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  22. char *welcome[] = {
  23.  
  24. "        Welcome to the demonstration program for DMalloc v.1.0.",
  25. "",
  26. " This program will take a short tour through the features and possibili-",
  27. " ties of DMalloc. Having reached this point, you have already seen the",
  28. " DMalloc startup screen and you have pressed F5 or F10 to start the",
  29. " demo program.",
  30. "",
  31. " This demo was compiled with Microsoft(R) C 7.00, and linked together with",
  32. " the DMalloc library. You will certainly see that some debugging\'s",
  33. " necessary here, since the demo program contains a lot of bugs...",
  34. "",
  35. " Just kidding. These bugs were wittingly built into the demo to demonstrate",
  36. " some of the powerful debugging capabilities of DMalloc."
  37. "",
  38. " Now, this text is printf()\'ed at the very beginning of the main() function.",
  39. "",
  40. " Please press any key to begin.",
  41. 0 };
  42.  
  43. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  44. char *explain1[]  = {
  45.  
  46. " Now the demo allocates some memory. Please note that DMalloc checks the",
  47. " heap in regular intervals -- you can see the \"Please Wait\" sign flash.",
  48. " This is done automatically. The checking interval may be specified by you",
  49. " by modifying the setup values.",
  50. "",
  51. " The demo consists of three modules: module1.c, module2.c, and module3.c.",
  52. " Modules 1 and 2 were compiled with complete DMalloc information, and",
  53. " module 3 is compiled without. All three modules allocate memory by calls",
  54. " to malloc, calloc, and realloc.\n", "",
  55. 0 };
  56.  
  57. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  58. char *explain1a[] = {
  59. " The three modules have now allocated 1200 pointers. Since the default",
  60. " configuration of DMalloc is to check the heap every 100 calls to one",
  61. " of the functions of the malloc group, it checked the heap 11 times. Since",
  62. " the heap is OK at the moment, nothing special has happened.",
  63. " Please press any key to continue.",
  64. 0 };
  65.  
  66. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  67. char *explain2[]  = {
  68. " You may now use DMalloc to have a deeper insight into the secrets of the",
  69. " demo program's memory. Please press the <PrintScreen> key to popup DMalloc.",
  70. "",
  71. "",
  72. " Sorry, the demo cannot help you while you are in DMalloc. ",
  73. " After pressing PrintScreen, look at the bottom of your screen to see the",
  74. " function keys that are available. You may press F4 (\"View\") to hide the",
  75. " DMalloc windows and see this screen.",
  76. "",
  77. " Please note that these memory blocks that have been allocated by module",
  78. " 1 and 2 are shown with full information, and that the other blocks (that",
  79. " have been allocated by module 3) show \"??unknown\" as owner since this",
  80. " module has not been compiled with DMalloc information.",
  81. "",
  82. " Navigate through the heap entries using the Up, Down, PgUp, and PgDn keys.",
  83. " Press Enter or F3 (\"Dump\") to see a hexdump of the selected block.",
  84. " Press F7 (\"Status\") to review the total heap status.",
  85. " Press F5 (\"Go!\") at any time to go back to the demo.",
  86. 0 };
  87.  
  88. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  89. char *explain3[]  = {
  90. " The demo will now do some very nasty things: allocated blocks will be",
  91. " written out-of-bounds for one or more bytes - things that easily may occur",
  92. " when developing a \"real\" program. One of the blocks will be tampered at",
  93. " the bytes before the block's begin; this would normally lead to a malloc",
  94. " crash (or infinite loop) since it would overwrite the malloc unit info.",
  95. " Please note that DMalloc detects when you write an even number of bytes",
  96. " to a block that was allocated with odd size. With most malloc implemen-",
  97. " tations this problem would never be detected since blocks are always allo-",
  98. " cated even sized. DMalloc still warns you about this situation.",
  99. "",
  100. " On the next access, DMalloc will check the heap again and detect the bad",
  101. " things the demo has done. Watch out!",
  102. "",
  103. " Please press any key now to be a bad guy... (and caught by DMalloc)",
  104. 0 };
  105.  
  106. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  107. char *explain4[]  = {
  108. " To easily navigate through corrupted blocks you can use the Right and Left",
  109. " keys - the window bar will stop only on elements that have been corrupted.",
  110. "",
  111. " Another possibiliy to get a quick overview on memory regions where some",
  112. " problem has been detected is to select what should be displayed in the main",
  113. " window. Press <F6> to display the selection window. At the field \"Allocated",
  114. " units\" switch to \"No\" by pressing the space bar, and then press <F10> to",
  115. " go back to the main window. The only elements that are displayed now are",
  116. " the program segments and these allocation units that have been corrupted.",
  117. "",
  118. " Press <PrintScreen> now and try the Right and Left keys, and use the",
  119. " selection window as described above.",
  120. 0 };
  121.  
  122. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  123. char *explain5[]  = {
  124. " DMalloc will warn you when invalid pointers are passed to realloc() and",
  125. " free(). In this case, the pointer passed to free() could cause desastrous",
  126. " consequences, since it points into the DOS area. Freeing this pointer",
  127. " would modify a byte in DOS memory...",
  128. "",
  129. " With DMalloc, you have the choice to discard the pending action, to con-",
  130. " tinue and do what the program intends to do (not recommended), or to exit",
  131. " the program. Whenever DMalloc pops up (except after pressing <PrintScreen>)",
  132. " you may exit the program or set a debugger breakpoint. To set a breakpoint,",
  133. " step back to the topmost window using <F10>, press <Tab> or <Enter> to get",
  134. " to the breakpoint field and select from three types: SoftIce, CodeView, or",
  135. " generic Int 3 by pressing the space bar.",
  136. " If you have SoftIce running, try using the SoftIce breakpoint when DMalloc",
  137. " pops up now. If not, try it later.",
  138. " The activated debugger will wake up at the statement following the",
  139. " interrupted call. Usually the statement is \"ADD SP, +(n)\".",
  140. 0 };
  141.  
  142. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  143. char *explain6[]  = {
  144. " DMalloc can be configured to perform a nullcheck whenever it is checking",
  145. " the heap. The demo program will now write to the null region of the data",
  146. " segment. This will usually be detected when the program exits.",
  147. " Using DMalloc you can detect it when you need to know it.",
  148. 0 };
  149.  
  150. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  151. char *explain6a[] = {
  152. " Please note:",
  153. " At program exit you will see a runtime error generated by the C library.",
  154. " This is what it should do since we did (!) write to the null region of the",
  155. " data segment!",
  156. 0 };
  157.  
  158. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  159. char *explain7[]  = {
  160. " There is a lot more functionality to DMalloc than this short demo can show",
  161. " you. For example, you could tag some blocks (<F9>, <shift> <F9>,",
  162. " <ctrl> <F9>, or using 'T' und 'U' like the popular XTree(r) utility to pop",
  163. " DMalloc up whenever a tagged pointer is reallocated or freed. Or you may",
  164. " specify that DMalloc should pop up after a specific number of calls to",
  165. " malloc etc. Or you can insert calls to the DMalloc API to modify the",
  166. " DMalloc settings for a specific program region, to trigger DMalloc from",
  167. " within the program, or to simply set a debugger breakpoint.",
  168. " Have a look at the MODULE1.C source on how to do this.",
  169. "",
  170. " Please note that the DMalloc settings are always saved to a configuration",
  171. " file. The file name is <programname>.DMC (here: DMLDEMO.DMC). This allows",
  172. " you to have different settings for different projects. You may change the",
  173. " DMalloc window colors (<F2><F2>), the display selection (<F6>), and the",
  174. " size of the DMalloc tag table (at startup time). All settings will go",
  175. " to the configuration file.",
  176. "",
  177. " Please press any key for the last page of the demo.", 0 };
  178.  
  179. /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
  180. char *explain8[]  = {
  181. " To prepare a program to use DMalloc, simply link it with an additional",
  182. " object (DMALLOC.OBJ), and supply the DMALLOC.LIB library. This will insert",
  183. " the code to track the malloc group functions. This method is simple, and",
  184. " will provide the full heap monitoring functionality. If you want to have",
  185. " more detailed information about the owner of memory blocks or want to",
  186. " interface to the DMalloc API, simply include the DMALLOC.H include file",
  187. " into the appropriate source modules, #define _DMALLOC (e.g. in the make",
  188. " file) and recompile it.",
  189. " Source modules compiled with DMalloc information require to be linked with",
  190. " DMALLOC.LIB. To quickly remove the DMalloc code, you may relink the pro-",
  191. " gram with a supplement library (DMCNONE.LIB) that resolves the references",
  192. " to DMalloc but doesn't pull the code in (very useful for beta site ver-",
  193. " sions).",
  194. " Finally, we will free some of the pointers that have been allocated,",
  195. " and then destroy the far heap by corrupting real critical allocation info.",
  196. " Normally, one of the next calls to malloc() or realloc() would freeze the",
  197. " machine since the heap is destroyed.",
  198. " Watch out for DMalloc how it reacts on this situation.",
  199. "                                Thank you for watching the DMalloc demo. ",
  200. "                                     Ernest Vogelsinger (CIS 100015,551) ",
  201. "                                                         Vienna, Austria ", 0 };
  202.