Windows NT 4.0 source code leak
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.

255 lines
7.9 KiB

4 years ago
  1. /*
  2. * Tray notification message
  3. * */
  4. #define MYWM_BASE (WM_APP+100)
  5. //#define MYWM_NOTIFYICON (MYWM_BASE+0)
  6. #define MYWM_TIMER (MYWM_BASE+1)
  7. #define MYWM_RESTART (MYWM_BASE+2)
  8. //#define MYWM_FREECHILD (MYWM_BASE+3)
  9. //#define MYWM_ADDCHILD (MYWM_BASE+4)
  10. #define MYWM_HELPTOPICS (MYWM_BASE+5)
  11. #define MYWM_WAKEUP (MYWM_BASE+6)
  12. /*
  13. * MMSYS.CPL notifcation to kill tray volume
  14. * */
  15. //#define MYWM_KILLTRAYVOLUME (WM_USER+100)
  16. //#define REGSTR_PATH_MEDIA "SYSTEM\\CurrentControlSet\\Control\\MediaResources"
  17. //#define REGSTR_PATH_MEDIATMP REGSTR_PATH_MEDIA "\\tmp"
  18. //#define REGKEY_TRAYVOL "TrayVolumeControlWindow"
  19. /*
  20. * Upon an option change, the dialog box can force a reinit
  21. * */
  22. #define MIXUI_EXIT 0
  23. #define MIXUI_RESTART 1
  24. #define MIXUI_ERROR 2
  25. #define MIXUI_MMSYSERR 3
  26. #define GET (TRUE)
  27. #define SET (!GET)
  28. #define MXUC_STYLEF_VISIBLE 0x00000001
  29. #define MXUC_STYLEF_ENABLED 0x00000002
  30. typedef struct t_MIXUICTRL
  31. {
  32. DWORD dwStyle; // ui style (see style flags)
  33. HWND hwnd; // hwnd to control
  34. int noset; // skip set events
  35. int state; // app init state
  36. } MIXUICTRL, * PMIXUICTRL, FAR * LPMIXUICTRL;
  37. typedef enum
  38. {
  39. MIXUI_VOLUME = 0,
  40. MIXUI_BALANCE,
  41. MIXUI_SWITCH,
  42. MIXUI_VUMETER,
  43. MIXUI_ADVANCED
  44. } MIXUICONTROL;
  45. typedef enum
  46. {
  47. MIXUI_CONTROL_UNINITIALIZED = 0,
  48. MIXUI_CONTROL_ENABLED,
  49. MIXUI_CONTROL_INITIALIZED
  50. };
  51. #define MIXUI_FIRST MIXUI_VOLUME
  52. #define MIXUI_LAST MIXUI_VUMETER
  53. typedef struct t_MIXUILINE
  54. {
  55. MIXUICTRL acr [4]; // 5 fixed types
  56. DWORD dwStyle; // line style
  57. struct t_VOLCTRLDESC * pvcd; // ptr to volume description
  58. } MIXUILINE, * PMIXUILINE, FAR * LPMIXUILINE;
  59. /*
  60. * LOWORD == type
  61. * HIWORD == style
  62. */
  63. #define MXUL_STYLEF_DESTINATION 0x00000001
  64. #define MXUL_STYLEF_SOURCE 0x00000002
  65. #define MXUL_STYLEF_HIDDEN 0x00010000
  66. #define MXUL_STYLEF_DISABLED 0x00020000
  67. /*
  68. * The MIXUIDIALOG data structure is a global variable baggage to be
  69. * attached to dialogs and other windows. This allows to let windows
  70. * carry state information rather than us keeping track of it. It also
  71. * allows us to simply clone off of another dialog state with simple
  72. * changes.
  73. */
  74. typedef struct t_MIXUIDIALOG
  75. {
  76. HINSTANCE hInstance; // app instance
  77. HWND hwnd; // this window
  78. DWORD dwFlags; // random flags
  79. HMIXER hmx; // open handle to mixer
  80. DWORD mxid; // mixer id
  81. DWORD dwDevNode; // mixer dev node
  82. DWORD iDest; // destination line id
  83. DWORD dwStyle; // visual options.
  84. TCHAR szMixer[MAXPNAMELEN]; // product name
  85. TCHAR szDestination[MIXER_SHORT_NAME_CHARS]; // line name
  86. LPBYTE lpDialog; // ptr to dialog template
  87. DWORD cbDialog; // sizeof dialog buffer
  88. PMIXUILINE amxul; // ptr to array of mixuiline's
  89. DWORD cmxul; // number of lines
  90. struct t_VOLCTRLDESC *avcd; // array of volume descriptions
  91. DWORD cvcd; // number of volume descriptions
  92. HWND hParent; // HWND of parent window
  93. UINT uTimerID; // peakmeter timer
  94. HWND hStatus; // HWND of status bar
  95. WNDPROC lpfnTrayVol;// Tray volume subclass trackbar
  96. DWORD dwTrayInfo; // Tray volume info
  97. int nShowCmd; // init window
  98. DWORD dwDeviceState; // device change state information
  99. int cTimeInQueue; // timer messages in queue
  100. //
  101. // Return values from dialogs, etc.. can be put in dwReturn
  102. // Upon EndDialog, dwReturn gets set to MIXUI_EXIT or MIXUI_RESTART
  103. //
  104. DWORD dwReturn; // return value on exit
  105. MMRESULT mmr; // last result (iff dwReturn == MIXUI_MMSYSERR)
  106. RECT rcRestart; // restart position (iff dwReturn == MIXUI_RESTART)
  107. } MIXUIDIALOG, *PMIXUIDIALOG, FAR *LPMIXUIDIALOG;
  108. /*
  109. * Style bits - these generally determine the look of the app
  110. */
  111. #define MXUD_STYLEF_TRAYMASTER 0x00000002 // use the tray
  112. #define MXUD_STYLEF_MASTERONLY 0x00000004 // only destination volumes --obsolete
  113. #define MXUD_STYLEF_HORIZONTAL 0x00000008 // horizontal mode
  114. #define MXUD_STYLEF_TWOCHANNEL 0x00000010 // two channel slider volume
  115. #define MXUD_STYLEF_SMALL 0x00000020 // half-pint version
  116. #define MXUD_STYLEF_CHILD 0x00000040 // child window? --obsolete
  117. #define MXUD_STYLEF_KEEPWINDOW 0x00000080 // keep window --obsolete
  118. #define MXUD_STYLEF_NOHELP 0x00000100 // no help
  119. #define MXUD_STYLEF_STATUS 0x00000200 // status bar
  120. #define MXUD_STYLEF_TOPMOST 0x00000400 // top most window
  121. #define MXUD_STYLEF_ADVANCED 0x00000800 // show advanced
  122. #define MXUD_STYLEF_CLOSE 0x00001000 // find and close TRAYMASTER window
  123. /*
  124. * Flag bits - these generally indicate operating modes and internal info
  125. */
  126. #define MXUD_FLAGSF_MIXER 0x00000001 // bound to a mixer driver
  127. #define MXUD_FLAGSF_USETIMER 0x00000002 // update timer enabled
  128. #define MXUD_FLAGSF_BADDRIVER 0x00000004 // mixer driver with control map bug
  129. #define MXUD_FLAGSF_NOADVANCED 0x00000008 // advanced features disabled
  130. /*
  131. * Macro - if both advanced style and advanced state
  132. */
  133. #define MXUD_ADVANCED(x) (!((x)->dwFlags & MXUD_FLAGSF_NOADVANCED) && (x)->dwStyle & MXUD_STYLEF_ADVANCED)
  134. /*
  135. * Tray info bits - state bits for the tray volume
  136. */
  137. #define MXUD_TRAYINFOF_SIGNAL 0x00000001 // has a change been made?
  138. #define GETMIXUIDIALOG(x) (MIXUIDIALOG *)GetWindowLong(x, DWL_USER)
  139. #define SETMIXUIDIALOG(x,y) SetWindowLong(x, DWL_USER, y)
  140. DWORD ReadRegistryData( LPTSTR pEntryNode,
  141. LPTSTR pEntryName,
  142. PDWORD pType,
  143. LPBYTE pData,
  144. DWORD DataSize );
  145. DWORD WriteRegistryData( LPTSTR pEntryNode,
  146. LPTSTR pEntryName,
  147. DWORD Type,
  148. LPBYTE pData,
  149. DWORD Size );
  150. DWORD QueryRegistryDataSize( LPTSTR pEntryNode,
  151. LPTSTR pEntryName,
  152. DWORD *pDataSize );
  153. int Volume_NumDevs(void);
  154. HWND Volume_GetLineItem(HWND, DWORD, DWORD);
  155. BOOL Properties(PMIXUIDIALOG pmxud, HWND hwnd);
  156. #define HANDLE_WM_XSCROLL(hwnd, wParam, lParam, fn) \
  157. ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
  158. #define HANDLE_MM_MIXM_CONTROL_CHANGE(hwnd, wParam, lParam, fn) \
  159. ((fn)((hwnd), (HMIXER)(wParam), (DWORD)(lParam)))
  160. #define HANDLE_MM_MIXM_LINE_CHANGE(hwnd, wParam, lParam, fn) \
  161. ((fn)((hwnd), (HMIXER)(wParam), (DWORD)(lParam)))
  162. #define HANDLE_MYWM_TIMER(hwnd, wParam, lParam, fn) \
  163. ((fn)((hwnd)))
  164. #define HANDLE_WM_IDEVICECHANGE(hwnd, wParam, lParam, fn) \
  165. ((fn)((hwnd), wParam, lParam))
  166. #define HANDLE_MYWM_WAKEUP(hwnd, wParam, lParam, fn) \
  167. ((fn)((hwnd), wParam))
  168. #ifdef DEBUG
  169. static int _assert(LPSTR szExp, LPSTR szFile, UINT uLine)
  170. {
  171. const char szAssertText [] = "Assertion failed: %s, file %s, line %u\r\n";
  172. const char szAppName [] = "SNDVOL32";
  173. char sz[256];
  174. DWORD fDialog = 0L;
  175. wsprintf(sz, szAssertText, szExp, szFile, uLine);
  176. ReadRegistryData(NULL, "AssertDialog", NULL, (LPBYTE)&fDialog, sizeof(DWORD));
  177. if (fDialog)
  178. MessageBox(NULL, szAppName, sz, MB_OK|MB_ICONHAND);
  179. else
  180. {
  181. OutputDebugString(sz);
  182. DebugBreak();
  183. }
  184. return 1;
  185. }
  186. #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
  187. #define dout(exp) OutputDebugString(exp)
  188. static void _dlout(LPSTR szExp, LPSTR szFile, UINT uLine)
  189. {
  190. char sz[256];
  191. wsprintf(sz, "%s, file %s, line %u\r\n", szExp, szFile, uLine);
  192. OutputDebugString(sz);
  193. }
  194. #define dlout(exp) (void)(_dlout(exp, __FILE__, __LINE__), 0)
  195. #else
  196. #define assert(exp) ((void)0)
  197. #define dout(exp) ((void)0)
  198. #define dlout(exp) ((void)0)
  199. #endif
  200. #define VOLUME_TRAYSHUTDOWN_ID 1
  201. #define SIZEOF(x) (sizeof((x))/sizeof((x)[0]))
  202. #include "pvcd.h"
  203. #ifndef DRV_QUERYDEVNODE
  204. #define DRV_QUERYDEVNODE (DRV_RESERVED + 2)
  205. #endif