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.

88 lines
1.8 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/14-takashim
  12. // 04/07/97 -zhanw-
  13. // Created it.
  14. --*/
  15. #include "pdev.h"
  16. #include <strsafe.h>
  17. BOOL APIENTRY
  18. OEMGetInfo(
  19. DWORD dwInfo,
  20. PVOID pBuffer,
  21. DWORD cbSize,
  22. PDWORD pcbNeeded)
  23. {
  24. LPCSTR OEM_INFO[] = { "Bad Index",
  25. "OEMGI_GETSIGNATURE",
  26. "OEMGI_GETINTERFACEVERSION",
  27. "OEMGI_GETVERSION",
  28. };
  29. VERBOSE(("OEMGetInfo(%s) entry.\n", OEM_INFO[dwInfo]));
  30. // Validate parameters.
  31. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  32. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  33. (OEMGI_GETVERSION != dwInfo) ) ||
  34. (NULL == pcbNeeded)
  35. )
  36. {
  37. WARNING(("OEMGetInfo() ERROR_INVALID_PARAMETER.\n"));
  38. // Did not write any bytes.
  39. if(NULL != pcbNeeded)
  40. *pcbNeeded = 0;
  41. return FALSE;
  42. }
  43. // Need/wrote DWORD bytes.
  44. *pcbNeeded = sizeof(DWORD);
  45. // Validate buffer size. Minimum size is four bytes.
  46. if( (NULL == pBuffer) || (sizeof(DWORD) > cbSize) )
  47. {
  48. WARNING(("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\n"));
  49. return FALSE;
  50. }
  51. // Write information to buffer.
  52. switch(dwInfo)
  53. {
  54. case OEMGI_GETSIGNATURE:
  55. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  56. break;
  57. case OEMGI_GETINTERFACEVERSION:
  58. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  59. break;
  60. case OEMGI_GETVERSION:
  61. *(LPDWORD)pBuffer = OEM_VERSION;
  62. break;
  63. }
  64. return TRUE;
  65. }