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.

151 lines
5.4 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. #define MI_REG_INVALID 8 // Cached info in registry is invalid
  34. //
  35. // These values are larger than the NEWCPLINFO structure because some
  36. // languages (German, for example) can't fit "Scanners and Cameras" into
  37. // just 32 characters of NEWCPLINFO.szName, and even in English,
  38. // you can't fit very much helptext into only 64 characters of
  39. // NEWCPLINFO.szInfo. (The Network applet writes a small novel for its
  40. // helptext.)
  41. //
  42. #define MAX_CCH_CPLNAME MAX_PATH // Arbitrary
  43. #define MAX_CCH_CPLINFO 512 // Arbitrary
  44. typedef struct
  45. {
  46. UINT cbSize; // We write the first cbSize bytes of this
  47. // structure to the registry. This saves about
  48. // 250 bytes per structure in the registry.
  49. BOOL flags;
  50. // what file does this CPL come from?
  51. // UINT oFileName; // file name // always 0, so don't need it
  52. FILETIME ftCreationTime;// WIN32_FIND_DATA.ftCreationTime
  53. DWORD nFileSizeHigh; // WIN32_FIND_DATA.nFileSizeHigh
  54. DWORD nFileSizeLow; // WIN32_FIND_DATA.nFileSizeLow
  55. // what's the display info for this CPL?
  56. int idIcon;
  57. UINT oName; // (icon title) short name
  58. UINT oInfo; // (details view) description
  59. // buffer for information
  60. TCHAR buf[MAX_PATH + // oFileName
  61. MAX_CCH_CPLNAME + // oName
  62. MAX_CCH_CPLINFO]; // oInfo
  63. } REG_CPL_INFO;
  64. // flags:
  65. #define REGCPL_FROMREG 0x0001 // this REG_CPL_INFO was loaded from the registry
  66. // (used to optimize reading from registry)
  67. #define REGCPL_POST_102001 0x0002 // Record created after October 2001.
  68. // helper defines:
  69. #define REGCPL_FILENAME(pRegCPLInfo) ((pRegCPLInfo)->buf)
  70. #define REGCPL_CPLNAME(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oName]))
  71. #define REGCPL_CPLINFO(pRegCPLInfo) (&((pRegCPLInfo)->buf[(pRegCPLInfo)->oInfo]))
  72. // Information about control modules and individual controls
  73. //
  74. typedef struct // cpli
  75. {
  76. int idControl; // control index
  77. HICON hIcon; // handle of icon
  78. int idIcon; // ID of the icon (used for links)
  79. LPTSTR pszName; // ptr to name string
  80. LPTSTR pszInfo; // ptr to info string
  81. LPTSTR pszHelpFile; // help file
  82. LONG_PTR lData; // user supplied data
  83. DWORD dwContext; // help context
  84. } CPLITEM, *LPCPLITEM;
  85. typedef struct // minst
  86. {
  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[MAX_PATH];
  96. union
  97. {
  98. APPLET_PROC lpfnCPL32; // minst.fIs16bit=FALSE
  99. FARPROC lpfnCPL; // for opaque operation
  100. };
  101. HDSA hacpli; // array of CPLITEM structs
  102. HANDLE hActCtx;
  103. } CPLMODULE, *PCPLMODULE, *LPCPLMODULE;
  104. LRESULT CPL_CallEntry(LPCPLMODULE, HWND, UINT, LPARAM, LPARAM);
  105. void CPL_StripAmpersand(LPTSTR szBuffer);
  106. BOOL CPL_Init(HINSTANCE hinst);
  107. int _FindCPLModuleByName(LPCTSTR pszModule);
  108. LPCPLMODULE CPL_LoadCPLModule(LPCTSTR szModule);
  109. int CPL_FreeCPLModule(LPCPLMODULE pcplm);
  110. void CPLD_Destroy(PControlData lpData);
  111. BOOL CPLD_GetModules(PControlData lpData);
  112. void CPLD_GetRegModules(PControlData lpData);
  113. int CPLD_InitModule(PControlData lpData, int nModule, MINST *lphModule);
  114. BOOL CPLD_AddControlToReg(PControlData lpData, const MINST * pminst, int nControl);
  115. void CPLD_FlushRegModules(PControlData lpData);
  116. STDAPI_(HRESULT) MakeCPLCommandLine(LPCTSTR pszModule, LPCTSTR pszName, LPTSTR pszCommandLine, DWORD cchCommandLine);
  117. HRESULT CALLBACK CControls_DFMCallBackBG(LPSHELLFOLDER psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam);
  118. IShellFolderViewCB* Controls_CreateSFVCB(IShellFolder* psf, LPCITEMIDLIST pidl);
  119. LPCPLMODULE FindCPLModule(const MINST * pminst);
  120. #ifdef __cplusplus
  121. };
  122. #endif