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.

93 lines
2.2 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. static BOOL BIsValidOEMDevModeParam(DWORD dwMode, POEMDMPARAM pOEMDevModeParam);
  20. static void VDumpOEMDevModeParam(POEMDMPARAM pOEMDevModeParam);
  21. BOOL APIENTRY OEMGetInfo(DWORD dwInfo, PVOID pBuffer, DWORD cbSize, PDWORD pcbNeeded)
  22. {
  23. LPCSTR OEM_INFO[] = { "Bad Index",
  24. "OEMGI_GETSIGNATURE",
  25. "OEMGI_GETINTERFACEVERSION",
  26. "OEMGI_GETVERSION",
  27. };
  28. VERBOSE(("OEMGetInfo(%s) entry.\n", OEM_INFO[dwInfo]));
  29. // Validate parameters.
  30. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  31. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  32. (OEMGI_GETVERSION != dwInfo) ) ||
  33. (NULL == pcbNeeded)
  34. )
  35. {
  36. ERR(("OEMGetInfo() ERROR_INVALID_PARAMETER.\n"));
  37. // Did not write any bytes.
  38. if(NULL != pcbNeeded)
  39. *pcbNeeded = 0;
  40. return FALSE;
  41. }
  42. // Need/wrote 4 bytes.
  43. *pcbNeeded = 4;
  44. // Validate buffer size. Minimum size is four bytes.
  45. if( (NULL == pBuffer) || (4 > cbSize) )
  46. {
  47. ERR(("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\n"));
  48. return FALSE;
  49. }
  50. // Write information to buffer.
  51. switch(dwInfo)
  52. {
  53. case OEMGI_GETSIGNATURE:
  54. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  55. break;
  56. case OEMGI_GETINTERFACEVERSION:
  57. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  58. break;
  59. case OEMGI_GETVERSION:
  60. *(LPDWORD)pBuffer = OEM_VERSION;
  61. break;
  62. }
  63. return TRUE;
  64. }