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.

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