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

Windows Kernel

Development Platform:

Visual C++

  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. #include <cpl.h>
  5. #include "shell32p.h"
  6. extern TCHAR const c_szCPLCache[];
  7. extern TCHAR const c_szCPLData[];
  8. // Structures used to enumerate CPLs.
  9. //
  10. typedef struct
  11. {
  12.     HDSA    haminst;        // MINST for each loaded dll
  13.     
  14.     HDSA    hamiModule;     // Array of MODULEINFOs of modules in system
  15.     int     cModules;       // size of hamiModule
  16.     
  17.     LPBYTE  pRegCPLBuffer;  // Buffer for hRegCPLs (read from registry)
  18.     HDPA    hRegCPLs;       // Array of RegCPLInfo structs from registry
  19.     int     cRegCPLs;       // size of hRegCPLs
  20.     BOOL    fRegCPLChanged; // TRUE iff hRegCPLs changed
  21. } ControlData, *PControlData;
  22. typedef struct
  23. {
  24.     LPTSTR  pszModule;      // Name of .cpl module
  25.     LPTSTR  pszModuleName;  // points into pszModule to the name sans path
  26.     
  27.     BOOL    flags;          // MI_ flags defined below
  28.     
  29.     FILETIME ftCreationTime;// WIN32_FIND_DATA.ftCreationTime
  30.     DWORD   nFileSizeHigh;  // WIN32_FIND_DATA.nFileSizeHigh
  31.     DWORD   nFileSizeLow;   // WIN32_FIND_DATA.nFileSizeLow
  32. } MODULEINFO, *PMODULEINFO;
  33. // flags:
  34. #define MI_FIND_FILE  1 // WIN32_FIND_FILE info filled in
  35. #define MI_REG_ENUM   2 // Module already enumerated thru registry
  36. #define MI_CPL_LOADED 4 // CPLD_InitModule called for this module
  37. typedef struct tagRegCPLInfo
  38. {
  39.     UINT    cbSize;         // We write the first cbSize bytes of this
  40.     // structure to the registry.  This saves about
  41.     // 250 bytes per structure in the registry.
  42.     BOOL    flags;
  43.     
  44.     // what file does this CPL come from?
  45.     //      UINT    oFileName;      // file name // always 0, so don't need it
  46.     FILETIME ftCreationTime;// WIN32_FIND_DATA.ftCreationTime
  47.     DWORD   nFileSizeHigh;  // WIN32_FIND_DATA.nFileSizeHigh
  48.     DWORD   nFileSizeLow;   // WIN32_FIND_DATA.nFileSizeLow
  49.     
  50.     // what's the display info for this CPL?
  51.     int     idIcon;
  52.     UINT    oName;          // (icon title) short name
  53.     UINT    oInfo;          // (details view) description
  54.     
  55.     // buffer for information
  56.     TCHAR   buf[MAX_PATH +  // oFileName
  57.         32 +                // oName
  58.         64];                // oInfo
  59. } RegCPLInfo;
  60. typedef RegCPLInfo * PRegCPLInfo;
  61. // flags:
  62. #define REGCPL_FROMREG  0x0001  // this RegCPLInfo was loaded from the registry
  63.                                 // (used to optimize reading from registry)
  64. // helper defines:
  65. #define REGCPL_FILENAME(pRegCPLInfo) ((pRegCPLInfo)->buf)
  66. #define REGCPL_CPLNAME(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oName]))
  67. #define REGCPL_CPLINFO(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oInfo]))
  68. // Information about control modules and individual controls
  69. //
  70. typedef struct // cpli
  71. {
  72.     int     idControl;      // control index
  73.     HICON   hIcon;          // handle of icon
  74.     int     idIcon;         // ID of the icon (used for links)
  75.     LPTSTR  pszName;        // ptr to name string
  76.     LPTSTR  pszInfo;        // ptr to info string
  77.     LPTSTR  pszHelpFile;    // help file
  78.     LONG_PTR lData;         // user supplied data
  79.     DWORD   dwContext;      // help context
  80. } CPLITEM, *LPCPLITEM;
  81. typedef struct // minst
  82. {
  83.     BOOL        fIs16bit;
  84. #ifdef WX86
  85.     BOOL        fIsX86Dll;      // TRUE if dll is an x86 dll
  86. #endif
  87.     HINSTANCE   hinst;          // either a 16 or 32 bit HINSTANCE (fIs16bit)
  88.     DWORD       idOwner;        // process id of owner (system unique)
  89.     HANDLE      hOwner;         // keeps id valid (against reuse)
  90. } MINST;
  91. typedef struct // cplm
  92. {
  93.     int             cRef;
  94.     MINST           minst;
  95.     TCHAR           szModule[MAXPATHLEN];
  96.     union
  97.     {
  98.         FARPROC16   lpfnCPL16;      // minst.fIs16bit=TRUE
  99.         APPLET_PROC lpfnCPL32;      // minst.fIs16bit=FALSE
  100.         FARPROC     lpfnCPL;        // for opaque operation
  101.     };
  102.     HDSA            hacpli;         // array of CPLITEM structs
  103. } CPLMODULE, *PCPLMODULE, *LPCPLMODULE;
  104. //
  105. //  These values are larger than the NEWCPLINFO structure because some
  106. //  languages (German, for example) can't fit "Scanners and Cameras" into
  107. //  just 32 characters of NEWCPLINFO.szName, and even in English,
  108. //  you can't fit very much helptext into only 64 characters of
  109. //  NEWCPLINFO.szInfo.  (The Network applet writes a small novel for its
  110. //  helptext.)
  111. //
  112. #define MAX_CCH_CPLNAME     MAX_PATH    // Arbitrary
  113. #define MAX_CCH_CPLINFO     512         // Arbitrary
  114. LRESULT CPL_CallEntry(LPCPLMODULE, HWND, UINT, LPARAM, LPARAM);
  115. void CPL_StripAmpersand(LPTSTR szBuffer);
  116. BOOL CPL_Init(HINSTANCE hinst);
  117. int _FindCPLModuleByName(LPCTSTR pszModule);
  118. LPCPLMODULE CPL_LoadCPLModule(LPCTSTR szModule);
  119. int CPL_FreeCPLModule(LPCPLMODULE pcplm);
  120. void CPLD_Destroy(PControlData lpData);
  121. BOOL CPLD_GetModules(PControlData lpData);
  122. void CPLD_GetRegModules(PControlData lpData);
  123. int CPLD_InitModule(PControlData lpData, int nModule, MINST *lphModule);
  124. void CPLD_AddControlToReg(PControlData lpData, const MINST * pminst, int nControl);
  125. void CPLD_FlushRegModules(PControlData lpData);
  126. STDAPI_(int) MakeCPLCommandLine(LPCTSTR pszModule, LPCTSTR pszName, LPTSTR pszCommandLine, DWORD cchCommandLine);
  127. HRESULT CALLBACK CControls_DFMCallBackBG(LPSHELLFOLDER psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam);
  128. IShellFolderViewCB* Controls_CreateSFVCB(IShellFolder* psf, LPCITEMIDLIST pidl);
  129. LPCPLMODULE FindCPLModule(const MINST * pminst);
  130. #ifdef __cplusplus
  131. };
  132. #endif