Source code of Windows XP (NT5)
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.

117 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1990 - 1995 Microsoft Corporation
  3. Module Name:
  4. gdi.c
  5. Abstract:
  6. This module provides all the public exported APIs relating to Printer
  7. and Job management for the Local Print Providor
  8. Author:
  9. Dave Snipp (DaveSn) 15-Mar-1991
  10. Revision History:
  11. --*/
  12. #define NOMINMAX
  13. #include <precomp.h>
  14. #include "wingdip.h"
  15. HANDLE
  16. LocalCreatePrinterIC(
  17. HANDLE hPrinter,
  18. LPDEVMODE pDevMode
  19. )
  20. {
  21. PSPOOL pSpool = (PSPOOL)hPrinter;
  22. PSPOOLIC pSpoolIC;
  23. if (!ValidateSpoolHandle(pSpool, PRINTER_HANDLE_SERVER )) {
  24. return NULL;
  25. }
  26. pSpoolIC = (PSPOOLIC)AllocSplMem( sizeof( SPOOLIC ));
  27. if( !pSpoolIC ){
  28. return NULL;
  29. }
  30. pSpoolIC->signature = IC_SIGNATURE;
  31. pSpoolIC->pIniPrinter = pSpool->pIniPrinter;
  32. ++pSpoolIC->pIniPrinter->cRefIC;
  33. return (HANDLE)pSpoolIC;
  34. }
  35. BOOL
  36. LocalPlayGdiScriptOnPrinterIC(
  37. HANDLE hPrinterIC,
  38. LPBYTE pIn,
  39. DWORD cIn,
  40. LPBYTE pOut,
  41. DWORD cOut,
  42. DWORD ul
  43. )
  44. {
  45. INT nBufferSize,iRet;
  46. PUNIVERSAL_FONT_ID pufi;
  47. LARGE_INTEGER TimeStamp;
  48. if( cOut == sizeof(INT) )
  49. {
  50. pufi = NULL;
  51. nBufferSize = 0;
  52. }
  53. else
  54. {
  55. pufi = (PUNIVERSAL_FONT_ID) (pOut + sizeof(INT));
  56. nBufferSize = (cOut - sizeof(INT)) / sizeof(UNIVERSAL_FONT_ID);
  57. }
  58. iRet = GdiQueryFonts( pufi, nBufferSize, &TimeStamp );
  59. if( iRet < 0 )
  60. {
  61. if (GetLastError() == ERROR_SUCCESS) {
  62. // Set a generic last error for GDI
  63. SetLastError(ERROR_NOT_ENOUGH_MEMORY);
  64. }
  65. return FALSE;
  66. }
  67. else
  68. {
  69. *((INT*)pOut) = iRet;
  70. return TRUE;
  71. }
  72. }
  73. BOOL
  74. LocalDeletePrinterIC(
  75. HANDLE hPrinterIC
  76. )
  77. {
  78. PSPOOLIC pSpoolIC = (PSPOOLIC)hPrinterIC;
  79. if( !pSpoolIC || pSpoolIC->signature != IC_SIGNATURE ){
  80. SetLastError( ERROR_INVALID_HANDLE );
  81. DBGMSG( DBG_WARN,
  82. ( "LocalDeletePrinterIC: Invalid handle value %x\n",
  83. hPrinterIC ));
  84. return FALSE;
  85. }
  86. --pSpoolIC->pIniPrinter->cRefIC;
  87. FreeSplMem( pSpoolIC );
  88. return TRUE;
  89. }