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.

138 lines
4.3 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: registry.c
  8. *
  9. * Content: Routines to initialize the registry and lookup string values.
  10. *
  11. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #include "precomp.h"
  15. /******************************Public*Data*Struct**************************\
  16. * BOOL bGlintQueryRegistryValueUlong
  17. *
  18. * Take a string and look up its value in the registry. We assume that the
  19. * value fits into 4 bytes. Fill in the supplied DWORD pointer with the value.
  20. *
  21. * Returns:
  22. * TRUE if we found the string, FALSE if not. Note, if we failed to init
  23. * the registry the query funtion will simply fail and we act as though
  24. * the string was not defined.
  25. *
  26. \**************************************************************************/
  27. BOOL
  28. bGlintQueryRegistryValueUlong(PPDEV ppdev, LPWSTR valueStr, PULONG pData)
  29. {
  30. ULONG ReturnedDataLength;
  31. ULONG inSize;
  32. ULONG outData;
  33. PWCHAR inStr;
  34. // get the string length including the NULL
  35. for (inSize = 2, inStr = valueStr; *inStr != 0; ++inStr, inSize += 2);
  36. if (EngDeviceIoControl(ppdev->hDriver,
  37. IOCTL_VIDEO_QUERY_REGISTRY_DWORD,
  38. valueStr, // input buffer
  39. inSize,
  40. &outData, // output buffer
  41. sizeof(ULONG),
  42. &ReturnedDataLength))
  43. {
  44. DISPDBG((WRNLVL, "bGlintQueryRegistryValueUlong failed"));
  45. return(FALSE);
  46. }
  47. *pData = outData;
  48. DISPDBG((DBGLVL, "bGlintQueryRegistryValueUlong "
  49. "returning 0x%x (ReturnedDataLength = %d)",
  50. *pData, ReturnedDataLength));
  51. return(TRUE);
  52. }
  53. //@@BEGIN_DDKSPLIT
  54. #if 0
  55. /******************************Public*Data*Struct**************************\
  56. * BOOL bGlintRegistryRetrieveGammaLUT
  57. *
  58. * Look up the registry to reload the saved gamma LUT into memory.
  59. *
  60. * Returns:
  61. * TRUE if we found the string, FALSE if not. Note, if we failed to init
  62. * the registry the query funtion will simply fail and we act as though
  63. * the string was not defined.
  64. *
  65. \**************************************************************************/
  66. BOOL
  67. bGlintRegistryRetrieveGammaLUT(
  68. PPDEV ppdev,
  69. PVIDEO_CLUT pScreenClut
  70. )
  71. {
  72. ULONG ReturnedDataLength;
  73. if (EngDeviceIoControl(ppdev->hDriver,
  74. IOCTL_VIDEO_REG_RETRIEVE_GAMMA_LUT,
  75. NULL, // input buffer
  76. 0,
  77. pScreenClut, // output buffer
  78. MAX_CLUT_SIZE,
  79. &ReturnedDataLength))
  80. {
  81. DISPDBG((-1, "IOCTL_VIDEO_REG_RETRIEVE_GAMMA_LUT failed"));
  82. return(FALSE);
  83. }
  84. return(TRUE);
  85. }
  86. /******************************Public*Data*Struct**************************\
  87. * BOOL bGlintRegistrySaveGammaLUT
  88. *
  89. * Save the gamma lut in the registry for later reloading.
  90. *
  91. * Returns:
  92. * TRUE if we found the string, FALSE if not. Note, if we failed to init
  93. * the registry the query funtion will simply fail and we act as though
  94. * the string was not defined.
  95. *
  96. \**************************************************************************/
  97. BOOL
  98. bGlintRegistrySaveGammaLUT(
  99. PPDEV ppdev,
  100. PVIDEO_CLUT pScreenClut
  101. )
  102. {
  103. ULONG ReturnedDataLength;
  104. if (EngDeviceIoControl(ppdev->hDriver,
  105. IOCTL_VIDEO_REG_SAVE_GAMMA_LUT,
  106. pScreenClut, // input buffer
  107. MAX_CLUT_SIZE,
  108. NULL, // output buffer
  109. 0,
  110. &ReturnedDataLength))
  111. {
  112. DISPDBG((-1, "IOCTL_VIDEO_REG_SAVE_GAMMA_LUT failed"));
  113. return(FALSE);
  114. }
  115. return(TRUE);
  116. }
  117. ULONG
  118. GetOGLDriverVersion(PPDEV ppdev)
  119. {
  120. return(2);
  121. }
  122. #endif
  123. //@@END_DDKSPLIT