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.

94 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. main.c
  5. Abstract:
  6. Implementation of OEMGetInfo and OEMDevMode.
  7. Shared by all Unidrv OEM test dll's.
  8. Environment:
  9. Windows NT Unidrv driver
  10. Revision History:
  11. // NOTICE-2002/3/18-takashim
  12. // 04/07/97 -zhanw-
  13. // Created it.
  14. --*/
  15. #include "pdev.h"
  16. #include <strsafe.h>
  17. DWORD gdwDrvMemPoolTag = 'meoD'; // lib.h requires this global var, for debugging
  18. BOOL APIENTRY
  19. OEMGetInfo(
  20. DWORD dwInfo,
  21. PVOID pBuffer,
  22. DWORD cbSize,
  23. PDWORD pcbNeeded)
  24. {
  25. #if DBG
  26. LPCSTR OEM_INFO[] = { "Bad Index",
  27. "OEMGI_GETSIGNATURE",
  28. "OEMGI_GETINTERFACEVERSION",
  29. "OEMGI_GETVERSION",
  30. };
  31. VERBOSE(("OEMGetInfo(%s) entry.\r\n", OEM_INFO[dwInfo]));
  32. #endif // DBG
  33. // Validate parameters.
  34. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  35. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  36. (OEMGI_GETVERSION != dwInfo) ) ||
  37. (NULL == pcbNeeded)
  38. )
  39. {
  40. DBGPRINT(DBG_WARNING,
  41. (ERRORTEXT("OEMGetInfo() ERROR_INVALID_PARAMETER.\r\n")));
  42. // Did not write any bytes.
  43. if(NULL != pcbNeeded)
  44. *pcbNeeded = 0;
  45. return FALSE;
  46. }
  47. // Need/wrote DWORD bytes.
  48. *pcbNeeded = sizeof(DWORD);
  49. // Validate buffer size. Minimum size is four bytes.
  50. if( (NULL == pBuffer) || (sizeof(DWORD) > cbSize) )
  51. {
  52. DBGPRINT(DBG_WARNING,
  53. (ERRORTEXT("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\r\n")));
  54. return FALSE;
  55. }
  56. // Write information to buffer.
  57. switch(dwInfo)
  58. {
  59. case OEMGI_GETSIGNATURE:
  60. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  61. break;
  62. case OEMGI_GETINTERFACEVERSION:
  63. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  64. break;
  65. case OEMGI_GETVERSION:
  66. *(LPDWORD)pBuffer = OEM_VERSION;
  67. break;
  68. }
  69. return TRUE;
  70. }