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.

166 lines
4.1 KiB

  1. /*
  2. init.c initialisation for MSVIDEO.DLL
  3. Copyright (c) Microsoft Corporation 1992. All rights reserved
  4. */
  5. #include <windows.h>
  6. #include <win32.h>
  7. #include <verinfo.h> // to get rup
  8. #include "mmsystem.h"
  9. #include "msviddrv.h"
  10. #include "msvideo.h"
  11. #include "msvideoi.h"
  12. #ifdef WIN32
  13. /* we have to allow the compman dll to perform load and unload
  14. * processing - it has a critsec that needs to be initialised and freed
  15. */
  16. extern void IC_Load(void);
  17. extern void IC_Unload(void);
  18. #else
  19. #define IC_Load()
  20. #define IC_Unload()
  21. #endif
  22. extern void FAR PASCAL videoCleanup(HTASK hTask);
  23. extern void FAR PASCAL DrawDibCleanup(HTASK hTask);
  24. extern void FAR PASCAL ICCleanup(HTASK hTask);
  25. /*****************************************************************************
  26. * @doc INTERNAL VIDEO
  27. *
  28. * DLLEntryPoint - common DLL entry point.
  29. *
  30. * this code is called on both Win16 and Win32, libentry.asm handles
  31. * this on Win16 and the system handles it on NT.
  32. *
  33. ****************************************************************************/
  34. #ifndef DLL_PROCESS_DETACH
  35. #define DLL_PROCESS_DETACH 0
  36. #define DLL_PROCESS_ATTACH 1
  37. #define DLL_THREAD_ATTACH 2
  38. #define DLL_THREAD_DETACH 3
  39. #endif
  40. #ifndef NOTHUNKS
  41. VOID FAR PASCAL InitThunks(void);
  42. BOOL gfVideo32;
  43. BOOL gfICM32;
  44. #endif // NOTHUNKS
  45. BOOL WINAPI DLLEntryPoint(HINSTANCE hInstance, ULONG Reason, LPVOID pv)
  46. {
  47. switch (Reason)
  48. {
  49. case DLL_PROCESS_ATTACH:
  50. ghInst = hInstance;
  51. IC_Load();
  52. #ifndef NOTHUNKS
  53. DPF(("Setting up the thunk code\n"));
  54. InitThunks();
  55. DPF(("All thunks initialised: gfVideo32=%d, gfICM32=%d\n", gfVideo32, gfICM32));
  56. #endif // NOTHUNKS
  57. break;
  58. case DLL_PROCESS_DETACH:
  59. DrawDibCleanup(NULL);
  60. ICCleanup(NULL);
  61. IC_Unload();
  62. videoCleanup(NULL);
  63. break;
  64. case DLL_THREAD_DETACH:
  65. break;
  66. case DLL_THREAD_ATTACH:
  67. break;
  68. }
  69. return TRUE;
  70. }
  71. /*****************************************************************************
  72. * @doc EXTERNAL VIDEO
  73. *
  74. * @api DWORD | VideoForWindowsVersion | This function returns the version
  75. * of the Microsoft Video for Windows software.
  76. *
  77. * @rdesc Returns a DWORD version, the hiword is the product version the
  78. * loword is the minor revision.
  79. *
  80. * @comm currently returns 0x010A00## (1.10.00.##) ## is the internal build
  81. * number.
  82. *
  83. ****************************************************************************/
  84. #if 0
  85. #ifdef rup
  86. #define MSVIDEO_VERSION (0x01000000l+rup) // 1.00.00.##
  87. #else
  88. #define MSVIDEO_VERSION (0x01000000l) // 1.00.00.00
  89. #endif
  90. #else
  91. #define MSVIDEO_VERSION (0x0L+(((DWORD)MMVERSION)<<24)+(((DWORD)MMREVISION)<<16)+((DWORD)MMRELEASE))
  92. #endif
  93. DWORD FAR PASCAL VideoForWindowsVersion(void)
  94. {
  95. return MSVIDEO_VERSION;
  96. }
  97. /*****************************************************************************
  98. *
  99. * dprintf() is called by the DPF macro if DEBUG is defined at compile time.
  100. *
  101. * The messages will be send to COM1: like any debug message. To
  102. * enable debug output, add the following to WIN.INI :
  103. *
  104. * [debug]
  105. * MSVIDEO=1
  106. *
  107. ****************************************************************************/
  108. #ifdef DEBUG
  109. #define MODNAME "MSVIDEO"
  110. #ifndef WIN32
  111. #define lstrcatA lstrcat
  112. #define lstrcpyA lstrcpy
  113. #define lstrlenA lstrlen
  114. #define wvsprintfA wvsprintf
  115. #define GetProfileIntA GetProfileInt
  116. #define OutputDebugStringA OutputDebugString
  117. #endif
  118. #define _WINDLL
  119. #include <stdarg.h>
  120. void FAR CDECL dprintf(LPSTR szFormat, ...)
  121. {
  122. char ach[128];
  123. va_list va;
  124. static BOOL fDebug = -1;
  125. if (fDebug == -1)
  126. fDebug = GetProfileIntA("Debug", MODNAME, FALSE);
  127. if (!fDebug)
  128. return;
  129. lstrcpyA(ach, MODNAME ": ");
  130. va_start(va, szFormat);
  131. wvsprintfA(ach+lstrlenA(ach),szFormat,(LPSTR)va);
  132. va_end(va);
  133. lstrcatA(ach, "\r\n");
  134. OutputDebugStringA(ach);
  135. }
  136. #endif
  137.