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.

89 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1996-1998 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. 04/07/97 -zhanw-
  12. Created it.
  13. --*/
  14. #include "pdev.h" // defined in sub-directory such as DDICMDCB, FONTCB, etc.
  15. DWORD gdwDrvMemPoolTag = 'meoD'; // lib.h requires this global var, for debugging
  16. ////////////////////////////////////////////////////////
  17. // INTERNAL PROTOTYPES
  18. ////////////////////////////////////////////////////////
  19. BOOL APIENTRY OEMGetInfo(DWORD dwInfo, PVOID pBuffer, DWORD cbSize, PDWORD pcbNeeded)
  20. {
  21. LPCSTR OEM_INFO[] = { "Bad Index",
  22. "OEMGI_GETSIGNATURE",
  23. "OEMGI_GETINTERFACEVERSION",
  24. "OEMGI_GETVERSION",
  25. };
  26. VERBOSE((DLLTEXT("OEMGetInfo(%s) entry.\n"), OEM_INFO[dwInfo]));
  27. // Validate parameters.
  28. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  29. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  30. (OEMGI_GETVERSION != dwInfo) ) ||
  31. (NULL == pcbNeeded)
  32. )
  33. {
  34. ERR(("OEMGetInfo() ERROR_INVALID_PARAMETER.\r\n"));
  35. // Did not write any bytes.
  36. if(NULL != pcbNeeded)
  37. *pcbNeeded = 0;
  38. return FALSE;
  39. }
  40. // Need/wrote 4 bytes.
  41. *pcbNeeded = 4;
  42. // Validate buffer size. Minimum size is four bytes.
  43. if( (NULL == pBuffer) || (4 > cbSize) )
  44. {
  45. ERR(("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\r\n"));
  46. return FALSE;
  47. }
  48. // Write information to buffer.
  49. switch(dwInfo)
  50. {
  51. case OEMGI_GETSIGNATURE:
  52. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  53. break;
  54. case OEMGI_GETINTERFACEVERSION:
  55. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  56. break;
  57. case OEMGI_GETVERSION:
  58. *(LPDWORD)pBuffer = OEM_VERSION;
  59. break;
  60. }
  61. return TRUE;
  62. }