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.

144 lines
4.7 KiB

  1. //-----------------------------------------------------------------------------
  2. // This files contains the module name for this mini driver. Each mini driver
  3. // must have a unique module name. The module name is used to obtain the
  4. // module handle of this Mini Driver. The module handle is used by the
  5. // generic library to load in tables from the Mini Driver.
  6. //-----------------------------------------------------------------------------
  7. #define PRINTDRIVER
  8. #include "print.h"
  9. #include "gdidefs.inc"
  10. #include "windows.h"
  11. #include "string.h"
  12. // the following 3 definitions MUST be compatible with the
  13. // HPPCL font installer
  14. //Is this needed for IBMPPDS ?????
  15. #define CLASS_LASERJET 0
  16. #define CLASS_DESKJET 1
  17. #define CLASS_DESKJET_PLUS 2
  18. #define MAXBLOCK 400
  19. char *rgchModuleName = "PPDSCH";
  20. #ifndef WINNT
  21. // typedef for font installer
  22. typedef int (FAR PASCAL *SFPROC)(HANDLE,HWND,LPSTR,LPSTR,LPSTR,int,
  23. BOOL,short);
  24. // Local routines
  25. int FAR PASCAL lstrcopyn(LPSTR, LPSTR, int);
  26. //---------------------------*InstallExtFonts*---------------------------------
  27. // Action: call the specific font installer to add/delete/modify soft fonts
  28. // and/or external cartridges.
  29. //
  30. // Parameters:
  31. // HWND hWnd; handle to the parent windows.
  32. // LPSTR lpDeviceName; long pointer to the printer name.
  33. // LPSTR lpPortName; long pointer to the associated port name.
  34. // BOOL bSoftFonts; flag if supporting soft fonts or not.
  35. //
  36. // Return Value:
  37. // > 0 : if the font information has changed;
  38. // == 0 : if nothing has changed;
  39. // == -1 : if intending to use the universal font installer
  40. // (not available now).
  41. //-------------------------------------------------------------------------
  42. int FAR PASCAL InstallExtFonts(hWnd, lpDeviceName, lpPortName, bSoftFonts)
  43. HWND hWnd;
  44. LPSTR lpDeviceName;
  45. LPSTR lpPortName;
  46. BOOL bSoftFonts;
  47. {
  48. int fsVers, fonttypes;
  49. HANDLE hFIlib, hModule;
  50. SFPROC lpFIns;
  51. static char LocalDeviceName[80];
  52. /*************************************************************/
  53. /* If device is 4019 then font type support is bitmap. */
  54. /* For any other printer (4029, 4037, ...(?)) font type */
  55. /* support is outline. Because of current Unidrv limitation */
  56. /* both bitmap and outline support (value = 3) cannot be */
  57. /* supported by the same printer model. */
  58. /* MFC - 9/8/94 */
  59. /*************************************************************/
  60. LocalDeviceName[0] = '\0';
  61. lstrcopyn((LPSTR)LocalDeviceName, lpDeviceName, 79);
  62. LocalDeviceName[79] = '\0';
  63. if (strstr(LocalDeviceName, "4019") != NULL)
  64. fonttypes = 1; // Bitmap
  65. else
  66. fonttypes = 2; // Outline
  67. if ((hFIlib = LoadLibrary((LPSTR)"SF4029.EXE")) < 32 ||
  68. !(lpFIns = (SFPROC)GetProcAddress(hFIlib,"SoftFontInstall")))
  69. {
  70. if (hFIlib >= 32)
  71. FreeLibrary(hFIlib);
  72. MessageBox(0,
  73. "Can't load SF4029.EXE or can't get SoftFontInstall",
  74. NULL, MB_OK);
  75. return TRUE;
  76. }
  77. hModule = GetModuleHandle((LPSTR)"PPDSCH.DRV");
  78. // FINSTALL.DLL was loaded properly. Now call SoftFontInstall().
  79. // We choose to ignore the returned "fvers". No use of it.
  80. fsVers = (*lpFIns)(hModule, hWnd, lpDeviceName, lpPortName,
  81. (LPSTR)rgchModuleName, fonttypes, (BOOL)0,
  82. (short)0);
  83. FreeLibrary(hFIlib);
  84. return fsVers;
  85. }
  86. //---------------------------*lstrcopyn*---------------------------------
  87. // Action: Copies n characters from one string to another. If the end of
  88. // the source string has been reached before n characters have
  89. // been copied, the the destination string is padded with nulls.
  90. // Returns the number of characters used from the source string.
  91. //
  92. // Parameters:
  93. // LPSTR string1; Destination string;
  94. // LPSTR string2; Source string;
  95. // int n; Number of characters to copy.
  96. //
  97. // Return Value:
  98. // int : Number of characters copied from source string
  99. //-------------------------------------------------------------------------
  100. int FAR PASCAL lstrcopyn(string1, string2, n)
  101. LPSTR string1;
  102. LPSTR string2;
  103. int n;
  104. {
  105. int i = 0;
  106. LPSTR s1, s2;
  107. s1 = string1;
  108. s2 = string2;
  109. while ((*s2) && (n > 0))
  110. {
  111. *s1++ = *s2++;
  112. i++;
  113. n--;
  114. }
  115. while (n > 0)
  116. {
  117. *s1++ = '\0';
  118. n--;
  119. }
  120. return i;
  121. }
  122. #endif // WINNT