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.

170 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name
  4. dllinit.cxx
  5. Abstract:
  6. Author:
  7. Mark Enstrom (marke) 23-Jun-1996
  8. Enviornment:
  9. User Mode
  10. Revision History:
  11. --*/
  12. #include "precomp.hxx"
  13. #pragma hdrstop
  14. INT gbCheckHandleLevel = 0;
  15. OSVERSIONINFO Win32VersionInformation;
  16. PFNTRANSBLT gpfnTransparentBlt;
  17. PFNTRANSDIB gpfnTransparentDIBits;
  18. PFNGRFILL gpfnGradientFill;
  19. PFNALPHABLEND gpfnAlphaBlend;
  20. PFNALPHADIB gpfnAlphaDIB;
  21. //PFN_GETSURFACEFROMDC pfnGetSurfaceFromDC;
  22. extern "C" {
  23. BOOLEAN
  24. DllInitialize(
  25. PVOID pvDllHandle,
  26. ULONG ulReason,
  27. PCONTEXT pcontext
  28. );
  29. }
  30. /*++
  31. Routine Description:
  32. Arguments
  33. Return Value
  34. --*/
  35. BOOLEAN
  36. DllInitialize(
  37. PVOID pvDllHandle,
  38. ULONG ulReason,
  39. PCONTEXT pcontext)
  40. {
  41. NTSTATUS status = 0;
  42. INT i;
  43. BOOLEAN fServer;
  44. PTEB pteb = NtCurrentTeb();
  45. BOOL bRet = TRUE;
  46. HMODULE hlib, hddrawlib;
  47. switch (ulReason)
  48. {
  49. case DLL_PROCESS_ATTACH:
  50. //
  51. // determine os version
  52. //
  53. Win32VersionInformation.dwOSVersionInfoSize = sizeof(Win32VersionInformation);
  54. if (!GetVersionEx(&Win32VersionInformation))
  55. {
  56. //
  57. // default win95
  58. //
  59. Win32VersionInformation.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
  60. }
  61. //
  62. // resolve API enrty points
  63. //
  64. #if !(_WIN32_WINNT >= 0x500)
  65. hlib=LoadLibrary (TEXT("gdi32.dll"));
  66. gpfnTransparentBlt = (PFNTRANSBLT)GetProcAddress (hlib, "GdiTransparentBlt");
  67. if (!gpfnTransparentBlt)
  68. {
  69. gpfnTransparentBlt = WinTransparentBlt;
  70. }
  71. gpfnTransparentDIBits = (PFNTRANSDIB)GetProcAddress (hlib, "GdiTransparentDIBits");
  72. if (!gpfnTransparentDIBits)
  73. {
  74. gpfnTransparentDIBits = WinTransparentDIBits;
  75. }
  76. gpfnGradientFill = (PFNGRFILL)GetProcAddress (hlib, "GdiGradientFill");
  77. if (!gpfnGradientFill)
  78. {
  79. gpfnGradientFill = WinGradientFill;
  80. }
  81. gpfnAlphaBlend = (PFNALPHABLEND)GetProcAddress (hlib, "GdiAlphaBlend");
  82. if (!gpfnAlphaBlend)
  83. {
  84. gpfnAlphaBlend = WinAlphaBlend;
  85. }
  86. gpfnAlphaDIB = (PFNALPHADIB)GetProcAddress (hlib, "GdiAlphaDIBBlend");
  87. if (!gpfnAlphaDIB)
  88. {
  89. gpfnAlphaDIB = WinAlphaDIBBlend;
  90. }
  91. FreeLibrary(hlib);
  92. //hddrawlib = GetModuleHandleA("ddraw");
  93. //pfnGetSurfaceFromDC = (PFN_GETSURFACEFROMDC)GetProcAddress(hddrawlib, "GetSurfaceFromDC");
  94. #else
  95. gpfnTransparentBlt = GdiTransparentBlt;
  96. gpfnTransparentDIBits = GdiTransparentDIBits;
  97. gpfnGradientFill = GdiGradientFill;
  98. gpfnAlphaBlend = GdiAlphaBlend;
  99. gpfnAlphaDIB = GdiAlphaDIBBlend;
  100. #endif
  101. #if 0
  102. gpfnAlphaDIB = WinAlphaDIBBlend;
  103. gpfnAlphaBlend = WinAlphaBlend;
  104. gpfnGradientFill = WinGradientFill;
  105. gpfnTransparentDIBits = WinTransparentDIBits;
  106. gpfnTransparentBlt = WinTransparentBlt;
  107. #endif
  108. case DLL_THREAD_ATTACH:
  109. break;
  110. case DLL_PROCESS_DETACH:
  111. case DLL_THREAD_DETACH:
  112. break;
  113. }
  114. return(bRet);
  115. pvDllHandle;
  116. pcontext;
  117. }