Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
5.9 KiB

  1. #include <mmc.h>
  2. #include <winuser.h>
  3. #include <tchar.h>
  4. #include "globals.h"
  5. #define MMC_CRACK_MESSAGES 1
  6. static TCHAR *MMCN_CrackVerb(MMC_CONSOLE_VERB verb)
  7. {
  8. static TCHAR error[64];
  9. switch( verb )
  10. {
  11. case MMC_VERB_NONE:
  12. return _T("NONE");
  13. case MMC_VERB_OPEN:
  14. return _T("OPEN");
  15. case MMC_VERB_COPY:
  16. return _T("COPY");
  17. case MMC_VERB_PASTE:
  18. return _T("PASTE");
  19. case MMC_VERB_DELETE:
  20. return _T("DELETE");
  21. case MMC_VERB_PROPERTIES:
  22. return _T("PROPERTIES");
  23. case MMC_VERB_RENAME:
  24. return _T("RENAME");
  25. case MMC_VERB_REFRESH:
  26. return _T("REFRESH");
  27. case MMC_VERB_PRINT:
  28. return _T("PRINT");
  29. case MMC_VERB_CUT:
  30. return _T("CUT");
  31. default:
  32. _sntprintf( error, ARRAYLEN(error) - 1, _T("Unknown verb id %d"), verb );
  33. error[ ARRAYLEN(error) - 1 ] = NULL;
  34. return error;
  35. }
  36. }
  37. void MMCN_Crack(
  38. BOOL bComponentData,
  39. IDataObject *pDataObject,
  40. IComponentData *pCompData,
  41. IComponent *pComp,
  42. MMC_NOTIFY_TYPE event,
  43. LPARAM arg,
  44. LPARAM param )
  45. {
  46. #ifdef MMC_CRACK_MESSAGES
  47. TCHAR message[256] = {0};
  48. if( TRUE == bComponentData )
  49. OutputDebugString(_T("IComponentData::Notify( "));
  50. else
  51. OutputDebugString(_T("IComponent::Notify( "));
  52. _sntprintf( message, ARRAYLEN( message ), _T( "DataObject: %08p, CompData: %08p, Comp: %08p ) - "), pDataObject, pCompData, pComp );
  53. message[ ARRAYLEN(message) - 1 ] = NULL;
  54. OutputDebugString( message );
  55. switch( event )
  56. {
  57. case MMCN_ACTIVATE:
  58. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
  59. break;
  60. case MMCN_ADD_IMAGES:
  61. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
  62. break;
  63. case MMCN_BTN_CLICK:
  64. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
  65. break;
  66. case MMCN_COLUMN_CLICK:
  67. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg, param);
  68. break;
  69. case MMCN_COLUMNS_CHANGED:
  70. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_COLUMNS_CHANGED\n"));
  71. break;
  72. case MMCN_CONTEXTHELP:
  73. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_CONTEXTHELP\n"));
  74. break;
  75. case MMCN_CONTEXTMENU:
  76. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_CONTEXTMENU\n"));
  77. break;
  78. case MMCN_CUTORMOVE:
  79. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_CUTORMOVE\n"));
  80. break;
  81. case MMCN_DBLCLICK:
  82. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_DBLCLICK\n"));
  83. break;
  84. case MMCN_DELETE:
  85. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_DELETE\n"));
  86. break;
  87. case MMCN_DESELECT_ALL:
  88. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_DESELECT_ALL\n"));
  89. break;
  90. case MMCN_EXPAND:
  91. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
  92. break;
  93. case MMCN_EXPANDSYNC:
  94. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_EXPANDSYNC\n"));
  95. break;
  96. case MMCN_FILTERBTN_CLICK:
  97. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
  98. break;
  99. case MMCN_FILTER_CHANGE:
  100. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
  101. break;
  102. case MMCN_HELP:
  103. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_HELP\n"));
  104. break;
  105. case MMCN_INITOCX:
  106. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
  107. break;
  108. case MMCN_LISTPAD:
  109. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
  110. break;
  111. case MMCN_MENU_BTNCLICK:
  112. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_MENU_BTNCLICK\n"));
  113. break;
  114. case MMCN_MINIMIZED:
  115. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
  116. break;
  117. case MMCN_PASTE:
  118. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_PASTE\n\tCopy: %d\n"), NULL == param );
  119. break;
  120. case MMCN_PRELOAD:
  121. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
  122. break;
  123. case MMCN_PRINT:
  124. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_PRINT\n"));
  125. break;
  126. case MMCN_PROPERTY_CHANGE:
  127. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
  128. break;
  129. case MMCN_QUERY_PASTE:
  130. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_QUERY_PASTE\n"));
  131. break;
  132. case MMCN_REFRESH:
  133. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_REFRESH\n"));
  134. break;
  135. case MMCN_REMOVE_CHILDREN:
  136. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
  137. break;
  138. case MMCN_RENAME:
  139. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
  140. break;
  141. case MMCN_RESTORE_VIEW:
  142. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_RESTORE_VIEW\n"));
  143. break;
  144. case MMCN_SELECT:
  145. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
  146. break;
  147. case MMCN_SHOW:
  148. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
  149. break;
  150. case MMCN_SNAPINHELP:
  151. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_SNAPINHELP\n"));
  152. break;
  153. case MMCN_VIEW_CHANGE:
  154. _sntprintf( message, ARRAYLEN(message) - 1, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
  155. break;
  156. }
  157. message[ ARRAYLEN(message) - 1 ] = NULL;
  158. if( message[0] != 0 )
  159. OutputDebugString(message);
  160. else
  161. OutputDebugString(_T("unknown event\n"));
  162. #endif
  163. }