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.

96 lines
2.1 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. // DbgPrint(DLLTEXT("OEMGetInfo(%s) entry.\r\n"), OEM_INFO[dwInfo]);
  23. // Validate parameters.
  24. if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
  25. (OEMGI_GETINTERFACEVERSION != dwInfo) &&
  26. (OEMGI_GETVERSION != dwInfo) ) ||
  27. (NULL == pcbNeeded)
  28. )
  29. {
  30. // DbgPrint(ERRORTEXT("OEMGetInfo() ERROR_INVALID_PARAMETER.\r\n"));
  31. // Did not write any bytes.
  32. if(NULL != pcbNeeded)
  33. *pcbNeeded = 0;
  34. return FALSE;
  35. }
  36. // Need/wrote 4 bytes.
  37. *pcbNeeded = 4;
  38. // Validate buffer size. Minimum size is four bytes.
  39. if( (NULL == pBuffer) || (4 > cbSize) )
  40. {
  41. // DbgPrint(ERRORTEXT("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\r\n"));
  42. return FALSE;
  43. }
  44. // Write information to buffer.
  45. switch(dwInfo)
  46. {
  47. case OEMGI_GETSIGNATURE:
  48. *(LPDWORD)pBuffer = OEM_SIGNATURE;
  49. break;
  50. case OEMGI_GETINTERFACEVERSION:
  51. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  52. break;
  53. case OEMGI_GETVERSION:
  54. *(LPDWORD)pBuffer = OEM_VERSION;
  55. break;
  56. }
  57. return TRUE;
  58. }
  59. //
  60. // Functions for outputting debug messages
  61. //
  62. // VOID DbgPrint(IN LPCTSTR pstrFormat, ...)
  63. // {
  64. // va_list ap;
  65. //
  66. // va_start(ap, pstrFormat);
  67. // EngDebugPrint("", (PCHAR) pstrFormat, ap);
  68. // va_end(ap);
  69. // }