priv.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 5k
Category:

Windows Kernel

Development Platform:

Visual C++

  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 ccshellinc
  16. // #include <shellp.h>     // in ccshellinc
  17. // #include <debug.h>      // in ccshellinc
  18. // #include <shguidp.h>    // in ccshellinc
  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"01Ole10Native"
  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. } PANETYPE;
  82. //////////////////////////////////
  83. // Embedded File structure
  84. //
  85. // NOTE: This is similar to the structure used by the old packager to store
  86. // information about the embedded file, however it is slightly different.
  87. // Most notably, I use a FILEDESCRIPTOR structure to hold onto the filename
  88. // and filesize so this information can be easily transferred in a GetData call
  89. // Also, I've deleted some uncessary fields that the old packager used to 
  90. // deal with OLE 1 ways of dealing with things.
  91. typedef struct _EMBED           // embed
  92. {
  93.     FILEDESCRIPTOR fd;          // file descriptor of embedded file
  94.     LPTSTR  pszTempName;         // temp. file name used when shellexec'ing
  95.     HANDLE hTask;               // handle to task on shellexec'ed objects
  96.     LPOLEOBJECT poo;            // oleobject interface on running contents
  97.     BOOL   fIsOleFile;          // TRUE if OLE can activate this type of file
  98. } EMBED, *LPEMBED;
  99. //////////////////////////////////
  100. // Command line structure
  101. //
  102. // NOTE: This is the structure the old packager used when implementing
  103. // the command line packages.  It will be best to use this structure for
  104. // the new packager for ease of use in reading and writing old packager
  105. // formats.
  106. //
  107. typedef struct _CML             // cml
  108. {
  109.     BOOL fCmdIsLink;
  110.     TCHAR szCommandLine[CBCMDLINKMAX];
  111. } CML, *LPCML;
  112. ////////////////////////////////
  113. // PackageInfo Structure
  114. //
  115. // NOTE: This structure is used by the Create New Package Wizard and the
  116. // Edit Package dialogs.  We use it to hold onto package information, so that
  117. // the CPackage Object can initialize/reinitialize itself after one of these
  118. // calls.
  119. //
  120. typedef struct _packageInfo 
  121. {
  122. TCHAR szLabel[MAX_PATH];
  123. TCHAR szFilename[MAX_PATH];
  124. TCHAR szIconPath[MAX_PATH];
  125. int  iIcon;     // must be an int for PickIconDlg
  126. } PACKAGER_INFO, *LPPACKAGER_INFO;
  127. ////////////////////////////////
  128. // PersistStorage enumeration
  129. //
  130. typedef enum
  131. {
  132.         PSSTATE_UNINIT = 0,     //Uninitialized
  133.         PSSTATE_SCRIBBLE,   //Scribble
  134.         PSSTATE_ZOMBIE,     //No scribble
  135.         PSSTATE_HANDSOFF    //Hand-off
  136. } PSSTATE;
  137. #endif
  138. #include "debug.h"
  139. #define ARRAYSIZE(a)    (sizeof(a)/sizeof(a[0]))