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.

100 lines
2.8 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CFactory.h
  7. //
  8. // Description:
  9. // Class Factory implementation.
  10. //
  11. // Maintained By:
  12. // Geoffrey Pease (GPease) 22-NOV-1999
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #pragma once
  16. #define CCH(sz) (sizeof(sz)/sizeof(sz[0]))
  17. //
  18. // DLL Globals
  19. //
  20. extern HINSTANCE g_hInstance;
  21. extern LONG g_cObjects;
  22. extern LONG g_cLock;
  23. extern TCHAR g_szDllFilename[ MAX_PATH ];
  24. extern LPVOID g_GlobalMemoryList; // Global memory tracking list
  25. #define DllExport __declspec( dllimport )
  26. #define SCRIPTRES_RESTYPE_NAME L"ScriptRes"
  27. //
  28. // Class Definitions for DLLGetClassObject
  29. //
  30. typedef LPUNKNOWN (*LPCREATEINST)();
  31. typedef struct _ClassTable {
  32. LPCREATEINST pfnCreateInstance; // creation function for class
  33. const CLSID * rclsid; // classes in this DLL
  34. LPCTSTR pszName; // Class name for debugging
  35. LPCTSTR pszComModel; // String indicating COM threading model
  36. } CLASSTABLE[], *LPCLASSTABLE;
  37. //
  38. // Class Table Macros
  39. //
  40. #define BEGIN_CLASSTABLE const CLASSTABLE g_DllClasses = {
  41. #define DEFINE_CLASS( _pfn, _riid, _name, _model ) { _pfn, &_riid, TEXT(_name), TEXT(_model) },
  42. #define END_CLASSTABLE { NULL, NULL, NULL, NULL } };
  43. extern const CLASSTABLE g_DllClasses;
  44. //
  45. // DLL required headers
  46. //
  47. #include "debug.h" // debugging
  48. #include "citracker.h"
  49. #if defined( _X86_ ) && defined( TRACE_INTERFACES_ENABLED )
  50. //
  51. // DLL Interface Table Macros
  52. //
  53. #define BEGIN_INTERFACETABLE const INTERFACE_TABLE g_itTable = {
  54. #define DEFINE_INTERFACE( _iid, _name, _count ) { &_iid, TEXT(_name), _count },
  55. #define END_INTERFACETABLE { NULL, NULL, NULL } };
  56. #else // !TRACE_INTERFACES_ENABLED
  57. #define BEGIN_INTERFACETABLE
  58. #define DEFINE_INTERFACE( _iid, _name, _count )
  59. #define END_INTERFACETABLE
  60. #endif // TRACE_INTERFACES_ENABLED
  61. //
  62. // DLL Useful Macros
  63. //
  64. #define ARRAYSIZE( _x ) ((UINT) ( sizeof( _x ) / sizeof( _x[ 0 ] ) ))
  65. #define PtrToByteOffset(base, offset) (((LPBYTE)base)+offset)
  66. #define StrLen( _sz ) lstrlen( _sz ) // why isn't this in SHLWAPI?
  67. //
  68. // COM Macros to gain type checking.
  69. //
  70. #define TypeSafeParams( _interface, _ppunk ) \
  71. IID_##_interface, reinterpret_cast<void**>( static_cast<_interface **>( _ppunk ) )
  72. #define TypeSafeQI( _interface, _ppunk ) \
  73. QueryInterface( TypeSafeParams( _interface, _ppunk ) )
  74. #define TypeSafeQS( _clsid, _interface, _ppunk ) \
  75. QueryService( _clsid, TypeSafeParams( _interface, _ppunk ) )
  76. //
  77. // DLL Global Function Prototypes
  78. //
  79. HRESULT
  80. HrClusCoCreateInstance(
  81. REFCLSID rclsidIn,
  82. LPUNKNOWN pUnkOuterIn,
  83. DWORD dwClsContextIn,
  84. REFIID riidIn,
  85. LPVOID * ppvOut
  86. );