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.

1095 lines
39 KiB

  1. /* *************************************************************************
  2. ** INTEL Corporation Proprietary Information
  3. **
  4. ** This listing is supplied under the terms of a license
  5. ** agreement with INTEL Corporation and may not be copied
  6. ** nor disclosed except in accordance with the terms of
  7. ** that agreement.
  8. **
  9. ** Copyright (c) 1995,1996 Intel Corporation.
  10. ** All Rights Reserved.
  11. **
  12. ** *************************************************************************
  13. */
  14. //
  15. // This module is based on drvmain.c, Rev 1.24, 28 Apr 1995, from the
  16. // MRV video codec driver.
  17. //
  18. // $Author: JMCVEIGH $
  19. // $Date: 17 Apr 1997 17:04:04 $
  20. // $Archive: S:\h26x\src\common\cdrvproc.cpv $
  21. // $Header: S:\h26x\src\common\cdrvproc.cpv 1.39 17 Apr 1997 17:04:04 JMCVEIGH $
  22. //
  23. ////////////////////////////////////////////////////////////////////////////
  24. #include "precomp.h"
  25. #include <oprahcom.h>
  26. // #define TIMING 1
  27. // Timing process - for decode turn on in
  28. // CDRVPROC.CPP and D1DEC.CPP
  29. #if TIMING
  30. char szTMsg[80];
  31. unsigned long tmr_time = 0L;
  32. unsigned long tmr_frms = 0L;
  33. #endif
  34. HINSTANCE hDriverModule; // the instance-handle of this driver set in LibMain
  35. #if defined(H263P)
  36. extern BOOL MMX_Enabled;
  37. BOOL MMXDecoder_Enabled;
  38. #define _PENTIUM_PROCESSOR 1
  39. #define _PENTIUM_PRO_PROCESSOR 2
  40. #define _PENTIUM_MMX_PROCESSOR 3
  41. #define _PENTIUM_PRO_MMX_PROCESSOR 4
  42. #endif
  43. /* load free handshake */
  44. static int Loaded = 0; /* 0 prior to first DRV_LOAD and after DRV_FREE */
  45. #ifdef DEBUG
  46. HDBGZONE ghDbgZoneH263 = NULL;
  47. static PTCHAR _rgZonesH263[] = {
  48. TEXT("M263"),
  49. TEXT("Init"),
  50. TEXT("ICM Messages"),
  51. TEXT("Decode MB Header"),
  52. TEXT("Decode GOB Header"),
  53. TEXT("Decode Picture Header"),
  54. TEXT("Decode Motion Vectors"),
  55. TEXT("Decode RTP Info Stream"),
  56. TEXT("Decode Details"),
  57. TEXT("Bitrate Control"),
  58. TEXT("Bitrate Control Details"),
  59. TEXT("Encode MB"),
  60. TEXT("Encode GOB"),
  61. TEXT("Encode Motion Vectors"),
  62. TEXT("Encode RTP Info Stream"),
  63. TEXT("Encode Details")
  64. };
  65. int WINAPI H263DbgPrintf(LPTSTR lpszFormat, ... )
  66. {
  67. va_list v1;
  68. va_start(v1, lpszFormat);
  69. DbgPrintf("M263", lpszFormat, v1);
  70. va_end(v1);
  71. return TRUE;
  72. }
  73. #endif /* DEBUG */
  74. #if (defined(H261) || defined(H263))
  75. /* Suppress FP thunking for now, for H261 and H263.
  76. Thunking currently has the side effect of masking floating point exceptions,
  77. which can cause exceptions like divide by zero to go undetected.
  78. */
  79. #define FPThunking 0
  80. #else
  81. #define FPThunking 1
  82. #endif
  83. #if FPThunking
  84. ////////////////////////////////////////////////////////////////////////////
  85. // These two routines are necessary to permit a 16 bit application call //
  86. // a 32 bit codec under Windows /95. The Windows /95 thunk doesn't save //
  87. // or restore the Floating Point State. -Ben- 07/12/96 //
  88. // //
  89. U16 ThnkFPSetup(void) //
  90. { //
  91. U16 wOldFPState; //
  92. U16 wNewFPState = 0x027f; //
  93. //
  94. __asm //
  95. { //
  96. fnstcw WORD PTR [wOldFPState] //
  97. fldcw WORD PTR [wNewFPState] //
  98. } //
  99. //
  100. return(wOldFPState); //
  101. } //
  102. //
  103. void ThnkFPRestore(U16 wFPState) //
  104. { //
  105. // Prevent any pending floating point exceptions from reoccuring. //
  106. _clearfp(); //
  107. //
  108. __asm //
  109. { //
  110. fldcw WORD PTR [wFPState] //
  111. } //
  112. //
  113. return; //
  114. } //
  115. ////////////////////////////////////////////////////////////////////////////
  116. #endif /* FPThunking */
  117. ;////////////////////////////////////////////////////////////////////////////
  118. ;// Function: LRESULT WINAPI _loadds DriverProc(DWORD, HDRVR, UINT, LPARAM, LPARAM);
  119. ;//
  120. ;// Description: Added Header.
  121. ;//
  122. ;// History: 02/18/94 -BEN-
  123. ;////////////////////////////////////////////////////////////////////////////
  124. LRESULT WINAPI DriverProc(
  125. DWORD dwDriverID,
  126. HDRVR hDriver,
  127. UINT uiMessage,
  128. LPARAM lParam1,
  129. LPARAM lParam2
  130. )
  131. {
  132. SYSTEM_INFO sysinfo;
  133. LRESULT rval = 0;
  134. LPINST pi;
  135. ICDECOMPRESSEX ICDecExSt;
  136. ICDECOMPRESSEX DefaultICDecExSt = {
  137. 0,
  138. NULL, NULL,
  139. NULL, NULL,
  140. 0, 0, 0, 0,
  141. 0, 0, 0, 0
  142. };
  143. int nOn486;
  144. FX_ENTRY("DriverProc");
  145. #if FPThunking
  146. U16 u16FPState = ThnkFPSetup();
  147. #endif
  148. try
  149. {
  150. pi = (LPINST)dwDriverID;
  151. switch(uiMessage)
  152. {
  153. case DRV_LOAD:
  154. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_LOAD\r\n", _fx_));
  155. /*
  156. Sent to the driver when it is loaded. Always the first
  157. message received by a driver.
  158. dwDriverID is 0L.
  159. lParam1 is 0L.
  160. lParam2 is 0L.
  161. Return 0L to fail the load.
  162. */
  163. // put global initialization here...
  164. if(Loaded) {
  165. /* We used to return an undefined value here. It's unclear
  166. * whether this load should succeed, and if so, how or if
  167. * we need to modify our memory usage to be truly reentrant.
  168. * For now, let's explicitly fail this load attempt.
  169. */
  170. rval = 0;
  171. break;
  172. }
  173. Loaded = 1;
  174. #ifdef USE_MMX // { USE_MMX
  175. GetSystemInfo(&sysinfo);
  176. nOn486 = (sysinfo.dwProcessorType == PROCESSOR_INTEL_486);
  177. #endif // } USE_MMX
  178. if(!DrvLoad())
  179. {
  180. rval = 0;
  181. Loaded = 0;
  182. break;
  183. }
  184. #ifdef USE_MMX // { USE_MMX
  185. InitializeProcessorVersion(nOn486);
  186. #endif // } USE_MMX
  187. #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON) // { #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)
  188. // Create performance counters
  189. InitCounters();
  190. #endif // } #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)
  191. rval = (LRESULT)TRUE;
  192. break;
  193. case DRV_FREE:
  194. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_FREE\r\n", _fx_));
  195. /*
  196. Sent to the driver when it is about to be discarded. This
  197. will always be the last message received by a driver before
  198. it is freed.
  199. dwDriverID is 0L.
  200. lParam1 is 0L.
  201. lParam2 is 0L.
  202. Return value is ignored.
  203. */
  204. // put global de-initialization here...
  205. if(!Loaded)
  206. break;
  207. Loaded = 0;
  208. DrvFree();
  209. #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON) // { #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)
  210. // We're done with performance counters
  211. DoneCounters();
  212. #endif // } #if defined(DECODE_TIMINGS_ON) || defined(ENCODE_TIMINGS_ON) || defined(DETAILED_DECODE_TIMINGS_ON) || defined(DETAILED_ENCODE_TIMINGS_ON)
  213. rval = (LRESULT)TRUE;
  214. break;
  215. /*********************************************************************
  216. * standard driver messages
  217. *********************************************************************/
  218. case DRV_DISABLE:
  219. case DRV_ENABLE:
  220. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_ENABLE / DRV_DISABLE\r\n", _fx_));
  221. rval = (LRESULT)1L;
  222. break;
  223. case DRV_INSTALL:
  224. case DRV_REMOVE:
  225. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_INSTALL / DRV_REMOVE\r\n", _fx_));
  226. rval = (LRESULT)DRV_OK;
  227. break;
  228. case DRV_OPEN:
  229. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_OPEN\r\n", _fx_));
  230. /*
  231. Sent to the driver when it is opened.
  232. dwDriverID is 0L.
  233. lParam1 is a far pointer to a zero-terminated string
  234. containing the name used to open the driver.
  235. lParam2 is passed through from the drvOpen call. It is
  236. NULL if this open is from the Drivers Applet in control.exe
  237. It is a far pointer to an ICOPEN data structure otherwise.
  238. Return 0L to fail the open. Otherwise return a value that the
  239. system will use for dwDriverID in subsequent messages. In our
  240. case, we return a pointer to our INSTINFO data structure.
  241. */
  242. if (lParam2 == 0)
  243. { /* indicate we do process DRV_OPEN */
  244. rval = 0xFFFF0000;
  245. break;
  246. }
  247. /* if asked to draw, fail */
  248. if (((ICOPEN FAR *)lParam2)->dwFlags & ICMODE_DRAW)
  249. {
  250. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DrvOpen wants ICMODE_DRAW\r\n", _fx_));
  251. rval = 0L;
  252. break;
  253. }
  254. if((pi = DrvOpen((ICOPEN FAR *) lParam2)) == NULL)
  255. {
  256. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DrvOpen failed ICERR_MEMORY\r\n", _fx_));
  257. // We must return NULL on failure. We used to return
  258. // ICERR_MEMORY = -3, which implies a driver was opened
  259. rval = (LRESULT)0L;
  260. break;
  261. }
  262. rval = (LRESULT)pi;
  263. break;
  264. case DRV_CLOSE:
  265. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_CLOSE\r\n", _fx_));
  266. if(pi != (tagINSTINFO*)0 && pi != (tagINSTINFO*)0xFFFF0000)
  267. DrvClose(pi);
  268. rval = (LRESULT)1L;
  269. break;
  270. //**************************
  271. // state messages
  272. //**************************
  273. case DRV_QUERYCONFIGURE:// configuration from drivers applet
  274. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_QUERYCONFIGURE\r\n", _fx_));
  275. // this is a GLOBAL query configure
  276. rval = (LRESULT)0L;
  277. break;
  278. case DRV_CONFIGURE:
  279. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: DRV_CONFIGURE\r\n", _fx_));
  280. rval = DrvConfigure((HWND)lParam1);
  281. break;
  282. case ICM_CONFIGURE:
  283. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_CONFIGURE\r\n", _fx_));
  284. //#ifndef H261
  285. // This message is used to add extensions to the encode dialog box.
  286. // rval = Configure((HWND)lParam1);
  287. // #else
  288. rval = ICERR_UNSUPPORTED;
  289. // #endif
  290. break;
  291. case ICM_ABOUT:
  292. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_ABOUT\r\n", _fx_));
  293. rval = About((HWND)lParam1);
  294. break;
  295. case ICM_GETSTATE:
  296. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_GETSTATE\r\n", _fx_));
  297. rval = DrvGetState(pi, (LPVOID)lParam1, (DWORD)lParam2);
  298. break;
  299. case ICM_SETSTATE:
  300. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_SETSTATE\r\n", _fx_));
  301. rval = DrvSetState(pi, (LPVOID)lParam1, (DWORD)lParam2);
  302. break;
  303. case ICM_GETINFO:
  304. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_GETINFO\r\n", _fx_));
  305. rval = DrvGetInfo(pi, (ICINFO FAR *)lParam1, (DWORD)lParam2);
  306. break;
  307. //***************************
  308. // compression messages
  309. //***************************
  310. case ICM_COMPRESS_QUERY:
  311. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_QUERY\r\n", _fx_));
  312. #ifdef ENCODER_DISABLED
  313. // This disables the encoder, as the debug message states.
  314. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ENCODER DISABLED\r\n", _fx_));
  315. rval = ICERR_UNSUPPORTED;
  316. #else
  317. #ifdef USE_BILINEAR_MSH26X
  318. if (pi && pi->enabled && ((pi->fccHandler == FOURCC_H263) || (pi->fccHandler == FOURCC_H26X)))
  319. rval = CompressQuery(pi, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  320. #else
  321. if(pi && pi->enabled && (pi->fccHandler == FOURCC_H263))
  322. rval = CompressQuery(pi->CompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  323. #endif
  324. else
  325. rval = ICERR_UNSUPPORTED;
  326. #endif
  327. break;
  328. /*
  329. * ICM Compress Frames Info Structure
  330. */
  331. case ICM_COMPRESS_FRAMES_INFO:
  332. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_FRAMES_INFO\r\n", _fx_));
  333. if (pi)
  334. rval = CompressFramesInfo((LPCODINST) pi->CompPtr, (ICCOMPRESSFRAMES *) lParam1, (int) lParam2);
  335. else
  336. rval = ICERR_UNSUPPORTED;
  337. break;
  338. /*
  339. * ICM messages in support of quality.
  340. */
  341. case ICM_GETDEFAULTQUALITY:
  342. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_GETDEFAULTQUALITY\r\n", _fx_));
  343. rval = ICERR_UNSUPPORTED;
  344. break;
  345. case ICM_GETQUALITY:
  346. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_GETQUALITY\r\n", _fx_));
  347. rval = ICERR_UNSUPPORTED;
  348. break;
  349. case ICM_SETQUALITY:
  350. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_SETQUALITY\r\n", _fx_));
  351. rval = ICERR_UNSUPPORTED;
  352. break;
  353. case ICM_COMPRESS_BEGIN:
  354. /*
  355. * Notify driver to prepare to compress data by allocating and
  356. * initializing any memory it needs for compressing. Note that
  357. * ICM_COMPRESS_BEGIN and ICM_COMPRESS_END do not nest.
  358. *
  359. * Should return ICERR_OK if the specified compression is supported
  360. * or ICERR_BADFORMAT if the input or output format is not supported.
  361. */
  362. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_BEGIN\r\n", _fx_));
  363. if (pi && pi->enabled)
  364. #ifdef USE_BILINEAR_MSH26X
  365. rval = CompressBegin(pi, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  366. #else
  367. rval = CompressBegin(pi->CompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  368. #endif
  369. else
  370. rval = ICERR_UNSUPPORTED;
  371. break;
  372. case ICM_COMPRESS_GET_FORMAT:
  373. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_GET_FORMAT\r\n", _fx_));
  374. if (pi)
  375. #ifdef USE_BILINEAR_MSH26X
  376. rval = CompressGetFormat(pi, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  377. #else
  378. rval = CompressGetFormat(pi->CompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  379. #endif
  380. else
  381. rval = ICERR_UNSUPPORTED;
  382. break;
  383. case ICM_COMPRESS_GET_SIZE:
  384. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_GET_SIZE\r\n", _fx_));
  385. if (pi && lParam1)
  386. #ifdef USE_BILINEAR_MSH26X
  387. rval = CompressGetSize(pi, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  388. #else
  389. rval = CompressGetSize(pi->CompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2 );
  390. #endif
  391. else
  392. rval = ICERR_UNSUPPORTED;
  393. break;
  394. case ICM_COMPRESS:
  395. /*
  396. * Returns ICERR_OK if successful or an error code otherwise.
  397. */
  398. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS\r\n", _fx_));
  399. if (pi && pi->enabled)
  400. rval = Compress(
  401. #ifdef USE_BILINEAR_MSH26X
  402. pi,
  403. #else
  404. pi->CompPtr, // ptr to Compressor instance information.
  405. #endif
  406. (ICCOMPRESS FAR *)lParam1, // ptr to ICCOMPRESS structure.
  407. (DWORD)lParam2 // size in bytes of the ICCOMPRESS structure.
  408. );
  409. else
  410. rval = ICERR_UNSUPPORTED;
  411. break;
  412. case ICM_COMPRESS_END:
  413. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_COMPRESS_END\r\n", _fx_));
  414. if (pi && pi->enabled)
  415. rval = CompressEnd(pi->CompPtr);
  416. else
  417. rval = ICERR_UNSUPPORTED;
  418. break;
  419. //***************************
  420. // decompress messages
  421. //***************************
  422. case ICM_DECOMPRESS_QUERY:
  423. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_QUERY\r\n", _fx_));
  424. ICDecExSt = DefaultICDecExSt;
  425. ICDecExSt.lpbiSrc = (LPBITMAPINFOHEADER)lParam1;
  426. ICDecExSt.lpbiDst = (LPBITMAPINFOHEADER)lParam2;
  427. if (pi)
  428. rval = DecompressQuery(pi->DecompPtr, (ICDECOMPRESSEX FAR *)&ICDecExSt, FALSE);
  429. else
  430. rval = ICERR_UNSUPPORTED;
  431. break;
  432. case ICM_DECOMPRESS_BEGIN:
  433. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_BEGIN\r\n", _fx_));
  434. ICDecExSt = DefaultICDecExSt;
  435. ICDecExSt.lpbiSrc = (LPBITMAPINFOHEADER)lParam1;
  436. ICDecExSt.lpbiDst = (LPBITMAPINFOHEADER)lParam2;
  437. if (pi)
  438. rval = DecompressBegin(pi->DecompPtr, (ICDECOMPRESSEX FAR *)&ICDecExSt, FALSE);
  439. else
  440. rval = ICERR_UNSUPPORTED;
  441. break;
  442. case ICM_DECOMPRESS_GET_FORMAT:
  443. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_GET_FORMAT\r\n", _fx_));
  444. if (pi)
  445. #ifdef USE_BILINEAR_MSH26X
  446. rval = DecompressGetFormat(pi, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2);
  447. #else
  448. rval = DecompressGetFormat(pi->DecompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2);
  449. #endif
  450. else
  451. rval = ICERR_UNSUPPORTED;
  452. break;
  453. case ICM_DECOMPRESS_GET_PALETTE:
  454. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_GET_PALETTE\r\n", _fx_));
  455. if (pi)
  456. rval = DecompressGetPalette(pi->DecompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2);
  457. else
  458. rval = ICERR_UNSUPPORTED;
  459. break;
  460. case ICM_DECOMPRESS_SET_PALETTE:
  461. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_SET_PALETTE : not supported\r\n", _fx_));
  462. rval = ICERR_UNSUPPORTED;
  463. // rval = DecompressSetPalette(pi->DecompPtr, (LPBITMAPINFOHEADER)lParam1, (LPBITMAPINFOHEADER)lParam2);
  464. break;
  465. case ICM_DECOMPRESS:
  466. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS\r\n", _fx_));
  467. if (pi && (pi->enabled || (((ICDECOMPRESS FAR *)lParam1)->lpbiInput->biCompression == FOURCC_YUV12) || (((ICDECOMPRESS FAR *)lParam1)->lpbiInput->biCompression == FOURCC_IYUV)))
  468. {
  469. ICDecExSt = DefaultICDecExSt;
  470. ICDecExSt.dwFlags = ((ICDECOMPRESS FAR *)lParam1)->dwFlags;
  471. ICDecExSt.lpbiSrc = ((ICDECOMPRESS FAR *)lParam1)->lpbiInput;
  472. ICDecExSt.lpSrc = ((ICDECOMPRESS FAR *)lParam1)->lpInput;
  473. ICDecExSt.lpbiDst = ((ICDECOMPRESS FAR *)lParam1)->lpbiOutput;
  474. ICDecExSt.lpDst = ((ICDECOMPRESS FAR *)lParam1)->lpOutput;
  475. rval = Decompress(pi->DecompPtr, (ICDECOMPRESSEX FAR *)&ICDecExSt, (DWORD)lParam2, FALSE);
  476. #if TIMING // Output Timing Results in VC++ 2.0 Debug Window
  477. wsprintf(szTMsg, "Total Decode Time = %ld ms", tmr_time);
  478. TOUT(szTMsg);
  479. wsprintf(szTMsg, "Total Frames = %ld", tmr_frms);
  480. TOUT(szTMsg);
  481. wsprintf(szTMsg, "Average Frame Decode = %ld.%ld ms",
  482. tmr_time / tmr_frms,
  483. ((tmr_time % tmr_frms) * 1000) / tmr_frms);
  484. TOUT(szTMsg);
  485. #endif
  486. }
  487. else
  488. rval = ICERR_UNSUPPORTED;
  489. break;
  490. case ICM_DECOMPRESS_END:
  491. case ICM_DECOMPRESSEX_END:
  492. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESS_END / ICM_DECOMPRESSEX_END\r\n", _fx_));
  493. if (pi)
  494. rval = DecompressEnd(pi->DecompPtr);
  495. else
  496. rval = ICERR_UNSUPPORTED;
  497. break;
  498. //***************************
  499. // decompress X messages
  500. //***************************
  501. case ICM_DECOMPRESSEX:
  502. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESSEX\r\n", _fx_));
  503. if (pi && (pi->enabled || (((ICDECOMPRESS FAR *)lParam1)->lpbiInput->biCompression == FOURCC_YUV12)|| (((ICDECOMPRESS FAR *)lParam1)->lpbiInput->biCompression == FOURCC_IYUV)))
  504. rval = Decompress(pi->DecompPtr, (ICDECOMPRESSEX FAR *)lParam1, (DWORD)lParam2, TRUE);
  505. else
  506. rval = ICERR_UNSUPPORTED;
  507. break;
  508. case ICM_DECOMPRESSEX_BEGIN:
  509. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESSEX_BEGIN\r\n", _fx_));
  510. if (pi)
  511. rval = DecompressBegin(pi->DecompPtr, (ICDECOMPRESSEX FAR *)lParam1, TRUE);
  512. else
  513. rval = ICERR_UNSUPPORTED;
  514. break;
  515. case ICM_DECOMPRESSEX_QUERY:
  516. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: ICM_DECOMPRESSEX_QUERY\r\n", _fx_));
  517. #ifdef TURN_OFF_DECOMPRESSEX
  518. rval = ICERR_UNSUPPORTED;
  519. #else
  520. if (pi)
  521. rval = DecompressQuery(pi->DecompPtr, (ICDECOMPRESSEX FAR *)lParam1, TRUE);
  522. else
  523. rval = ICERR_UNSUPPORTED;
  524. #endif
  525. break;
  526. // *********************************************************************
  527. // custom driver messages for bright/cont/sat
  528. // *********************************************************************
  529. case CODEC_CUSTOM_VIDEO_EFFECTS:
  530. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: CODEC_CUSTOM_VIDEO_EFFECTS\r\n", _fx_));
  531. if(LOWORD(lParam1) == VE_HUE) {
  532. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_HUE : Unsupported\r\n", _fx_));
  533. rval = ICERR_UNSUPPORTED;
  534. break;
  535. }
  536. switch(HIWORD(lParam1))
  537. {
  538. case VE_GET_FACTORY_DEFAULT:
  539. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_GET_FACTORY_DEFAULT\r\n", _fx_));
  540. *((WORD FAR *)lParam2) = 128;
  541. rval = ICERR_OK;
  542. break;
  543. case VE_GET_FACTORY_LIMITS:
  544. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_GET_FACTORY_LIMITS\r\n", _fx_));
  545. *((DWORD FAR *)lParam2) = 0x00FF0000;
  546. rval = ICERR_OK;
  547. break;
  548. case VE_SET_CURRENT:
  549. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_SET_CURRENT\r\n", _fx_));
  550. if(LOWORD(lParam1) == VE_BRIGHTNESS)
  551. {
  552. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_BRIGHTNESS\r\n", _fx_));
  553. rval = CustomChangeBrightness(pi->DecompPtr, (BYTE)(lParam2 & 0x000000FF));
  554. }
  555. if(LOWORD(lParam1) == VE_SATURATION)
  556. {
  557. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_SATURATION\r\n", _fx_));
  558. rval = CustomChangeSaturation(pi->DecompPtr, (BYTE)(lParam2 & 0x000000FF));
  559. }
  560. if(LOWORD(lParam1) == VE_CONTRAST)
  561. {
  562. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_CONTRAST\r\n", _fx_));
  563. rval = CustomChangeContrast(pi->DecompPtr, (BYTE)(lParam2 & 0x000000FF));
  564. }
  565. break;
  566. case VE_RESET_CURRENT:
  567. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_RESET_CURRENT\r\n", _fx_));
  568. if(LOWORD(lParam1) == VE_BRIGHTNESS)
  569. {
  570. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_BRIGHTNESS\r\n", _fx_));
  571. rval = CustomResetBrightness(pi->DecompPtr);
  572. }
  573. if(LOWORD(lParam1) == VE_CONTRAST)
  574. {
  575. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_CONTRAST\r\n", _fx_));
  576. rval = CustomResetContrast(pi->DecompPtr);
  577. }
  578. if(LOWORD(lParam1) == VE_SATURATION)
  579. {
  580. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: VE_SATURATION\r\n", _fx_));
  581. rval = CustomResetSaturation(pi->DecompPtr);
  582. }
  583. break;
  584. default:
  585. rval = ICERR_UNSUPPORTED;
  586. break;
  587. }
  588. break;
  589. case CODEC_CUSTOM_ENCODER_CONTROL:
  590. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: CODEC_CUSTOM_ENCODER_CONTROL\r\n", _fx_));
  591. switch(HIWORD(lParam1))
  592. {
  593. case EC_GET_FACTORY_DEFAULT:
  594. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_GET_FACTORY_DEFAULT\r\n", _fx_));
  595. rval = ICERR_OK;
  596. switch(LOWORD(lParam1))
  597. {
  598. case EC_RTP_HEADER:
  599. *((DWORD FAR *)lParam2) = 0L; // 1 == On, 0 == Off
  600. break;
  601. case EC_RESILIENCY:
  602. *((DWORD FAR *)lParam2) = 0L; // 1 == On, 0 == Off
  603. break;
  604. case EC_BITRATE_CONTROL:
  605. *((DWORD FAR *)lParam2) = 0L; // 1 == On, 0 == Off
  606. break;
  607. case EC_PACKET_SIZE:
  608. *((DWORD FAR *)lParam2) = 512L;
  609. break;
  610. case EC_PACKET_LOSS:
  611. *((DWORD FAR *)lParam2) = 10L;
  612. break;
  613. case EC_BITRATE:
  614. *((DWORD FAR *)lParam2) = 1664L;
  615. break;
  616. default:
  617. rval = ICERR_UNSUPPORTED;
  618. }
  619. break;
  620. case EC_RESET_TO_FACTORY_DEFAULTS:
  621. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_RESET_TO_FACTORY_DEFAULTS\r\n", _fx_));
  622. rval = CustomResetToFactoryDefaults(pi->CompPtr);
  623. break;
  624. case EC_GET_FACTORY_LIMITS:
  625. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_GET_FACTORY_LIMITS\r\n", _fx_));
  626. rval = ICERR_OK;
  627. switch(LOWORD(lParam1))
  628. {
  629. case EC_PACKET_SIZE:
  630. *((DWORD FAR *)lParam2) = 0x05DC0100;
  631. break;
  632. case EC_PACKET_LOSS:
  633. *((DWORD FAR *)lParam2) = 0x00640000;
  634. break;
  635. case EC_BITRATE: /* Bit rate limits are returned as */
  636. *((DWORD FAR *)lParam2) = 0x34000400; /* the number of bytes per second */
  637. break;
  638. default:
  639. rval = ICERR_UNSUPPORTED;
  640. }
  641. break;
  642. case EC_GET_CURRENT:
  643. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_GET_CURRENT\r\n", _fx_));
  644. switch(LOWORD(lParam1))
  645. {
  646. case EC_RTP_HEADER:
  647. rval = CustomGetRTPHeaderState(pi->CompPtr, (DWORD FAR *)lParam2);
  648. break;
  649. case EC_RESILIENCY:
  650. rval = CustomGetResiliencyState(pi->CompPtr, (DWORD FAR *)lParam2);
  651. break;
  652. case EC_BITRATE_CONTROL:
  653. rval = CustomGetBitRateState(pi->CompPtr, (DWORD FAR *)lParam2);
  654. break;
  655. case EC_PACKET_SIZE:
  656. rval = CustomGetPacketSize(pi->CompPtr, (DWORD FAR *)lParam2);
  657. break;
  658. case EC_PACKET_LOSS:
  659. rval = CustomGetPacketLoss(pi->CompPtr, (DWORD FAR *)lParam2);
  660. break;
  661. case EC_BITRATE: /* Bit rate is returned in bits per second */
  662. rval = CustomGetBitRate(pi->CompPtr, (DWORD FAR *)lParam2);
  663. break;
  664. #ifdef H263P
  665. case EC_H263_PLUS:
  666. rval = CustomGetH263PlusState(pi->CompPtr, (DWORD FAR *)lParam2);
  667. break;
  668. case EC_IMPROVED_PB_FRAMES:
  669. rval = CustomGetImprovedPBState(pi->CompPtr, (DWORD FAR *)lParam2);
  670. break;
  671. case EC_DEBLOCKING_FILTER:
  672. rval = CustomGetDeblockingFilterState(pi->CompPtr, (DWORD FAR *)lParam2);
  673. break;
  674. case EC_MACHINE_TYPE:
  675. // Return the machine type in (reference param) lParam2
  676. // This message should not be invoked until after CompressBegin
  677. // since this is where GetEncoderOptions is called, and the
  678. // MMX version is properly set (via init file check).
  679. rval = ICERR_OK;
  680. if (ProcessorVersionInitialized) {
  681. if (MMX_Enabled) {
  682. if (P6Version) {
  683. *(int *)lParam2 = _PENTIUM_PRO_MMX_PROCESSOR;
  684. } else {
  685. *(int *)lParam2 = _PENTIUM_MMX_PROCESSOR;
  686. }
  687. } else {
  688. if (P6Version) {
  689. *(int *)lParam2 = _PENTIUM_PRO_PROCESSOR;
  690. } else {
  691. *(int *)lParam2 = _PENTIUM_PROCESSOR;
  692. }
  693. }
  694. } else {
  695. rval = ICERR_UNSUPPORTED;
  696. }
  697. break;
  698. #endif
  699. default:
  700. rval = ICERR_UNSUPPORTED;
  701. }
  702. break;
  703. case EC_SET_CURRENT:
  704. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_SET_CURRENT\r\n", _fx_));
  705. switch(LOWORD(lParam1))
  706. {
  707. case EC_RTP_HEADER:
  708. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_RTP_HEADER\r\n", _fx_));
  709. rval = CustomSetRTPHeaderState(pi->CompPtr, (DWORD)lParam2);
  710. break;
  711. case EC_RESILIENCY:
  712. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_RESILIENCY\r\n", _fx_));
  713. rval = CustomSetResiliencyState(pi->CompPtr, (DWORD)lParam2);
  714. break;
  715. case EC_BITRATE_CONTROL:
  716. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_BITRATE_CONTROL\r\n", _fx_));
  717. rval = CustomSetBitRateState(pi->CompPtr, (DWORD)lParam2);
  718. break;
  719. case EC_PACKET_SIZE:
  720. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_PACKET_SIZE\r\n", _fx_));
  721. rval = CustomSetPacketSize(pi->CompPtr, (DWORD)lParam2);
  722. break;
  723. case EC_PACKET_LOSS:
  724. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_PACKET_LOSS\r\n", _fx_));
  725. rval = CustomSetPacketLoss(pi->CompPtr, (DWORD)lParam2);
  726. break;
  727. case EC_BITRATE: /* Bit rate is set in bits per second */
  728. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: EC_BITRATE\r\n", _fx_));
  729. rval = CustomSetBitRate(pi->CompPtr, (DWORD)lParam2);
  730. break;
  731. #ifdef H263P
  732. case EC_H263_PLUS:
  733. rval = CustomSetH263PlusState(pi->CompPtr, (DWORD)lParam2);
  734. break;
  735. case EC_IMPROVED_PB_FRAMES:
  736. rval = CustomSetImprovedPBState(pi->CompPtr, (DWORD)lParam2);
  737. break;
  738. case EC_DEBLOCKING_FILTER:
  739. rval = CustomSetDeblockingFilterState(pi->CompPtr, (DWORD)lParam2);
  740. break;
  741. #endif
  742. default:
  743. rval = ICERR_UNSUPPORTED;
  744. }
  745. break;
  746. default:
  747. rval = ICERR_UNSUPPORTED;
  748. break;
  749. }
  750. break;
  751. // custom decoder control
  752. case CODEC_CUSTOM_DECODER_CONTROL:
  753. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: CODEC_CUSTOM_DECODER_CONTROL\r\n", _fx_));
  754. switch (HIWORD(lParam1))
  755. {
  756. case DC_SET_CURRENT:
  757. switch (LOWORD(lParam1))
  758. {
  759. case DC_BLOCK_EDGE_FILTER:
  760. rval = CustomSetBlockEdgeFilter(pi->DecompPtr,(DWORD)lParam2);
  761. break;
  762. default:
  763. rval = ICERR_UNSUPPORTED;
  764. break;
  765. }
  766. break;
  767. #if defined(H263P)
  768. case DC_GET_CURRENT:
  769. switch (LOWORD(lParam1))
  770. {
  771. case DC_MACHINE_TYPE:
  772. // Return the machine type in (reference param) lParam2
  773. // This message should not be invoked until after DecompressBegin
  774. // since this is where GetDecoderOptions is called, and the
  775. // MMX version is properly set (via init file check). Note
  776. // that the DecoderContext flag is not used here. GetDecoderOptions has
  777. // been modified to supply the MMX flag in both DC->bMMXDecoder
  778. // and MMX_Enabled.
  779. rval = ICERR_OK;
  780. if (ProcessorVersionInitialized) {
  781. if (MMXDecoder_Enabled) {
  782. if (P6Version) {
  783. *(int *)lParam2 = _PENTIUM_PRO_MMX_PROCESSOR;
  784. } else {
  785. *(int *)lParam2 = _PENTIUM_MMX_PROCESSOR;
  786. }
  787. } else {
  788. if (P6Version) {
  789. *(int *)lParam2 = _PENTIUM_PRO_PROCESSOR;
  790. } else {
  791. *(int *)lParam2 = _PENTIUM_PROCESSOR;
  792. }
  793. }
  794. }
  795. break;
  796. default:
  797. rval = ICERR_UNSUPPORTED;
  798. break;
  799. }
  800. break;
  801. #endif
  802. default:
  803. rval = ICERR_UNSUPPORTED;
  804. break;
  805. }
  806. break;
  807. case PLAYBACK_CUSTOM_CHANGE_BRIGHTNESS:
  808. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: PLAYBACK_CUSTOM_CHANGE_BRIGHTNESS\r\n", _fx_));
  809. rval = CustomChangeBrightness(pi->DecompPtr, (BYTE)(lParam1 & 0x000000FF));
  810. break;
  811. case PLAYBACK_CUSTOM_CHANGE_CONTRAST:
  812. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: PLAYBACK_CUSTOM_CHANGE_CONTRAST\r\n", _fx_));
  813. rval = CustomChangeContrast(pi->DecompPtr, (BYTE)(lParam1 & 0x000000FF));
  814. break;
  815. case PLAYBACK_CUSTOM_CHANGE_SATURATION:
  816. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: PLAYBACK_CUSTOM_CHANGE_SATURATION\r\n", _fx_));
  817. rval = CustomChangeSaturation(pi->DecompPtr, (BYTE)(lParam1 & 0x000000FF));
  818. break;
  819. case PLAYBACK_CUSTOM_RESET_BRIGHTNESS:
  820. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: PLAYBACK_CUSTOM_RESET_BRIGHTNESS\r\n", _fx_));
  821. rval = CustomResetBrightness(pi->DecompPtr);
  822. rval |= CustomResetContrast(pi->DecompPtr);
  823. break;
  824. case PLAYBACK_CUSTOM_RESET_SATURATION:
  825. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: PLAYBACK_CUSTOM_RESET_SATURATION\r\n", _fx_));
  826. rval = CustomResetSaturation(pi->DecompPtr);
  827. break;
  828. // *********************************************************************
  829. // custom application identification message
  830. // *********************************************************************
  831. case APPLICATION_IDENTIFICATION_CODE:
  832. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: APPLICATION_IDENTIFICATION_CODE\r\n", _fx_));
  833. rval = ICERR_OK;
  834. break;
  835. case CUSTOM_ENABLE_CODEC:
  836. DEBUGMSG(ZONE_ICM_MESSAGES, ("%s: CUSTOM_ENABLE_CODEC\r\n", _fx_));
  837. if (pi)
  838. {
  839. if (lParam1 == G723MAGICWORD1 && lParam2 == G723MAGICWORD2)
  840. pi->enabled = TRUE;
  841. else
  842. pi->enabled = FALSE;
  843. }
  844. rval = ICERR_OK;
  845. break;
  846. default:
  847. if (uiMessage < DRV_USER)
  848. {
  849. if(dwDriverID == 0)
  850. rval = ICERR_UNSUPPORTED;
  851. else
  852. rval = DefDriverProc(dwDriverID, hDriver, uiMessage,
  853. lParam1, lParam2);
  854. }
  855. else
  856. rval = ICERR_UNSUPPORTED;
  857. }
  858. }
  859. catch (...)
  860. {
  861. #if defined(DEBUG) || defined(_DEBUG)
  862. // For a DEBUG build, display a message and pass the exception up.
  863. ERRORMESSAGE(("%s: Exception during DriverProc!!!\r\n", _fx_));
  864. throw;
  865. #else
  866. // For a release build, stop the exception here and return an error
  867. // code. This gives upstream code a chance to gracefully recover.
  868. // We also need to clear the floating point status word, otherwise
  869. // the upstream code may incur an exception the next time it tries
  870. // a floating point operation (presuming this exception was due
  871. // to a floating point problem).
  872. _clearfp();
  873. rval = (DWORD) ICERR_INTERNAL;
  874. #endif
  875. }
  876. #if FPThunking
  877. ThnkFPRestore(u16FPState);
  878. #endif
  879. return(rval);
  880. }
  881. #ifdef WIN32
  882. #ifndef QUARTZ
  883. /****************************************************************************
  884. * @doc INTERNAL
  885. *
  886. * @api BOOL | DllMain | Library initialization & exit code.
  887. *
  888. * @parm HANDLE | hModule | Our module handle.
  889. *
  890. * @parm DWORD | dwReason | The function being requested.
  891. *
  892. * @parm LPVOID | lpReserved | Unused at this time.
  893. *
  894. * @rdesc Returns 1 if the initialization was successful and 0 otherwise.
  895. ***************************************************************************/
  896. BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
  897. {
  898. BOOL rval = TRUE;
  899. /* DO NOT INSTALL PROFILE PROBES HERE. IT IS CALLED PRIOR TO THE LOAD message */
  900. switch(dwReason)
  901. {
  902. case DLL_PROCESS_ATTACH:
  903. /*======================================================*\
  904. /* A new instance is being invoked.
  905. /* Allocate data to be used by this instance, 1st thread
  906. /* lpReserved = NULL for dynamic loads, !NULL for static
  907. /* Use TlsAlloc() to create a TlsIndex for this instance
  908. /* The TlsIndex can be stored in a simple global variable
  909. /* as data allocated to each process is unique.
  910. /* Return TRUE upon success, FALSE otherwise.
  911. /*======================================================*/
  912. hDriverModule = hModule;
  913. #if defined DEBUG
  914. if (DebugH26x)OutputDebugString(TEXT("\n MRV DllMain Process Attach"));
  915. #endif /* DEBUG */
  916. DBGINIT(&ghDbgZoneH263, _rgZonesH263);
  917. DBG_INIT_MEMORY_TRACKING(hModule);
  918. #ifdef TRACK_ALLOCATIONS
  919. OpenMemmon();
  920. #endif
  921. break;
  922. case DLL_PROCESS_DETACH:
  923. /*======================================================*\
  924. /* An instance is being terminated.
  925. /* Deallocate memory used by all threads in this instance
  926. /* lpReserved = NULL if called by FreeLibrary()
  927. /* !NULL if called at process termination
  928. /* Use TlsFree() to return TlsIndex to the pool.
  929. /* Clean up all known threads.
  930. /* May match many DLL_THREAD_ATTACHes.
  931. /* Return value is ignored.
  932. /*======================================================*/
  933. #if defined DEBUG
  934. if (DebugH26x)OutputDebugString(TEXT("\nMRV DllMain Process Detach"));
  935. #endif /* DEBUG */
  936. #ifdef TRACK_ALLOCATIONS
  937. // CloseMemmon();
  938. #endif
  939. DBG_CHECK_MEMORY_TRACKING(hModule);
  940. DBGDEINIT(&ghDbgZoneH263);
  941. break;
  942. case DLL_THREAD_ATTACH:
  943. /*======================================================*\
  944. /* A new thread within the specified instance is being invoked.
  945. /* Allocate data to be used by this thread.
  946. /* Use the TlsIndex to access instance data.
  947. /* Return value is ignored.
  948. /*======================================================*/
  949. #if defined DEBUG
  950. if (DebugH26x)OutputDebugString(TEXT("\nMRV DllMain Thread Attach"));
  951. #endif /* DEBUG */
  952. break;
  953. case DLL_THREAD_DETACH:
  954. /*======================================================*\
  955. /* A thread within the specified instance is being terminated.
  956. /* Deallocate memory used by this thread.
  957. /* Use the TlsIndex to access instance data.
  958. /* May match DLL_PROCESS_ATTACH instead of DLL_THREAD_ATTACH
  959. /* Will be called even if DLL_THREAD_ATTACH failed or wasn't called
  960. /* Return value is ignored.
  961. /*======================================================*/
  962. #if defined DEBUG
  963. if (DebugH26x)OutputDebugString(TEXT("\n MRV DllMain Thread Detach"));
  964. #endif /* DEBUG */
  965. break;
  966. default:
  967. /*======================================================*\
  968. /* Don't know the reason the DLL Entry Point was called.
  969. /* Return FALSE to be safe.
  970. /*======================================================*/
  971. #if defined DEBUG
  972. if (DebugH26x)OutputDebugString(TEXT("\n MRV DllMain Reason Unknown"));
  973. #endif /* DEBUG */
  974. rval = FALSE; /* indicate failure with 0 as
  975. * (NULL can't be used in WIN32
  976. */
  977. }
  978. return(rval);
  979. }
  980. #endif /* end #ifndef QUARTZ */
  981. #else /* else not #ifdef WIN32 */
  982. ;////////////////////////////////////////////////////////////////////////////
  983. ;// Function: int NEAR PASCAL LibMain(HANDLE, WORD, LPSTR);
  984. ;//
  985. ;// Description: Added header.
  986. ;//
  987. ;// History: 02/18/94 -BEN-
  988. ;////////////////////////////////////////////////////////////////////////////
  989. INT WINAPI LibMain(HANDLE hModule, WORD wHeapSize, LPSTR lpCmdLine)
  990. {
  991. hDriverModule = hModule;
  992. return 1;
  993. }
  994. #endif