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.

79 lines
1.6 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. 04/07/97 -zhanw-
  12. Created it.
  13. --*/
  14. #include "pdev.h" // defined in sub-directory such as DDICMDCB, FONTCB, etc.
  15. BOOL APIENTRY OEMGetInfo(DWORD dwInfo, PVOID pBuffer, DWORD cbSize, PDWORD pcbNeeded)
  16. {
  17. LPTSTR OEM_INFO[] = { __TEXT("Bad Index"),
  18. __TEXT("OEMGI_GETSIGNATURE"),
  19. __TEXT("OEMGI_GETINTERFACEVERSION"),
  20. __TEXT("OEMGI_GETVERSION"),
  21. };
  22. // Validate parameters.
  23. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  24. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  25. (OEMGI_GETVERSION != dwInfo) ) ||
  26. (NULL == pcbNeeded)
  27. )
  28. {
  29. // Did not write any bytes.
  30. if(NULL != pcbNeeded)
  31. *pcbNeeded = 0;
  32. return FALSE;
  33. }
  34. // Need/wrote 4 bytes.
  35. *pcbNeeded = 4;
  36. // Validate buffer size. Minimum size is four bytes.
  37. if( (NULL == pBuffer) || (4 > cbSize) )
  38. {
  39. return FALSE;
  40. }
  41. // Write information to buffer.
  42. switch(dwInfo)
  43. {
  44. case OEMGI_GETSIGNATURE:
  45. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  46. break;
  47. case OEMGI_GETINTERFACEVERSION:
  48. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  49. break;
  50. case OEMGI_GETVERSION:
  51. *(LPDWORD)pBuffer = OEM_VERSION;
  52. break;
  53. }
  54. return TRUE;
  55. }