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.

118 lines
3.2 KiB

  1. /*
  2. Copyright (c) Microsoft Corporation
  3. generate comctl tool
  4. based on gennt32t
  5. */
  6. #pragma warning( disable : 4786) //disable identifier is too long for debugging error
  7. #pragma warning( disable : 4503) //disable decorated name is too long
  8. #include <nt.h>
  9. #include <ntrtl.h>
  10. #include <nturtl.h>
  11. #include <windows.h>
  12. #include <imagehlp.h>
  13. #include <ctype.h>
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <assert.h>
  18. #include <iostream>
  19. #include <fstream>
  20. #include <iomanip>
  21. #include <string>
  22. #include <sstream>
  23. #include <set>
  24. #include <map>
  25. extern "C" {
  26. #include "gen.h"
  27. #if !defined(NUMBER_OF)
  28. #define NUMBER_OF(x) (sizeof(x)/sizeof((x)[0]))
  29. #endif
  30. // string to put in front of all error messages so that BUILD can find them.
  31. const char *ErrMsgPrefix = "NMAKE : U8603: 'GENCOMCTLT' ";
  32. void
  33. HandlePreprocessorDirective(
  34. char *p
  35. )
  36. {
  37. ExitErrMsg(FALSE, "Preprocessor directives not allowed by gencomctlt.\n");
  38. }
  39. }
  40. using namespace std;
  41. typedef string String;
  42. PRBTREE pFunctions = NULL;
  43. PRBTREE pStructures = NULL;
  44. PRBTREE pTypedefs = NULL;
  45. void ExtractCVMHeader(PCVMHEAPHEADER pHeader) {
  46. pFunctions = &pHeader->FuncsList;
  47. pTypedefs = &pHeader->TypeDefsList;
  48. pStructures =&pHeader->StructsList;
  49. }
  50. // globals so debugging works
  51. PKNOWNTYPES pFunction;
  52. PFUNCINFO pfuncinfo;
  53. void DumpFunctionDeclarationsHeader(void)
  54. {
  55. //PKNOWNTYPES pFunction;
  56. //PFUNCINFO pfuncinfo;
  57. cout << "///////////////////////////////////////////\n";
  58. cout << "// This file is autogenerated by gencomctlt. \n";
  59. cout << "// Do not edit \n";
  60. cout << "///////////////////////////////////////////\n";
  61. cout << '\n' << '\n';
  62. cout << "#include \"windows.h\"\n";
  63. cout << "#include \"commctrl.h\"\n\n";
  64. cout << "///////////////////////////////////////////\n";
  65. cout << "// Functions //\n";
  66. cout << "///////////////////////////////////////////\n";
  67. for (
  68. pFunction = pFunctions->pLastNodeInserted;
  69. pFunction != NULL
  70. && pFunction->TypeName != NULL
  71. && strcmp(pFunction->TypeName, "MarkerFunction_8afccfaa_27e7_45d5_8ff7_7ac0b970789d") != 0 ;
  72. pFunction = pFunction->Next)
  73. {
  74. /*
  75. for now, just like print out commctrl as a demo/test of understanding the tool
  76. tomorrow, print out what we actually need
  77. */
  78. cout << pFunction->FuncRet << ' ';
  79. cout << pFunction->FuncMod << ' '; // __stdcall
  80. cout << pFunction->TypeName << "(\n"; // function name
  81. pfuncinfo = pFunction->pfuncinfo;
  82. if (pfuncinfo == NULL || pfuncinfo->sType == NULL || pfuncinfo->sName == NULL)
  83. {
  84. cout << "void";
  85. }
  86. else
  87. {
  88. for ( ; pfuncinfo != NULL ; pfuncinfo = pfuncinfo->pfuncinfoNext )
  89. {
  90. cout << ' ' << pfuncinfo->sType << ' ' << pfuncinfo->sName << ",\n";
  91. }
  92. }
  93. cout << ")\n";
  94. }
  95. cout << '\n' << '\n';
  96. }
  97. int __cdecl main(int argc, char*argv[])
  98. {
  99. ExtractCVMHeader(MapPpmFile(argv[1], TRUE));
  100. DumpFunctionDeclarationsHeader();
  101. return 0;
  102. }