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.

171 lines
5.4 KiB

  1. #ifndef pack2_h__
  2. #define pack2_h__
  3. #define INC_OLE2 // Prevent windows.h from pulling in OLE 1
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <stdlib.h>
  7. #include <shlobj.h> // ;Internal
  8. #include <shellapi.h> // ;Internal
  9. #include <shlwapi.h>
  10. #include <shlwapip.h> // ;Internal
  11. #include <ole2.h>
  12. #include <ole2ver.h>
  13. // #include <crtfree.h> // don't use CRT libs
  14. #include <ccstock.h>
  15. // #include <shsemip.h> // in ccshell\inc
  16. // #include <shellp.h> // in ccshell\inc
  17. // #include <debug.h> // in ccshell\inc
  18. // #include <shguidp.h> // in ccshell\inc
  19. #define STRSAFE_NO_DEPRECATE
  20. #include <strsafe.h>
  21. #include "packutil.h"
  22. #include "packguid.h"
  23. #include "ids.h"
  24. HRESULT CPackage_CreateInstance(IUnknown ** ppunk);
  25. //////////////////////////////////
  26. // External Variables
  27. //
  28. #define USE_RESOURCE_DLL 1
  29. extern LONG g_cRefThisDll; // per-instance
  30. extern HINSTANCE g_hinst;
  31. extern HINSTANCE g_hinstResDLL;
  32. extern UINT g_cfFileContents;
  33. extern UINT g_cfFileDescriptor;
  34. extern UINT g_cfObjectDescriptor;
  35. extern UINT g_cfEmbedSource;
  36. extern UINT g_cfFileNameW;
  37. extern INT g_cxIcon;
  38. extern INT g_cyIcon;
  39. extern INT g_cxArrange;
  40. extern INT g_cyArrange;
  41. extern HFONT g_hfontTitle;
  42. //////////////////////////////////
  43. // Global Constants
  44. //
  45. #define HIMETRIC_PER_INCH 2540 // Number of HIMETRIC units per inch
  46. #define DEF_LOGPIXELSX 96 // Default values for pixels per
  47. #define DEF_LOGPIXELSY 96 // logical inch
  48. #define CBCMDLINKMAX 500 // num chars in cmdline package
  49. #define FILE_SHARE_READWRITE (FILE_SHARE_READ | FILE_SHARE_WRITE)
  50. #define OLEIVERB_EDITPACKAGE (OLEIVERB_PRIMARY+1)
  51. #define OLEIVERB_FIRST_CONTEXT (OLEIVERB_PRIMARY+2)
  52. #define OLEIVERB_LAST_CONTEXT (OLEIVERB_PRIMARY+0xFFFF)
  53. #define PACKWIZ_NUM_PAGES 2 // number of pages in our wizard
  54. //////////////////////////////////
  55. // Clipboard Formats
  56. //
  57. #define CF_FILECONTENTS g_cfFileContents
  58. #define CF_FILEDESCRIPTOR g_cfFileDescriptor
  59. #define CF_OBJECTDESCRIPTOR g_cfObjectDescriptor
  60. #define CF_EMBEDSOURCE g_cfEmbedSource
  61. #define CF_FILENAMEW g_cfFileNameW
  62. #define CFSTR_EMBEDSOURCE TEXT("Embed Source")
  63. #define CFSTR_OBJECTDESCRIPTOR TEXT("Object Descriptor")
  64. //////////////////////////////////
  65. // String constants
  66. //
  67. #define SZUSERTYPE L"OLE Package"
  68. #define SZCONTENTS L"\001Ole10Native"
  69. #define SZAPPNAME TEXT("Object Packager")
  70. //////////////////////////////////
  71. // Old packager junk...
  72. //
  73. // NOTE: This enumeration is used to determine what kind of information
  74. // is stored in a packager object. Currently, the new packager on supports
  75. // ICON and PEMBED. We will probably want to implement CMDLINK and PICTURE
  76. // to remain back compatible with the old packager.
  77. //
  78. typedef enum
  79. {
  80. NOTHING,
  81. CMDLINK,
  82. ICON,
  83. PEMBED,
  84. PICTURE,
  85. PACKAGE
  86. } PANETYPE;
  87. //////////////////////////////////
  88. // Embedded File structure
  89. //
  90. // NOTE: This is similar to the structure used by the old packager to store
  91. // information about the embedded file, however it is slightly different.
  92. // Most notably, I use a FILEDESCRIPTOR structure to hold onto the filename
  93. // and filesize so this information can be easily transferred in a GetData call
  94. // Also, I've deleted some uncessary fields that the old packager used to
  95. // deal with OLE 1 ways of dealing with things.
  96. typedef struct _EMBED // embed
  97. {
  98. FILEDESCRIPTOR fd; // file descriptor of embedded file
  99. LPTSTR pszTempName; // temp. file name used when shellexec'ing
  100. HANDLE hTask; // handle to task on shellexec'ed objects
  101. LPOLEOBJECT poo; // oleobject interface on running contents
  102. BOOL fIsOleFile; // TRUE if OLE can activate this type of file
  103. } EMBED, *LPEMBED;
  104. //////////////////////////////////
  105. // Command line structure
  106. //
  107. // NOTE: This is the structure the old packager used when implementing
  108. // the command line packages. It will be best to use this structure for
  109. // the new packager for ease of use in reading and writing old packager
  110. // formats.
  111. //
  112. typedef struct _CML // cml
  113. {
  114. BOOL fCmdIsLink;
  115. TCHAR szCommandLine[CBCMDLINKMAX];
  116. } CML, *LPCML;
  117. ////////////////////////////////
  118. // PackageInfo Structure
  119. //
  120. // NOTE: This structure is used by the Create New Package Wizard and the
  121. // Edit Package dialogs. We use it to hold onto package information, so that
  122. // the CPackage Object can initialize/reinitialize itself after one of these
  123. // calls.
  124. //
  125. typedef struct _packageInfo
  126. {
  127. TCHAR szLabel[MAX_PATH];
  128. TCHAR szFilename[MAX_PATH];
  129. TCHAR szIconPath[MAX_PATH];
  130. int iIcon; // must be an int for PickIconDlg
  131. BOOL bUseCommandLine;
  132. } PACKAGER_INFO, *LPPACKAGER_INFO;
  133. ////////////////////////////////
  134. // PersistStorage enumeration
  135. //
  136. typedef enum
  137. {
  138. PSSTATE_UNINIT = 0, //Uninitialized
  139. PSSTATE_SCRIBBLE, //Scribble
  140. PSSTATE_ZOMBIE, //No scribble
  141. PSSTATE_HANDSOFF //Hand-off
  142. } PSSTATE;
  143. #endif
  144. #include "debug.h"
  145. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))