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.

355 lines
17 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: cdoptimp.h
  3. *
  4. * Copyright (c) 1998 Microsoft Corporation. All rights reserved.
  5. \**************************************************************************/
  6. #if !defined(CDOPT_COM_IMPLEMENTATION)
  7. #define CDOPT_COM_IMPLEMENTATION
  8. #if _MSC_VER >= 1000
  9. #pragma once
  10. #endif // _MSC_VER >= 1000
  11. #ifndef _WIN32_WINNT
  12. #define _WIN32_WINNT 0x0400
  13. #endif
  14. #include "cdopt.h"
  15. #include <windows.h>
  16. #include <windowsx.h>
  17. #include <wincrypt.h>
  18. #include "..\cdnet\cdnet.h"
  19. /////////////////////////////////////////////////////////////////////////////
  20. // Internal Defines
  21. #define CDINFO_NOEDIT (0x0000)
  22. #define CDINFO_EDIT (0x0001)
  23. #define CDINFO_TRACK (CDINFO_EDIT | 0x0010)
  24. #define CDINFO_TITLE (CDINFO_EDIT | 0x0020)
  25. #define CDINFO_ARTIST (CDINFO_EDIT | 0x0040)
  26. #define CDINFO_DISC (CDINFO_NOEDIT | 0x0020)
  27. #define CDINFO_ALBUMS (CDINFO_NOEDIT | 0x0080)
  28. #define CDINFO_DRIVES (CDINFO_NOEDIT | 0x0100)
  29. #define CDINFO_LABEL (CDINFO_NOEDIT | 0x0200)
  30. #define CDINFO_CDROM (CDINFO_NOEDIT | 0x0400)
  31. #define CDINFO_OTHER (CDINFO_NOEDIT | 0x0800)
  32. #define DG_BEGINDRAG (LB_MSGMAX+100)
  33. #define DG_DRAGGING (LB_MSGMAX+101)
  34. #define DG_DROPPED (LB_MSGMAX+102)
  35. #define DG_CANCELDRAG (LB_MSGMAX+103)
  36. #define DG_CURSORSET 0
  37. #define DG_MOVE 0
  38. #define DG_COPY 1
  39. #define SJE_DRAGLISTMSGSTRING "sje_DragMultiListMsg"
  40. #define TRACK_TITLE_LENGTH 255
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Internal Structures
  43. typedef struct DRAGMULTILISTINFO
  44. {
  45. UINT uNotification;
  46. HWND hWnd;
  47. POINT ptCursor;
  48. DWORD dwState;
  49. } DRAGMULTILISTINFO, *LPDRAGMULTILISTINFO;
  50. typedef struct LIST_INFO
  51. {
  52. int index;
  53. UINT_PTR dwData;
  54. TCHAR chName[TRACK_TITLE_LENGTH];
  55. } LIST_INFO, *LPLIST_INFO;
  56. typedef struct CDTREEINFO
  57. {
  58. LPCDTITLE pCDTitle;
  59. DWORD dwTrack;
  60. DWORD fdwType;
  61. LPCDUNIT pCDUnit;
  62. } CDTREEINFO, *LPCDTREEINFO;
  63. typedef struct CDCONTROL // UI Tree node for Controls
  64. {
  65. TCHAR szName[MIXER_LONG_NAME_CHARS];
  66. DWORD dwVolID;
  67. DWORD dwMuteID;
  68. CDCONTROL *pNext;
  69. } CDCONTROL, *LPCDCONTROL;
  70. typedef struct CDMIXER // UI Tree node for mixers
  71. {
  72. DWORD dwMixID;
  73. TCHAR szPname[MAXPNAMELEN];
  74. CDMIXER *pNext;
  75. LPCDCONTROL pControlList;
  76. LPCDCONTROL pCurrentControl;
  77. LPCDCONTROL pOriginalControl;
  78. LPCDCONTROL pDefaultControl;
  79. } CDMIXER, *LPCDMIXER;
  80. typedef struct CDDRIVE // UI Tree node for CD players
  81. {
  82. TCHAR szDriveName[MAX_PATH];
  83. TCHAR szDeviceDesc[MAX_PATH];
  84. CDDRIVE *pNext;
  85. LPCDMIXER pMixerList;
  86. LPCDMIXER pCurrentMixer;
  87. LPCDMIXER pOriginalMixer;
  88. BOOL fSelected;
  89. } CDDRIVE, *LPCDDRIVE;
  90. typedef struct CDKEY
  91. {
  92. HCRYPTPROV hProv;
  93. HCRYPTKEY hKey;
  94. HCRYPTHASH hHash;
  95. } CDKEY, *LPCDKEY;
  96. /////////////////////////////////////////////////////////////////////////////
  97. // CCDOpt
  98. class CCDOpt : public ICDOpt
  99. {
  100. public:
  101. CCDOpt();
  102. ~CCDOpt();
  103. public:
  104. // IUnknown
  105. STDMETHOD (QueryInterface) (REFIID riid, LPVOID *ppvObj);
  106. STDMETHOD_(ULONG,AddRef) (void);
  107. STDMETHOD_(ULONG,Release) (void);
  108. // ICDOpt
  109. STDMETHOD_(LPCDOPTIONS, GetCDOpts) (void);
  110. STDMETHOD (CreateProviderList) (LPCDPROVIDER *ppProviderList);
  111. STDMETHOD_(void,DestroyProviderList) (LPCDPROVIDER *ppProviderList);
  112. STDMETHOD_(void,UpdateRegistry) (void);
  113. STDMETHOD (OptionsDialog) (HWND hWnd, LPCDDATA pCDData, CDOPT_PAGE nStartPage);
  114. STDMETHOD_(BOOL,VerifyProvider) (LPCDPROVIDER pCDProvider, TCHAR *szCertKey);
  115. STDMETHOD (CreateProviderKey) (LPCDPROVIDER pCDProvider, TCHAR *szCertKey, UINT cBytes);
  116. STDMETHOD_(void,DownLoadCompletion) (DWORD dwNumIDs, LPDWORD pdwIDs);
  117. STDMETHOD_(void,DiscChanged) (LPCDUNIT pCDUnit);
  118. STDMETHOD_(void,MMDeviceChanged) (void);
  119. private:
  120. DWORD m_dwRef;
  121. HINSTANCE m_hInst; // hInstance of caller
  122. LPCDOPTIONS m_pCDOpts; // Original Opts from reg
  123. LPCDOPTIONS m_pCDCopy; // Current Working copy while UI is up.
  124. LPCDDATA m_pCDData; // Reference to CD Database Object
  125. LPCDDRIVE m_pCDTree; // Internal tree for CD/Mixer/Control Tree (Control line picker dialog)
  126. LPCDDRIVE m_pCDSelected; // Stores originally selected drive
  127. HIMAGELIST m_hImageList; // List of icon's for treeview of titles
  128. LPCDTITLE m_pCDTitle; // Used by Title Editor Dialog
  129. LPCDTITLE m_pCDUploadTitle; // Used to upload a title to net
  130. LRESULT m_dwTrack;
  131. HWND m_hList;
  132. WNDPROC m_pfnSubProc; // Used to subclass the Tree control
  133. BOOL m_fEditReturn; // True if user ended edit with a return in treeview
  134. BOOL m_fVolChanged; // True if there has been a change to the volume configuration
  135. BOOL m_fAlbumsExpanded; // True if database is expanded in tree
  136. BOOL m_fDrivesExpanded; // True if drivelist is expanded in tree
  137. HWND m_hTitleWnd; // Title Options dialog hwnd
  138. HDC m_hdcMem; // Temporary hdc used to draw the track bitmap.
  139. HBITMAP m_hbmTrack; // HBITMAP to be displayed beside the tracks
  140. UINT m_DragMessage; // Message ID of drag drop interface
  141. HCURSOR m_hCursorDrop; // Drops allowed cursor
  142. HCURSOR m_hCursorNoDrop; // Drops not allowed cursor
  143. HCURSOR m_hCursorDropCpy; // Drop copies the selection
  144. UINT m_uDragListMsg;
  145. ICDNet * m_pICDNet; // Pointer to internet object for uploading title info
  146. static WNDPROC s_fpCbEditProcOrg;
  147. bool m_fDelayUpdate;
  148. // playopts.cpp
  149. static INT_PTR CALLBACK PlayerOptionsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  150. static INT_PTR CALLBACK PlayListsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  151. static INT_PTR CALLBACK TitleOptionsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  152. static INT_PTR CALLBACK ListEditorProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  153. static INT_PTR CALLBACK MixerConfigProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  154. static LRESULT CALLBACK SubProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  155. static LRESULT CALLBACK DragListProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  156. static INT_PTR CALLBACK UploadProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  157. static INT_PTR CALLBACK ConfirmProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  158. static LRESULT CALLBACK CbEditProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  159. STDMETHOD_(INT_PTR,PlayerOptions) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  160. STDMETHOD_(INT_PTR,PlayLists) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  161. STDMETHOD_(INT_PTR,TitleOptions) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  162. STDMETHOD_(void,OrderProviders) (LPCDPROVIDER *ppProviderList, LPCDPROVIDER pCurrentProvider);
  163. STDMETHOD_(void,ApplyCurrentSettings) (void);
  164. STDMETHOD_(void,ToggleApplyButton) (HWND hDlg);
  165. STDMETHOD (AcquireKey) (LPCDKEY pCDKey, char *szName);
  166. STDMETHOD_(void,ReleaseKey) (LPCDKEY pCDKey);
  167. STDMETHOD (CreateCertString) (LPCDPROVIDER pCDProvider, TCHAR *szCertStr);
  168. STDMETHOD_(void,RegGetByte) (HKEY hKey, const TCHAR *szKey, LPBYTE pByte, BYTE bDefault);
  169. STDMETHOD_(void,RegGetDWORD) (HKEY hKey, const TCHAR *szKey, LPDWORD pdwData, DWORD dwDefault);
  170. STDMETHOD_(void,RegSetByte) (HKEY hKey, const TCHAR *szKey, BYTE bData);
  171. STDMETHOD_(void,RegSetDWORD) (HKEY hKey, const TCHAR *szKey, DWORD dwData);
  172. STDMETHOD_(BOOL,GetUploadPrompt) (void);
  173. STDMETHOD_(void,SetUploadPrompt) (BOOL fConfirmUpload);
  174. STDMETHOD (GetCDData) (LPCDOPTDATA pCDData);
  175. STDMETHOD (SetCDData) (LPCDOPTDATA pCDData);
  176. STDMETHOD_(void,GetCurrentProviderURL) (TCHAR *szProviderURL);
  177. STDMETHOD (GetProviderData) (LPCDOPTIONS pCDOpts);
  178. STDMETHOD (SetProviderData) (LPCDOPTIONS pCDOpts);
  179. STDMETHOD (CopyOptions) (void);
  180. STDMETHOD_(void,DumpOptionsCopy) (void);
  181. STDMETHOD_(void,DestroyCDOptions) (void);
  182. STDMETHOD_(BOOL,OptionsChanged) (LPCDOPTIONS pCDOpts);
  183. STDMETHOD_(void,UsePlayerDefaults) (HWND hDlg);
  184. STDMETHOD_(BOOL,InitPlayerOptions) (HWND hDlg);
  185. STDMETHOD_(void,SetIntroTime) (HWND hDlg);
  186. STDMETHOD_(void,ToggleInternetDownload) (HWND hDlg);
  187. STDMETHOD_(BOOL,InitTitleOptions) (HWND hDlg);
  188. STDMETHOD_(void,RestoreTitleDefaults) (HWND hDlg);
  189. STDMETHOD_(void,ChangeCDProvider) (HWND hDlg);
  190. STDMETHOD_(void,DownloadNow) (HWND hDlg);
  191. STDMETHOD_(void,UpdateBatched) (HWND hDlg);
  192. // playlist.cpp
  193. STDMETHOD_(HTREEITEM,AddNameToTree) (HWND hDlg, LPCDUNIT pCDUnit, TCHAR *szName, HTREEITEM hParent, HTREEITEM hInsertAfter, LPCDTITLE pCDTitle, DWORD fdwType, DWORD dwTrack, DWORD dwImage);
  194. STDMETHOD_(void,AddTracksToTree) (HWND hDlg, LPCDTITLE pCDTitle, HTREEITEM parent);
  195. STDMETHOD_(void,UpdateTitleTree) (HWND hDlg, LPCDDATA pCDData);
  196. STDMETHOD_(void,AddTitleByCD) (HWND hDlg);
  197. STDMETHOD_(void,ToggleByArtist) (HWND hDlg, LPCDDATA pCDData);
  198. STDMETHOD_(BOOL,InitPlayLists) (HWND hDlg, LPCDDATA pCDData);
  199. STDMETHOD_(void,DumpMixerTree) (HWND hDlg);
  200. STDMETHOD_(void,DumpRecurseTree) (HWND hTree, HTREEITEM hItem);
  201. STDMETHOD_(LPCDTREEINFO,NewCDTreeInfo) (LPCDTITLE pCDTitle, LPCDUNIT pCDUnit, DWORD fdwType, DWORD dwTrack);
  202. STDMETHOD_(BOOL,PlayListNotify) (HWND hDlg, LPNMHDR pnmh);
  203. STDMETHOD_(void,TreeItemMenu) (HWND hDlg);
  204. STDMETHOD_(void,ToggleExpand) (HWND hDlg);
  205. STDMETHOD_(void,EditTreeItem) (HWND hDlg);
  206. STDMETHOD_(void,DeleteTitle) (HWND hDlg);
  207. STDMETHOD_(void,RefreshTreeItem) (HWND hDlg, HTREEITEM hItem);
  208. STDMETHOD_(HTREEITEM,FindRecurseTree) (HWND hDlg, HTREEITEM hItem, LPCDTITLE pCDTitle, BOOL fRefresh, DWORD dwTitleID);
  209. STDMETHOD_(HTREEITEM,FindTitleInDBTree) (HWND hDlg, LPCDTITLE pCDTitle);
  210. STDMETHOD_(BOOL,DeleteTitleItem) (HWND hDlg, HTREEITEM hItem);
  211. STDMETHOD_(void,RefreshTree) (HWND hDlg, LPCDTITLE pCDTitle, DWORD dwTitleID);
  212. STDMETHOD_(void,DownloadTitle) (HWND hDlg);
  213. STDMETHOD_(void,EditCurrentTitle) (HWND hDlg);
  214. STDMETHOD_(void,ArtistNameChange) (HWND hDlg, HTREEITEM hItem, TCHAR *szName);
  215. STDMETHOD_(void,NotifyTitleChange) (LPCDTITLE pCDTitle);
  216. STDMETHOD_(void,SubClassDlg) (HWND hDlg);
  217. STDMETHOD_(void,UnSubClassDlg) (HWND hDlg);
  218. STDMETHOD_(void,EndEditReturn) (HWND hDlg);
  219. STDMETHOD_(void,SetArtistExpand) (HWND hDlg, HTREEITEM hItem, BOOL fExpand);
  220. // dragdrop.cpp
  221. STDMETHOD_(LRESULT,DragList) (HWND hLB, UINT uMsg, WPARAM wPara, LPARAM lParam);
  222. STDMETHOD_(UINT,InitDragMultiList) (void);
  223. STDMETHOD_(BOOL,MakeMultiDragList) (HWND hLB);
  224. STDMETHOD_(int,LBMultiItemFromPt) (HWND hLB, POINT pt, BOOL bAutoScroll);
  225. STDMETHOD_(void,DrawMultiInsert) (HWND hwndParent, HWND hLB, int nItem);
  226. // listedit.cpp
  227. STDMETHOD_(void,AddEditToPlayList) (HWND hDlg);
  228. STDMETHOD_(void,TrackEditChange) (HWND hDlg);
  229. STDMETHOD_(void,AddTrackToPlayList) (HWND hDlg, UINT_PTR dwTrack);
  230. STDMETHOD_(void,ResetPlayList) (HWND hDlg);
  231. STDMETHOD_(void,AddToPlayList) (HWND hDlg);
  232. STDMETHOD_(BOOL,ListEditor) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  233. STDMETHOD_(BOOL,DoListCommand) (HWND hDlg, WPARAM wParam, LPARAM lParam);
  234. STDMETHOD_(void,CommitTitleChanges) (HWND hDlg, BOOL fSave);
  235. STDMETHOD_(BOOL,ListEditDialog) (HWND hDlg, LPCDTITLE pCDTitle);
  236. STDMETHOD_(BOOL,InitListEdit) (HWND hDlg);
  237. STDMETHOD_(void,RemovePlayListSel) (HWND hDlg);
  238. STDMETHOD_(void,UpdateListButtons) (HWND hDlg);
  239. STDMETHOD_(void,AvailTracksNotify) (HWND hDlg, UINT code);
  240. STDMETHOD_(void,CurrListNotify) (HWND hDlg, UINT code);
  241. STDMETHOD_(void,UpdateAvailList) (HWND hDlg);
  242. STDMETHOD_(void,UploadTitle) (HWND hDlg);
  243. STDMETHOD_(BOOL,ConfirmUpload) (HWND hDlg);
  244. STDMETHOD_(BOOL,Upload) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  245. STDMETHOD_(BOOL,Confirm) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  246. STDMETHOD_(void,OnDrawItem) (HWND hDlg, const DRAWITEMSTRUCT *lpdis);
  247. STDMETHOD_(void,DrawListItem) (HWND hDlg, HDC hdc, const RECT *rItem, UINT_PTR itemIndex, BOOL selected);
  248. STDMETHOD_(BOOL,OnQueryDrop) (HWND hDlg, HWND hwndDrop, HWND hwndSrc, POINT ptDrop, DWORD dwState);
  249. STDMETHOD_(BOOL,OnProcessDrop) (HWND hDlg, HWND hwndDrop, HWND hwndSrc, POINT ptDrop, DWORD dwState);
  250. STDMETHOD_(int,InsertIndex) (HWND hDlg, POINT pt, BOOL bDragging);
  251. STDMETHOD_(BOOL,IsInListbox) (HWND hDlg, HWND hwndListbox, POINT pt);
  252. STDMETHOD_(void,MoveCopySelection) (HWND hDlg, int iInsertPos, DWORD dwState);
  253. STDMETHOD_(BOOL,DoDragCommand) (HWND hDlg, LPDRAGMULTILISTINFO lpns);
  254. enum { WM_PRIVATE = WM_APP + 1 };
  255. STDMETHOD_(void,OnPrivateMsg) (HWND hDlg, WPARAM, LPARAM);
  256. // volopt.cpp
  257. STDMETHOD_(BOOL,MixerConfig) (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  258. STDMETHOD_(MMRESULT,GetDefaultMixID) (DWORD *pdwMixID);
  259. STDMETHOD_(void,SearchControls) (int mxid, LPMIXERLINE pml, LPDWORD pdwVolID, LPDWORD pdwMuteID, TCHAR *szName, BOOL *pfFound, BOOL fVerify);
  260. STDMETHOD_(void,SearchConnections) (int mxid, DWORD dwDestination, DWORD dwConnections, LPDWORD pdwVolID, LPDWORD pdwMuteID, TCHAR *szName, BOOL *pfFound, BOOL fVerify);
  261. STDMETHOD_(BOOL,SearchDevice) (DWORD dwMixID, LPCDUNIT pCDUnit, LPDWORD pdwDestID, LPDWORD pdwVolID, LPDWORD pdwMuteID, TCHAR *szName, BOOL fVerify);
  262. STDMETHOD_(void,GetUnitDefaults) (LPCDUNIT pCDUnit);
  263. STDMETHOD_(BOOL,MapLetterToDevice) (TCHAR DriveLetter, TCHAR *szDriver, TCHAR *szDevDesc, DWORD dwSize);
  264. STDMETHOD_(BOOL,TruncName) (TCHAR *pDest, TCHAR *pSrc);
  265. STDMETHOD (ComputeMixID) (LPDWORD pdwMixID, TCHAR *szMixerName);
  266. STDMETHOD (GetUnitRegData) (LPCDUNIT pCDUnit);
  267. STDMETHOD_(void,SetUnitRegData) (LPCDUNIT pCDUnit);
  268. STDMETHOD_(void,GetUnitValues) (LPCDUNIT pCDUnit);
  269. STDMETHOD_(void,WriteCDList) (LPCDUNIT pCDList);
  270. STDMETHOD_(void,DestroyCDList) (LPCDUNIT *ppCDList);
  271. STDMETHOD_(UINT,GetDefDrive) (void);
  272. STDMETHOD (CreateCDList) (LPCDUNIT *ppCDList);
  273. STDMETHOD (BuildUITree) (LPCDDRIVE *ppCDRoot, LPCDUNIT pCDList);
  274. STDMETHOD_(void,DestroyUITree) (LPCDDRIVE *ppCDRoot);
  275. STDMETHOD_(void,SetUIDefaults) (LPCDDRIVE pCDTree, LPCDUNIT pCDList);
  276. STDMETHOD_(void,RestoreOriginals) (void);
  277. STDMETHOD (AddLineControls) (LPCDMIXER pMixer, LPCDCONTROL *ppLastControl, int mxid, LPMIXERLINE pml);
  278. STDMETHOD (AddConnections) (LPCDMIXER pMixer, LPCDCONTROL *ppLastControl, int mxid, DWORD dwDestination, DWORD dwConnections);
  279. STDMETHOD (AddControls) (LPCDMIXER pMixer);
  280. STDMETHOD (AddMixers) (LPCDDRIVE pDevice);
  281. STDMETHOD_(BOOL,UpdateCDList) (LPCDDRIVE pCDTree, LPCDUNIT pCDList);
  282. STDMETHOD_(void,InitControlUI) (HWND hDlg, LPCDMIXER pMixer);
  283. STDMETHOD_(void,InitMixerUI) (HWND hDlg, LPCDDRIVE pDevice);
  284. STDMETHOD_(void,InitDeviceUI) (HWND hDlg, LPCDDRIVE pCDTree, LPCDDRIVE pCurrentDevice);
  285. STDMETHOD_(BOOL,InitMixerConfig) (HWND hDlg);
  286. STDMETHOD_(LPCDDRIVE,GetCurrentDevice) (HWND hDlg);
  287. STDMETHOD_(LPCDMIXER,GetCurrentMixer) (HWND hDlg);
  288. STDMETHOD_(void,ChangeCDDrives) (HWND hDlg);
  289. STDMETHOD_(void,ChangeCDMixer) (HWND hDlg);
  290. STDMETHOD_(void,ChangeCDControl) (HWND hDlg);
  291. STDMETHOD_(void,SetMixerDefaults) (HWND hDlg);
  292. STDMETHOD_(BOOL,VolumeDialog) (HWND hDlg);
  293. };
  294. #endif // !defined(CDOPT_COM_IMPLEMENTATION)
  295.