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.

152 lines
3.8 KiB

  1. ///////////////////////////////////////////////////
  2. // fuxldm.c
  3. //
  4. // September.3,1997 H.Ishida (FPL)
  5. //
  6. // COPYRIGHT(C) FUJITSU LIMITED 1997
  7. #include "fuxl.h"
  8. #include "fudebug.h"
  9. // MINI5 Export func.
  10. BOOL APIENTRY OEMGetInfo(DWORD dwInfo, PVOID pBuffer, DWORD cbSize, PDWORD pcbNeeded)
  11. {
  12. TRACEOUT(("[OEMGetInfo]\r\n"))
  13. if(pcbNeeded == NULL){
  14. SetLastError(ERROR_INVALID_PARAMETER);
  15. return FALSE;
  16. }
  17. *pcbNeeded = sizeof(DWORD);
  18. if(NULL == pBuffer || sizeof(DWORD) > cbSize){
  19. SetLastError(ERROR_INSUFFICIENT_BUFFER);
  20. return FALSE;
  21. }
  22. switch(dwInfo){
  23. case OEMGI_GETSIGNATURE:
  24. TRACEOUT(("OEMGI_GETSIGNATURE\r\n"))
  25. *(LPDWORD)pBuffer = FUXL_OEM_SIGNATURE;
  26. break;
  27. case OEMGI_GETINTERFACEVERSION:
  28. TRACEOUT(("OEMGI_GETINTERFACEVERSION\r\n"))
  29. *(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
  30. break;
  31. case OEMGI_GETVERSION:
  32. TRACEOUT(("OEMGI_GETVERSION\r\n"))
  33. *(LPDWORD)pBuffer = FUXL_OEM_VERSION;
  34. break;
  35. default:
  36. TRACEOUT(("invalid dwInfo\r\n"))
  37. SetLastError(ERROR_INVALID_PARAMETER);
  38. return FALSE;
  39. }
  40. return TRUE;
  41. }
  42. static BOOL BIsValidOEMDevModeParam(DWORD dwMode, POEMDMPARAM pOEMDevModeParam)
  43. {
  44. if(NULL == pOEMDevModeParam){
  45. TRACEOUT(("pOEMDevModeParam is NULL\r\n"))
  46. return FALSE;
  47. }
  48. if(sizeof(OEMDMPARAM) > pOEMDevModeParam->cbSize){
  49. TRACEOUT(("pOEMDevModeParam->cbSize (%d) is less than sizeof(OEMDMPARAM)\r\n", pOEMDevModeParam->cbSize))
  50. return FALSE;
  51. }
  52. if(NULL == pOEMDevModeParam->hPrinter){
  53. TRACEOUT(("pOEMDevModeParam->hPrinter is NULL\r\n"))
  54. return FALSE;
  55. }
  56. if(NULL == pOEMDevModeParam->hModule){
  57. TRACEOUT(("pOEMDevModeParam->hModule is NULL\r\n"))
  58. return FALSE;
  59. }
  60. if((0 != pOEMDevModeParam->cbBufSize) && (NULL == pOEMDevModeParam->pOEMDMOut)){
  61. TRACEOUT(("pOEMDevModeParam->cbBufSize is not 0, and, pOEMDMOut is NULL\r\n"))
  62. return FALSE;
  63. }
  64. if((OEMDM_MERGE == dwMode) && (NULL == pOEMDevModeParam->pOEMDMIn)){
  65. TRACEOUT(("dwMode is OEMDM_MERGE && pOEMDMIn is NULL\r\n"))
  66. return FALSE;
  67. }
  68. return TRUE;
  69. }
  70. static void fuxlInitOEMExtraData(PFUXL_OEM_EXTRADATA pFuxlOEMExtra)
  71. {
  72. pFuxlOEMExtra->dmExtraHdr.dwSize = sizeof(FUXL_OEM_EXTRADATA);
  73. pFuxlOEMExtra->dmExtraHdr.dwSignature = FUXL_OEM_SIGNATURE;
  74. pFuxlOEMExtra->dmExtraHdr.dwVersion = FUXL_OEM_VERSION;
  75. }
  76. static void fuxlMergeOEMExtraData(
  77. PFUXL_OEM_EXTRADATA pFuxlOEMExtraIn,
  78. PFUXL_OEM_EXTRADATA pFuxlOEMExtraOut)
  79. {
  80. }
  81. // MINI5 Export func.
  82. BOOL APIENTRY OEMDevMode(DWORD dwMode, POEMDMPARAM pOEMDevModeParam)
  83. {
  84. TRACEOUT(("[OEMDevMode]\r\n"))
  85. if(BIsValidOEMDevModeParam(dwMode, pOEMDevModeParam) == FALSE){
  86. TRACEOUT(("invalid OEMDevModeParam\r\n"))
  87. SetLastError(ERROR_INVALID_PARAMETER);
  88. return FALSE;
  89. }
  90. if(dwMode == OEMDM_SIZE){
  91. pOEMDevModeParam->cbBufSize = sizeof(FUXL_OEM_EXTRADATA);
  92. TRACEOUT(("OEMDM_SIZE %d\r\n", pOEMDevModeParam->cbBufSize))
  93. return TRUE;
  94. }
  95. if(sizeof(FUXL_OEM_EXTRADATA) > pOEMDevModeParam->cbBufSize){
  96. TRACEOUT(("cbBufSize %d\r\n", pOEMDevModeParam->cbBufSize))
  97. SetLastError(ERROR_INSUFFICIENT_BUFFER);
  98. return FALSE;
  99. }
  100. switch(dwMode){
  101. case OEMDM_DEFAULT:
  102. TRACEOUT(("OEMDM_DEFAULT\r\n"));
  103. fuxlInitOEMExtraData((PFUXL_OEM_EXTRADATA)pOEMDevModeParam->pOEMDMOut);
  104. break;
  105. case OEMDM_CONVERT:
  106. TRACEOUT(("OEMDM_CONVERT\r\n"));
  107. fuxlInitOEMExtraData((PFUXL_OEM_EXTRADATA)pOEMDevModeParam->pOEMDMOut);
  108. break;
  109. case OEMDM_MERGE:
  110. TRACEOUT(("OEMDM_MERGE\r\n"));
  111. fuxlMergeOEMExtraData((PFUXL_OEM_EXTRADATA)pOEMDevModeParam->pOEMDMIn,
  112. (PFUXL_OEM_EXTRADATA)pOEMDevModeParam->pOEMDMOut);
  113. break;
  114. default:
  115. TRACEOUT(("invalid dwMode\r\n"));
  116. SetLastError(ERROR_INVALID_PARAMETER);
  117. return FALSE;
  118. break;
  119. }
  120. return TRUE;
  121. }
  122. // end of fuxldm.c