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.

150 lines
5.2 KiB

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