Source code of Windows XP (NT5)
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.

305 lines
12 KiB

  1. /*
  2. ** File: common.hxx
  3. **
  4. ** (C) 1989 Microsoft Corp.
  5. */
  6. /*****************************************************************************/
  7. /** Microsoft LAN Manager **/
  8. /** Copyright(c) Microsoft Corp., 1987-1990 **/
  9. /*****************************************************************************/
  10. /*****************************************************************************
  11. File : rpctypes.hxx
  12. Title : rpc type node defintions
  13. Description : Common header file for MIDL compiler
  14. History :
  15. ??-Aug-1990 ??? Created
  16. 20-Sep-1990 NateO Safeguards against double inclusion
  17. *****************************************************************************/
  18. #ifndef __COMMON_HXX__
  19. #define __COMMON_HXX__
  20. #define INC_OLE2
  21. #include <windows.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <memory.h>
  25. #include <assert.h>
  26. #include "list.hxx"
  27. typedef CLSID * PCLSID;
  28. /*****************************************************************************
  29. definitions from \nt\private\cs\inc\cscons.h
  30. *****************************************************************************/
  31. #include <cscons.h>
  32. /*****************************************************************************
  33. definitions from objidl.h
  34. *****************************************************************************/
  35. #include <wtypes.h>
  36. #include <objidl.h>
  37. /*****************************************************************************
  38. definitions for common.h
  39. *****************************************************************************/
  40. #define SIZEOF_STRINGIZED_CLSID 39
  41. #define MAX_ARRAY_OF_POINTER_ELEMENTS 30
  42. #define MAX_ARRAY 30
  43. /*
  44. This is the structure of the entry made into the class dictionary. The entry
  45. key is the Clsid field. The main data is the CLASSASSOCIATION structure,
  46. which will be used in the IClassAdmin interface methods.
  47. */
  48. typedef char CLSIDString;
  49. typedef CLASSDETAIL CLASSASSOCIATION;
  50. typedef class tagCLASS_ENTRY
  51. {
  52. public:
  53. CLSIDString ClsidString[ SIZEOF_STRINGIZED_CLSID ]; // stringized form of class id.
  54. CLASSASSOCIATION ClassAssociation;
  55. Name_List OtherProgIDs;
  56. Name_List FileExtList;
  57. public:
  58. tagCLASS_ENTRY()
  59. {
  60. memset( ClsidString, '\0', SIZEOF_STRINGIZED_CLSID );
  61. memset( &ClassAssociation, '\0', sizeof( CLASSASSOCIATION ) );
  62. }
  63. ~tagCLASS_ENTRY()
  64. {
  65. }
  66. void SetClsidString( char * StringizedClsid )
  67. {
  68. strcpy( &ClsidString[0], StringizedClsid );
  69. }
  70. CLSIDString *GetClsidString()
  71. {
  72. return &ClsidString[0];
  73. }
  74. void SetClassAssociation( CLASSASSOCIATION *pCA )
  75. {
  76. memcpy( &ClassAssociation, pCA, sizeof( CLASSASSOCIATION ));
  77. }
  78. void GetClassAssociation( CLASSASSOCIATION * pCA )
  79. {
  80. memcpy( pCA, &ClassAssociation, sizeof( CLASSASSOCIATION ) );
  81. }
  82. }CLASS_ENTRY;
  83. /*
  84. This is the structure of the entry made into the iid dictionary. The entry
  85. key is the IID field. The main data is the TypeLib and Clsid fields,
  86. which will be used in the IClassAdmin interface methods. Note that the Clsid
  87. field is the ProxyStubClsid32 field in the interface key in the registry.
  88. */
  89. typedef class tagITF_ENTRY
  90. {
  91. public:
  92. char IID[ SIZEOF_STRINGIZED_CLSID ];
  93. char Clsid[ SIZEOF_STRINGIZED_CLSID ];
  94. char TypelibID[ SIZEOF_STRINGIZED_CLSID ];
  95. public:
  96. tagITF_ENTRY()
  97. {
  98. memset( IID, '\0', SIZEOF_STRINGIZED_CLSID );
  99. memset( Clsid, '\0', SIZEOF_STRINGIZED_CLSID );
  100. memset( TypelibID, '\0', SIZEOF_STRINGIZED_CLSID );
  101. }
  102. void SetIIDString(char * StringizedIID )
  103. {
  104. strcpy( &IID[0], StringizedIID );
  105. }
  106. CLSIDString *GetIIDString()
  107. {
  108. return &IID[0];
  109. }
  110. void SetClsid( char * StringizedClsid )
  111. {
  112. strcpy( &Clsid[0], StringizedClsid );
  113. }
  114. void SetTypelibID( char * StringizedClsid )
  115. {
  116. strcpy( &TypelibID[0], StringizedClsid );
  117. }
  118. } ITF_ENTRY;
  119. /*
  120. This is the structure of the entry made into the package dictionary. The
  121. key is the PID field (Package ID).
  122. */
  123. typedef class tagAPP_ENTRY
  124. {
  125. public:
  126. char AppIDString[ SIZEOF_STRINGIZED_CLSID ];
  127. APPDETAIL AppDetails;
  128. CLSID_List ClsidList;
  129. CLSID_List TypelibList;
  130. Name_List RemoteServerNameList;
  131. public:
  132. tagAPP_ENTRY()
  133. {
  134. memset(AppIDString, '\0', SIZEOF_STRINGIZED_CLSID );
  135. memset(&AppDetails, '\0', sizeof(APPDETAIL) );
  136. }
  137. ~tagAPP_ENTRY()
  138. {
  139. }
  140. void SetAppIDString( char * StringizedClsid )
  141. {
  142. strcpy( &AppIDString[0], StringizedClsid );
  143. }
  144. CLSIDString *GetAppIDString()
  145. {
  146. return &AppIDString[0];
  147. }
  148. void GetAppDetail( APPDETAIL * pDest )
  149. {
  150. memcpy( pDest, &AppDetails, sizeof( APPDETAIL ));
  151. }
  152. void AddClsid( char * Clsid )
  153. {
  154. ClsidList.Add( (unsigned char *)Clsid );
  155. AppDetails.cClasses++;
  156. }
  157. void AddRemoteServerName( char * RemoteServerName )
  158. {
  159. RemoteServerNameList.Add( (unsigned char *)RemoteServerName );
  160. AppDetails.cServers++;
  161. }
  162. void AddTypelib( char * Clsid )
  163. {
  164. TypelibList.Add( (unsigned char *)Clsid );
  165. AppDetails.cTypeLibIds++;
  166. }
  167. int GetClsidCount()
  168. {
  169. return ClsidList.GetCount();
  170. }
  171. int GetRemoteServerCount()
  172. {
  173. return RemoteServerNameList.GetCount();
  174. }
  175. int GetTypelibCount()
  176. {
  177. return TypelibList.GetCount();
  178. }
  179. }APP_ENTRY;
  180. class APPDICT;
  181. class NAMEDICT;
  182. typedef class tagPACKAGE_ENTRY // package entry
  183. {
  184. public:
  185. char PIDString[ SIZEOF_STRINGIZED_CLSID ];
  186. char OriginalName[ _MAX_PATH ]; // remove when not debugging
  187. char PackageName[ _MAX_PATH ];
  188. PACKAGEDETAIL PackageDetails;
  189. APP_ENTRY_List AppEntryList;
  190. NAMEDICT * ClsidsInNullAppid;
  191. NAMEDICT * TypelibsInNullAppid;
  192. NAMEDICT * RemoteServerNamesInNullAppid;
  193. APPDICT * pAppDict;
  194. int Count;
  195. int CountOfClsidsInNullAppid;
  196. int CountOfTypelibsInNullAppid;
  197. int CountOfRemoteServerNamesInNullAppid;
  198. public:
  199. tagPACKAGE_ENTRY();
  200. ~tagPACKAGE_ENTRY();
  201. void SetOriginalName( char * p )
  202. {
  203. strcpy( &OriginalName[0], p );
  204. }
  205. char * GetOriginalName()
  206. {
  207. return ( &OriginalName[0] );
  208. }
  209. void SetPIDString( char * StringizedClsid )
  210. {
  211. strcpy( &PIDString[0], StringizedClsid );
  212. }
  213. CLSIDString *GetPIDString()
  214. {
  215. return &PIDString[0];
  216. }
  217. void SetPackageName( char * pName )
  218. {
  219. strcpy( &PackageName[0], (const char *)pName );
  220. }
  221. void GetPackageDetail( PACKAGEDETAIL * pDest )
  222. {
  223. memcpy( pDest, &PackageDetails, sizeof( PACKAGEDETAIL ));
  224. }
  225. void SetPackageDetail( PACKAGEDETAIL * pSrc )
  226. {
  227. memcpy( &PackageDetails, pSrc, sizeof( PACKAGEDETAIL ));
  228. }
  229. void AddAppEntry( APP_ENTRY * pAppEntry);
  230. APP_ENTRY * SearchAppEntry( char * pAppidString );
  231. void AddClsidToNullAppid( char * pClsidString );
  232. void AddTypelibToNullAppid( char * pTypelibClsidString );
  233. int GetCountOfClsidsInNullAppid()
  234. {
  235. return CountOfClsidsInNullAppid;
  236. }
  237. char * GetFirstClsidInNullAppidList();
  238. int GetCountOfTypelibsInNullAppid()
  239. {
  240. return CountOfTypelibsInNullAppid;
  241. }
  242. char * GetFirstTypelibInNullAppidList();
  243. }PACKAGE_ENTRY;
  244. typedef CLSID * POINTER_TO_CLSID;
  245. typedef APPDETAIL * PAPPDETAIL;
  246. char * StringToCLSID( char * pString, CLSID * pClsid );
  247. void CLSIDToString( CLSID * pClsid, char * pString );
  248. char * StringToULong( char * , unsigned long * );
  249. #endif // __COMMON_HXX__