shellext.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef _SHELLEXT_H
  19. #define _SHELLEXT_H
  20. #define MAX_TEXTURES_INFILE 32
  21. #define MAX_TEXUTRE_NAME_LEN 32
  22. #define MAX_MESH 128
  23. #define MAX_ANIMS_INFILE 16
  24. //#define ODS(sz) OutputDebugString(sz)
  25. //#define ENABLE_MSG2
  26. //#define ENABLE_MSG
  27. //#define ENABLE_MSG3
  28. #if defined ENABLE_MSG
  29. #define ODS(sz) MessageBox(NULL, sz, "Debug Message", MB_OK)
  30. #else
  31. #define ODS(sz)
  32. #endif
  33. #if defined ENABLE_MSG2
  34. #define ODS2(sz) MessageBox(NULL, sz, "Debug Message", MB_OK)
  35. #else
  36. #define ODS2(sz)
  37. #endif
  38. #if defined ENABLE_MSG3
  39. #define ODS3(sz) MessageBox(NULL, sz, "Debug Message", MB_OK)
  40. #else
  41. #define ODS3(sz)
  42. #endif
  43. #include "W3D_File.h"
  44. #include "wdump.h"
  45. #include "WdumpDoc.h"
  46. //#include "w3d2dat.h" /// LFeenanEA: Header file missing, perhaps this tool is outdated?
  47. class CWdumpDoc;
  48. // {556F8779-49C4-4e88-9CEF-0AC2CFD6B763}
  49. DEFINE_GUID(CLSID_ShellExtension, 0x556f8779L, 0x49c4, 0x4e88, 0x9c, 0xef, 0x0a, 0xc2, 0xcf, 0xd6, 0xb7, 0x63 );
  50. class CShellExtClassFactory : public IClassFactory
  51. {
  52. protected:
  53. ULONG m_cRef;
  54. public:
  55. CShellExtClassFactory();
  56. ~CShellExtClassFactory();
  57. //IUnknown members
  58. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  59. STDMETHODIMP_(ULONG) AddRef();
  60. STDMETHODIMP_(ULONG) Release();
  61. //IClassFactory members
  62. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
  63. STDMETHODIMP LockServer(BOOL);
  64. };
  65. typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY;
  66. class CShellExt : public IContextMenu,
  67. IShellExtInit,
  68. IExtractIcon,
  69. IPersistFile,
  70. IShellPropSheetExt,
  71. ICopyHook{
  72. public:
  73. char m_SelectedFile[MAX_PATH];
  74. void Read_SelectedFile();
  75. protected:
  76. // ITEMIDLIST m_idFolder;
  77. ULONG m_cRef;
  78. LPDATAOBJECT m_pDataObj;
  79. char m_szFileUserClickedOn[MAX_PATH];
  80. STDMETHODIMP DoW3DMenu1(HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd,LPCSTR pszParam, int iShowCmd);
  81. public:
  82. bool NotAdded(char* name);
  83. void Read_Selection(W3dMeshHeader3Struct&, W3D_HTree&, W3D_HAnim** );
  84. CShellExt();
  85. ~CShellExt();
  86. //IUnknown members
  87. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  88. STDMETHODIMP_(ULONG) AddRef();
  89. STDMETHODIMP_(ULONG) Release();
  90. //IShell members
  91. STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
  92. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
  93. STDMETHODIMP GetCommandString(UINT idCmd, UINT uFlags, UINT FAR *reserved, LPSTR pszName, UINT cchMax);
  94. //IShellExtInit methods
  95. STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
  96. //IExtractIcon methods
  97. STDMETHODIMP GetIconLocation(UINT uFlags,LPSTR szIconFile,UINT cchMax,int *piIndex,UINT *pwFlags);
  98. STDMETHODIMP Extract(LPCSTR pszFile,UINT nIconIndex,HICON *phiconLarge,HICON *phiconSmall,UINT nIconSize);
  99. //IPersistFile methods
  100. STDMETHODIMP GetClassID(LPCLSID lpClassID);
  101. STDMETHODIMP IsDirty();
  102. STDMETHODIMP Load(LPCOLESTR lpszFileName, DWORD grfMode);
  103. STDMETHODIMP Save(LPCOLESTR lpszFileName, BOOL fRemember);
  104. STDMETHODIMP SaveCompleted(LPCOLESTR lpszFileName);
  105. STDMETHODIMP GetCurFile(LPOLESTR FAR* lplpszFileName);
  106. //IShellPropSheetExt methods
  107. STDMETHODIMP AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  108. STDMETHODIMP ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam);
  109. //ICopyHook method
  110. STDMETHODIMP_(UINT) CopyCallback(HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,LPCSTR pszDestFile, DWORD dwDestAttribs);
  111. public:
  112. W3dAnimHeaderStruct m_AnimInfos[MAX_ANIMS_INFILE];
  113. W3dHierarchyStruct m_Hierarchies[MAX_ANIMS_INFILE];
  114. CString m_Textures[MAX_TEXTURES_INFILE];
  115. int m_NumAdded;
  116. bool m_FileInMemory;
  117. CWdumpDoc m_WdumpDocument;
  118. int m_FoundMeshes;
  119. W3dMeshHeader3Struct m_Meshes[MAX_MESH];
  120. };
  121. typedef CShellExt *LPCSHELLEXT;
  122. #endif // _SHELLEXT_H