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.

490 lines
13 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name:
  3. *
  4. *
  5. *
  6. *
  7. * Created: dd-mm-93
  8. * Author: Stephen Estrop [StephenE]
  9. *
  10. * Copyright (c) 1993 Microsoft Corporation
  11. \**************************************************************************/
  12. typedef struct _RECT16 { /* rc16 */
  13. SHORT left;
  14. SHORT top;
  15. SHORT right;
  16. SHORT bottom;
  17. } RECT16;
  18. typedef RECT16 UNALIGNED *PRECT16;
  19. typedef struct _MCI_ANIM_OPEN_PARMS16 {
  20. DWORD dwCallback;
  21. WORD wDeviceID;
  22. WORD wReserved0;
  23. LPCSTR lpstrDeviceType;
  24. LPCSTR lpstrElementName;
  25. LPCSTR lpstrAlias;
  26. DWORD dwStyle;
  27. HWND16 hWndParent; // Keeps consistent, and is equivalent anyway
  28. WORD wReserved1;
  29. } MCI_ANIM_OPEN_PARMS16;
  30. typedef MCI_ANIM_OPEN_PARMS16 UNALIGNED *PMCI_ANIM_OPEN_PARMS16;
  31. typedef LPVOID LPMCI_ANIM_OPEN_PARMS16;
  32. typedef struct _MCI_ANIM_PLAY_PARMS16 {
  33. DWORD dwCallback;
  34. DWORD dwFrom;
  35. DWORD dwTo;
  36. DWORD dwSpeed;
  37. } MCI_ANIM_PLAY_PARMS16;
  38. typedef MCI_ANIM_PLAY_PARMS16 UNALIGNED *PMCI_ANIM_PLAY_PARMS16;
  39. typedef LPVOID LPMCA_ANIM_PLAY_PARMS16;
  40. typedef struct _MCI_ANIM_RECT_PARMS16 {
  41. DWORD dwCallback;
  42. RECT16 rc;
  43. } MCI_ANIM_RECT_PARMS16;
  44. typedef MCI_ANIM_RECT_PARMS16 UNALIGNED *PMCI_ANIM_RECT_PARMS16;
  45. typedef LPVOID LPMCI_ANIM_RECT_PARMS16;
  46. typedef struct _MCI_ANIM_STEP_PARMS16 {
  47. DWORD dwCallback;
  48. DWORD dwFrames;
  49. } MCI_ANIM_STEP_PARMS16;
  50. typedef MCI_ANIM_STEP_PARMS16 UNALIGNED *PMCI_ANIM_STEP_PARMS16;
  51. typedef LPVOID LPMCI_ANIM_STEP_PARMS16;
  52. typedef struct _MCI_ANIM_UPDATE_PARMS16 {
  53. DWORD dwCalback;
  54. RECT16 rc;
  55. HDC16 hDC;
  56. } MCI_ANIM_UPDATE_PARMS16;
  57. typedef MCI_ANIM_UPDATE_PARMS16 UNALIGNED *PMCI_ANIM_UPDATE_PARMS16;
  58. typedef LPVOID LPMCI_ANIM_UPDATE_PARMS16;
  59. typedef struct _MCI_ANIM_WINDOW_PARMS16 {
  60. DWORD dwCallabck;
  61. HWND16 hWnd;
  62. WORD wReserved1;
  63. WORD nCmdShow;
  64. WORD wReserved2;
  65. LPCSTR lpstrText;
  66. } MCI_ANIM_WINDOW_PARMS16;
  67. typedef MCI_ANIM_WINDOW_PARMS16 UNALIGNED *PMCI_ANIM_WINDOW_PARMS16;
  68. typedef LPVOID LPMCI_ANIM_WINDOW_PARMS16;
  69. typedef struct _MCI_BREAK_PARMS16 {
  70. DWORD dwCallback;
  71. INT16 nVirtKey;
  72. WORD wReserved0;
  73. HWND16 hwndBreak;
  74. WORD wReserved1;
  75. } MCI_BREAK_PARMS16;
  76. typedef MCI_BREAK_PARMS16 UNALIGNED *PMCI_BREAK_PARMS16;
  77. typedef LPVOID LPMCI_BREAK_PARMS16;
  78. typedef struct _MCI_GENERIC_PARMS16 {
  79. DWORD dwCallback;
  80. } MCI_GENERIC_PARMS16;
  81. typedef MCI_GENERIC_PARMS16 UNALIGNED *PMCI_GENERIC_PARMS16;
  82. typedef LPVOID LPMCI_GENERIC_PARMS16;
  83. typedef struct _MCI_GETDEVCAPS_PARMS16 {
  84. DWORD dwCallback;
  85. DWORD dwReturn;
  86. DWORD dwItem;
  87. } MCI_GETDEVCAPS_PARMS16;
  88. typedef MCI_GETDEVCAPS_PARMS16 UNALIGNED *PMCI_GETDEVCAPS_PARMS16;
  89. typedef LPVOID LPMCI_GETDEVCAPS_PARMS16;
  90. typedef struct _MCI_INFO_PARMS16 {
  91. DWORD dwCallback;
  92. LPSTR lpstrReturn;
  93. DWORD dwRetSize;
  94. } MCI_INFO_PARMS16;
  95. typedef MCI_INFO_PARMS16 UNALIGNED *PMCI_INFO_PARMS16;
  96. typedef LPVOID LPMCI_INFO_PARMS16;
  97. typedef struct _MCI_LOAD_PARMS16 {
  98. DWORD dwCallback;
  99. LPCSTR lpfilename;
  100. } MCI_LOAD_PARMS16;
  101. typedef MCI_LOAD_PARMS16 UNALIGNED *PMCI_LOAD_PARMS16;
  102. typedef LPVOID LPMCI_LOAD_PARMS16;
  103. typedef struct _MCI_OPEN_PARMS16 {
  104. DWORD dwCallback;
  105. WORD wDeviceID;
  106. WORD wReserved0;
  107. LPCSTR lpstrDeviceType;
  108. LPCSTR lpstrElementName;
  109. LPCSTR lpstrAlias;
  110. } MCI_OPEN_PARMS16;
  111. typedef MCI_OPEN_PARMS16 UNALIGNED *PMCI_OPEN_PARMS16;
  112. typedef LPVOID LPMCI_OPEN_PARMS16;
  113. typedef struct _MCI_OVLY_LOAD_PARMS16 {
  114. DWORD dwCallback;
  115. LPCSTR lpfilename;
  116. RECT16 rc;
  117. } MCI_OVLY_LOAD_PARMS16;
  118. typedef MCI_OVLY_LOAD_PARMS16 UNALIGNED *PMCI_OVLY_LOAD_PARMS16;
  119. typedef LPVOID LPMCI_OVLY_LOAD_PARMS16;
  120. typedef struct _MCI_OVLY_OPEN_PARMS16 {
  121. DWORD dwCallabck;
  122. WORD wDeviceID;
  123. WORD wReserved0;
  124. LPCSTR lpstrDeviceType;
  125. LPCSTR lpstrElementName;
  126. LPCSTR lpstrAlias;
  127. DWORD dwStyle;
  128. HWND16 hWndParent; // The book is wrong
  129. WORD wReserved1;
  130. } MCI_OVLY_OPEN_PARMS16;
  131. typedef MCI_OVLY_OPEN_PARMS16 UNALIGNED *PMCI_OVLY_OPEN_PARMS16;
  132. typedef LPVOID LPMCI_OVLY_OPEN_PARMS16;
  133. typedef struct _MCI_OVLY_RECT_PARMS16 {
  134. DWORD dwCallback;
  135. RECT16 rc;
  136. } MCI_OVLY_RECT_PARMS16;
  137. typedef MCI_OVLY_RECT_PARMS16 UNALIGNED *PMCI_OVLY_RECT_PARMS16;
  138. typedef LPVOID LPMCI_OVLY_RECT_PARMS16;
  139. typedef struct _MCI_OVLY_SAVE_PARMS16 {
  140. DWORD dwCallback;
  141. LPCSTR lpfilename;
  142. RECT16 rc;
  143. } MCI_OVLY_SAVE_PARMS16;
  144. typedef MCI_OVLY_SAVE_PARMS16 UNALIGNED *PMCI_OVLY_SAVE_PARMS16;
  145. typedef LPVOID LPMCI_OVLY_SAVE_PARMS16;
  146. typedef struct _MCI_OVLY_WINDOW_PARMS16 {
  147. DWORD dwCallabck;
  148. HWND16 hWnd;
  149. WORD wReserved1;
  150. WORD nCmdShow;
  151. WORD wReserved2;
  152. LPCSTR lpstrText;
  153. } MCI_OVLY_WINDOW_PARMS16;
  154. typedef MCI_OVLY_WINDOW_PARMS16 UNALIGNED *PMCI_OVLY_WINDOW_PARMS16;
  155. typedef LPVOID LPMCI_OVLY_WINDOW_PARMS16;
  156. typedef struct _MCI_PLAY_PARMS16 {
  157. DWORD dwCallback;
  158. DWORD dwFrom;
  159. DWORD dwTo;
  160. } MCI_PLAY_PARMS16;
  161. typedef MCI_PLAY_PARMS16 UNALIGNED *PMCI_PLAY_PARMS16;
  162. typedef LPVOID LPMCI_PLAY_PARMS16;
  163. typedef struct _MCI_RECORD_PARMS16 {
  164. DWORD dwCallabck;
  165. DWORD dwFrom;
  166. DWORD dwTo;
  167. } MCI_RECORD_PARMS16;
  168. typedef MCI_RECORD_PARMS16 UNALIGNED *PMCI_RECORD_PARMS16;
  169. typedef LPVOID LPMCI_RECORD_PARMS16;
  170. typedef struct _MCI_SAVE_PARMS16 {
  171. DWORD dwCallback;
  172. LPCSTR lpfilename; // MMSYSTEM.H differs from the book
  173. } MCI_SAVE_PARMS16;
  174. typedef MCI_SAVE_PARMS16 UNALIGNED *PMCI_SAVE_PARMS16;
  175. typedef LPVOID LPMCI_SAVE_PARMS16;
  176. typedef struct _MCI_SEEK_PARMS16 {
  177. DWORD dwCallback;
  178. DWORD dwTo;
  179. } MCI_SEEK_PARMS16;
  180. typedef MCI_SEEK_PARMS16 UNALIGNED *PMCI_SEEK_PARMS16;
  181. typedef LPVOID LPMCI_SEEK_PARMS16;
  182. typedef struct _MCI_SEQ_SET_PARMS16 {
  183. DWORD dwCallback;
  184. DWORD dwTimeFormat;
  185. DWORD dwAudio;
  186. DWORD dwTempo;
  187. DWORD dwPort;
  188. DWORD dwSlave;
  189. DWORD dwMaster;
  190. DWORD dwOffset;
  191. } MCI_SEQ_SET_PARMS16;
  192. typedef MCI_SEQ_SET_PARMS16 UNALIGNED *PMCI_SEQ_SET_PARMS16;
  193. typedef LPVOID LPMCI_SEQ_SET_PARMS16;
  194. typedef struct _MCI_SET_PARMS16 {
  195. DWORD dwCallback;
  196. DWORD dwTimeFormat;
  197. DWORD dwAudio;
  198. } MCI_SET_PARMS16;
  199. typedef MCI_SET_PARMS16 UNALIGNED *PMCI_SET_PARMS16;
  200. typedef LPVOID LPMCI_SET_PARMS16;
  201. typedef struct _MCI_SOUND_PARMS16 {
  202. DWORD dwCallback;
  203. LPCSTR lpstrSoundName;
  204. } MCI_SOUND_PARMS16;
  205. typedef MCI_SOUND_PARMS16 UNALIGNED *PMCI_SOUND_PARMS16;
  206. typedef LPVOID LPMCI_SOUND_PARMS16;
  207. typedef struct _MCI_STATUS_PARMS16 {
  208. DWORD dwCallback;
  209. DWORD dwReturn;
  210. DWORD dwItem;
  211. DWORD dwTrack;
  212. } MCI_STATUS_PARMS16;
  213. typedef MCI_STATUS_PARMS16 UNALIGNED *PMCI_STATUS_PARMS16;
  214. typedef LPVOID LPMCI_STATUS_PARMS16;
  215. typedef struct _MCI_SYSINFO_PARMS16 {
  216. DWORD dwCallback;
  217. LPSTR lpstrReturn;
  218. DWORD dwRetSize;
  219. DWORD dwNumber;
  220. WORD wDeviceType;
  221. WORD wReserved0;
  222. } MCI_SYSINFO_PARMS16;
  223. typedef MCI_SYSINFO_PARMS16 UNALIGNED *PMCI_SYSINFO_PARMS16;
  224. typedef LPVOID LPMCI_SYSINFO_PARMS16;
  225. typedef struct _MCI_VD_ESCAPE_PARMS16 {
  226. DWORD dwCallback;
  227. LPCSTR lpstrCommand;
  228. } MCI_VD_ESCAPE_PARMS16;
  229. typedef MCI_VD_ESCAPE_PARMS16 UNALIGNED *PMCI_VD_ESCAPE_PARMS16;
  230. typedef LPVOID LPMCI_VD_ESCAPE_PARMS16;
  231. typedef struct _MCI_VD_PLAY_PARMS16 {
  232. DWORD dwCallback;
  233. DWORD dwFrom;
  234. DWORD dwTo;
  235. DWORD dwSpeed;
  236. } MCI_VD_PLAY_PARMS16;
  237. typedef MCI_VD_PLAY_PARMS16 UNALIGNED *PMCI_VD_PLAY_PARMS16;
  238. typedef LPVOID LPMCI_VD_PLAY_PARMS16;
  239. typedef struct _MCI_VD_STEP_PARMS16 {
  240. DWORD dwCallback;
  241. DWORD dwFrames;
  242. } MCI_VD_STEP_PARMS16;
  243. typedef MCI_VD_STEP_PARMS16 UNALIGNED *PMCI_VD_STEP_PARMS16;
  244. typedef LPVOID LPMCI_VD_STEP_PARMS16;
  245. typedef struct _MCI_VD_DELETE_PARMS16 {
  246. DWORD dwCallback;
  247. DWORD dwFrom;
  248. DWORD dwTo;
  249. } MCI_VD_DELETE_PARMS16;
  250. typedef MCI_VD_DELETE_PARMS16 UNALIGNED *PMCI_VD_DELETE_PARMS16;
  251. typedef LPVOID LPMCI_VD_DELETE_PARMS16;
  252. typedef struct _MCI_WAVE_OPEN_PARMS16 {
  253. DWORD dwCallback;
  254. WORD wDeviceID;
  255. WORD wReserved0;
  256. LPCSTR lpstrDeviceType;
  257. LPCSTR lpstrElementName;
  258. LPCSTR lpstrAlias;
  259. DWORD dwBufferSeconds;
  260. } MCI_WAVE_OPEN_PARMS16;
  261. typedef MCI_WAVE_OPEN_PARMS16 UNALIGNED *PMCI_WAVE_OPEN_PARMS16;
  262. typedef LPVOID LPMCI_WAVE_OPEN_PARMS16;
  263. typedef struct _MCI_WAVE_SET_PARMS16 {
  264. DWORD dwCallback;
  265. DWORD dwTimeFormat;
  266. DWORD dwAudio;
  267. WORD wInput;
  268. WORD wReserved0;
  269. WORD wOutput;
  270. WORD wReserved1;
  271. WORD wFormatTag;
  272. WORD wReserved2;
  273. WORD nChannels;
  274. WORD wReserved3;
  275. DWORD nSamplesPerSecond;
  276. DWORD nAvgBytesPerSec;
  277. WORD nBlockAlign;
  278. WORD wReserved4;
  279. WORD wBitsPerSample;
  280. WORD wReserved5;
  281. } MCI_WAVE_SET_PARMS16;
  282. typedef MCI_WAVE_SET_PARMS16 UNALIGNED *PMCI_WAVE_SET_PARMS16;
  283. typedef LPVOID LPMCI_WAVE_SET_PARMS16;
  284. typedef struct {
  285. DWORD dwCallback;
  286. DWORD dwItem;
  287. DWORD dwValue;
  288. DWORD dwOver;
  289. LPSTR lpstrAlgorithm;
  290. LPSTR lpstrQuality;
  291. DWORD dwSourceNumber;
  292. } MCI_DGV_SETVIDEO_PARMS16;
  293. typedef MCI_DGV_SETVIDEO_PARMS16 UNALIGNED *PMCI_DGV_SETVIDEO_PARMS16;
  294. #ifdef i386
  295. #define GETWORD(pb) (*((PWORD)pb)++)
  296. #define GETDWORD(pb) (*((PDWORD)pb)++)
  297. #define FETCHWORD(s) ((WORD)(s))
  298. #define FETCHDWORD(s) ((DWORD)(s))
  299. #define STOREWORD(d,s) (WORD)d=(WORD)s
  300. #define STOREDWORD(d,s) (DWORD)d=(DWORD)s
  301. #else
  302. #define GETWORD(pb) (*((UNALIGNED WORD *)pb)++)
  303. #define GETDWORD(pb) (*((UNALIGNED DWORD *)pb)++)
  304. #define FETCHWORD(s) (*(UNALIGNED WORD *)&(s))
  305. #define FETCHDWORD(s) (*(UNALIGNED DWORD *)&(s))
  306. #define STOREWORD(d,s) *(UNALIGNED WORD *)&(d)=(WORD)s
  307. #define STOREDWORD(d,s) *(UNALIGNED DWORD *)&(d)=(DWORD)s
  308. #endif
  309. #define FETCHSHORT(s) ((SHORT)(FETCHWORD(s)))
  310. #define FETCHLONG(s) ((LONG)(FETCHDWORD(s)))
  311. #define STORESHORT(d,s) STOREWORD(d,s)
  312. #define STORELONG(d,s) STOREDWORD(d,s)
  313. #define CHAR32(b) ((CHAR)(b))
  314. #define BYTE32(b) ((BYTE)(b))
  315. #define INT32(i) ((INT)(INT16)(i))
  316. #define UINT32(i) ((unsigned int)(i))
  317. #define BOOL32(f) ((BOOL)(f))
  318. #define WORD32(w) ((WORD)(w))
  319. #define LONG32(l) FETCHLONG(l)
  320. #define DWORD32(dw) FETCHDWORD(dw)
  321. #define MMGETOPTPTR(vp,cb,p) {p=NULL; if (HIWORD(FETCHDWORD(vp))) p = GETVDMPTR(vp);}
  322. DWORD
  323. ThunkMciCommand16(
  324. MCIDEVICEID DeviceID,
  325. UINT OrigCommand,
  326. DWORD OrigFlags,
  327. PMCI_GENERIC_PARMS16 lp16OrigParms,
  328. PDWORD pNewParms,
  329. LPWSTR *lplpCommand,
  330. PUINT puTable
  331. );
  332. VOID
  333. ThunkGenericParms(
  334. PDWORD pOrigFlags,
  335. PMCI_GENERIC_PARMS16 lp16GenParmsOrig,
  336. PMCI_GENERIC_PARMS lp32GenParmsOrig
  337. );
  338. DWORD
  339. ThunkOpenCmd(
  340. PDWORD pOrigFlags,
  341. PMCI_OPEN_PARMS16 lp16OpenParms,
  342. PMCI_OPEN_PARMS p32OpenParms
  343. );
  344. DWORD
  345. ThunkSetCmd(
  346. MCIDEVICEID DeviceID,
  347. PDWORD pOrigFlags,
  348. PMCI_SET_PARMS16 lpSetParms16,
  349. PMCI_SET_PARMS lpSetParms32
  350. );
  351. DWORD
  352. ThunkSetVideoCmd(
  353. PDWORD pOrigFlags,
  354. PMCI_DGV_SETVIDEO_PARMS16 lpSetParms16,
  355. LPMCI_DGV_SETVIDEO_PARMS lpSetParms32
  356. );
  357. DWORD
  358. ThunkSysInfoCmd(
  359. PMCI_SYSINFO_PARMS16 lpSysInfo16,
  360. PMCI_SYSINFO_PARMS lpSysInfo32
  361. );
  362. DWORD
  363. ThunkBreakCmd(
  364. PDWORD pOrigFlags,
  365. PMCI_BREAK_PARMS16 lpBreak16,
  366. PMCI_BREAK_PARMS lpBreak32
  367. );
  368. DWORD
  369. ThunkWindowCmd(
  370. MCIDEVICEID DeviceID,
  371. PDWORD pOrigFlags,
  372. PMCI_ANIM_WINDOW_PARMS16 lpAniParms16,
  373. PMCI_ANIM_WINDOW_PARMS lpAniParms32
  374. );
  375. int
  376. ThunkCommandViaTable(
  377. LPWSTR lpCommand,
  378. DWORD dwFlags,
  379. DWORD UNALIGNED *pdwOrig16,
  380. LPBYTE pNewParms
  381. );
  382. int
  383. UnThunkMciCommand16(
  384. MCIDEVICEID devID,
  385. UINT OrigCommand,
  386. DWORD OrigFlags,
  387. PMCI_GENERIC_PARMS16 lp16GenericParms,
  388. PDWORD NewParms,
  389. LPWSTR lpCommand,
  390. UINT uTable
  391. );
  392. VOID
  393. UnThunkOpenCmd(
  394. PMCI_OPEN_PARMS16 lpOpeParms16,
  395. PMCI_OPEN_PARMS lpOpenParms32
  396. );
  397. #if DBG
  398. VOID
  399. UnThunkSysInfoCmd(
  400. DWORD OrigFlags,
  401. PMCI_SYSINFO_PARMS NewParms
  402. );
  403. #endif
  404. VOID
  405. UnThunkStatusCmd(
  406. MCIDEVICEID devID,
  407. DWORD OrigFlags,
  408. DWORD UNALIGNED *pdwOrig16,
  409. DWORD NewParms
  410. );
  411. int
  412. UnThunkCommandViaTable(
  413. LPWSTR lpCommand,
  414. DWORD UNALIGNED *pdwOrig16,
  415. DWORD pNewParms,
  416. BOOL fReturnValNotThunked
  417. );
  418. /* -------------------------------------------------------------------------
  419. ** Compatability functions.
  420. ** -------------------------------------------------------------------------
  421. */
  422. BOOL APIENTRY mciExecute(
  423. LPCSTR lpstrCommand
  424. );
  425. /* -----------------------------------------------------------------------
  426. *
  427. * MCI Command Thunks Debugging Functions and Macros
  428. *
  429. * ----------------------------------------------------------------------- */
  430. typedef struct {
  431. UINT uMsg;
  432. LPSTR lpstMsgName;
  433. } MCI_MESSAGE_NAMES;