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.

141 lines
6.4 KiB

  1. /* [ 0] Created AngelaCh
  2. [ 1] Added additional attributes ChrisK
  3. [ 2] 17-Mar-1994 Added support for Win32s AngelaCh
  4. [ 3] 08-Apr-1994 Added attrLic AngelaCh
  5. [ 4] 20-Apr-1994 Added check for Alignment AngelaCh
  6. [ 5] 25-Apr-1994 Added extra attributess AngelaCh
  7. [ 6] 08-Feb-1995 Added support for GetLastError Angelach
  8. ========================================================================*/
  9. #if defined(WIN32) || defined(WIN64)
  10. #include "osutil32.hxx"
  11. #else //WIN32
  12. #include "osutil16.hxx"
  13. #endif //WIN32
  14. #include <stdio.h>
  15. #include <string.h>
  16. #define defaultOutput XSTR("tlviewer.out")
  17. #define cchFilenameMax 256 // max chars in a filename
  18. #define fMaxBuffer 256
  19. #define aMaxName 15
  20. #define MAX_NAMES 65
  21. // name of valid attributes
  22. #define attrAppObj XSTR("appobject")
  23. #define attrBindable XSTR("bindable") // [ 1]
  24. #define attrControl XSTR("control") // [ 2]
  25. #define attrDefault XSTR("default")
  26. #define attrDefaultbind XSTR("defaultbind") // [ 1]
  27. #define attrDisplaybind XSTR("displaybind") // [ 1]
  28. #define attrDllName XSTR("dllname")
  29. #define attrDual XSTR("dual") // [ 5]
  30. #define attrEntry XSTR("entry")
  31. #define attrGetLastErr XSTR("usesgetlasterror") // [6]
  32. #define attrHelpCont XSTR("helpcontext")
  33. #define attrHelpFile XSTR("helpfile")
  34. #define attrHelpStr XSTR("helpstring")
  35. #define attrHidden XSTR("hidden") // [ 5]
  36. #define attrId XSTR("id")
  37. #define attrIn XSTR("in")
  38. #define attrLcid XSTR("lcid")
  39. #define attrLic XSTR("licensed") // [ 3]
  40. #define attrNonExt XSTR("nonextensible") // [ 5]
  41. #define attrOleAuto XSTR("oleautomation") // [ 5]
  42. #define attrOption XSTR("optional")
  43. #define attrOut XSTR("out")
  44. #define attrPropget XSTR("propget")
  45. #define attrPropput XSTR("propput")
  46. #define attrProppr XSTR("propputref")
  47. #define attrPublic XSTR("public")
  48. #define attrRequestedit XSTR("requestedit") // [ 1]
  49. #define attrRestrict XSTR("restricted")
  50. #define attrReadonly XSTR("readonly")
  51. #define attrRetval XSTR("retval") // [5]
  52. #define attrSource XSTR("source")
  53. #define attrString XSTR("string")
  54. #define attrUuid XSTR("uuid")
  55. #define attrVar XSTR("vararg")
  56. #define attrVer XSTR("version")
  57. #define noValue 0 // attribute has no value
  58. #define numValue 1 // attribute has numeric value
  59. #define strValue 2 // attribute has string value
  60. #define fnWrite XSTR("w") // file attribute - write only // [2]
  61. #define outOpt XSTR("/o") // specify output to file
  62. #define szEndStr XSTR(" */\n\n\n")
  63. #define szBeginAttr XSTR("[")
  64. #define szEndAttr XSTR("] ")
  65. #define szOutSuccess XSTR(" is created successfully")
  66. // the following three definitions
  67. // result in compile-time error
  68. #ifdef _MAC // on the MAC when doing Macro
  69. #define szFileHeader "/* Textual file generated for type library: "
  70. #define szInputInvalid " Input file is not a valid type library\n\n"
  71. #define szReadFail " // *** Error in reading the type library: "
  72. #define szAlignErr " // Alignment incorrect: "
  73. #else // expansion (internal buffer overflow)
  74. #define szFileHeader XSTR("/* Textual file generated for type library: ")
  75. #define szInputInvalid XSTR(" Input file is not a valid type library\n\n")
  76. #define szReadFail XSTR(" // *** Error in reading the type library: ")
  77. #define szAlignErr XSTR(" // Alignment incorrect: ")
  78. #endif
  79. // global variables
  80. XCHAR szInputFile[cchFilenameMax] ; // name of input library file
  81. XCHAR szOutputFile[cchFilenameMax] ; // name of output text file
  82. XCHAR szLibName[cchFilenameMax] ; // name of the type library
  83. XCHAR szOutMsgFile[15] = XSTR("tlviewer.o") ; // name of the message file [2]
  84. ITypeLibX FAR *ptLib ; // pointer to the type library
  85. ITypeInfoX FAR *ptInfo ; // pointer to the type definition
  86. TYPEATTR FAR *lpTypeAttr ; // pointer to attribute of type def
  87. int strFlag = 0 ; // for string attribute
  88. BOOL endAttrFlag = FALSE ; // if need to end the attribute-list
  89. unsigned short cArrFlag = 0 ; // if it is a c array
  90. BOOL isInherit = FALSE ; // if the interface has a base interface
  91. BOOL isOut = FALSE ; // output message to a file?
  92. FILE * mFile ; // file handle for outputing messages
  93. WORD inAlign = 0 ; // alignment for the typeinfo's [4]
  94. WORD expAlign = 0 ; // expected alignment for the typeinfo's [4]
  95. BOOL alignFound= FALSE ; // alignment has not been found
  96. BOOL isDual = FALSE ; // it is a dual interface [7]
  97. // prototypes for local functions
  98. LPXSTR NEAR fGetFileName (LPXSTR, LPXSTR) ;
  99. VOID NEAR ParseCmdLine (LPXSTR) ;
  100. VOID NEAR OutToFile (HRESULT) ;
  101. BOOL NEAR fOutLibrary (FILE *) ;
  102. VOID NEAR tOutEnum (FILE *, int) ;
  103. VOID NEAR tOutRecord (FILE *, int) ;
  104. VOID NEAR tOutModule (FILE *, int) ;
  105. VOID NEAR tOutInterface (FILE *, int) ;
  106. VOID NEAR tOutDual (FILE *, int) ; // [7]
  107. VOID NEAR tOutDispatch (FILE *, int) ;
  108. VOID NEAR tOutCoclass (FILE *, int) ;
  109. VOID NEAR tOutAlias (FILE *, int) ;
  110. VOID NEAR tOutUnion (FILE *, int) ;
  111. VOID NEAR tOutEncunion (FILE *, int) ;
  112. VOID NEAR tOutName (FILE *, int) ;
  113. VOID NEAR tOutType (FILE *, TYPEDESC) ;
  114. VOID NEAR tOutCDim (FILE *, TYPEDESC) ;
  115. VOID NEAR tOutAliasName (FILE *, HREFTYPE) ;
  116. VOID NEAR tOutValue (FILE *, BSTR, VARDESC FAR *) ;
  117. VOID NEAR tOutMember (FILE *, LONG, BSTR, TYPEDESC) ;
  118. VOID NEAR tOutVar (FILE *) ;
  119. VOID NEAR tOutFuncAttr (FILE *, FUNCDESC FAR *, DWORD, BSTR) ;
  120. VOID NEAR tOutCallConv (FILE *, FUNCDESC FAR *) ;
  121. VOID NEAR tOutParams (FILE *, FUNCDESC FAR *, BSTR) ;
  122. VOID NEAR tOutFunc (FILE *) ;
  123. VOID NEAR tOutUUID (FILE *, GUID) ;
  124. VOID NEAR tOutAttr (FILE *, int) ;
  125. VOID NEAR tOutMoreAttr (FILE *) ;
  126. VOID NEAR WriteAttr (FILE *, LPXSTR, LPXSTR, int) ;
  127. VOID NEAR GetVerNumber (WORD, WORD, LPXSTR) ;
  128. VOID NEAR tOutAlignError (FILE *) ; // [5]
  129. VOID NEAR WriteOut (FILE *, LPXSTR) ;