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.

111 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. Module Name:
  4. upgrade.c
  5. Abstract:
  6. This module contains upgrade functions
  7. Author:
  8. 09-Feb-1996 Fri 12:37:01 created
  9. [Environment:]
  10. Windows 2000, Windows XP and Windows Server 2003 - Common Printer Driver UI DLL
  11. [Notes:]
  12. Revision History:
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. #define DBG_PLOTFILENAME DbgUpgrade
  17. extern HMODULE hPlotUIModule;
  18. #define DBG_UPGRADE 0x00000001
  19. DEFINE_DBGVAR(0);
  20. BOOL
  21. DrvUpgradePrinter(
  22. DWORD Level,
  23. LPBYTE pDriverUpgradeInfo
  24. )
  25. /*++
  26. Routine Description:
  27. Arguments:
  28. Return Value:
  29. Author:
  30. 09-Feb-1996 Fri 12:37:46 created
  31. Revision History:
  32. --*/
  33. {
  34. PDRIVER_UPGRADE_INFO_1 pDUI1;
  35. HANDLE hPrinter;
  36. PRINTER_DEFAULTS PrinterDef = { NULL, NULL, PRINTER_ALL_ACCESS };
  37. BOOL Ok = FALSE;
  38. if ((Level == 1) &&
  39. (pDUI1 = (PDRIVER_UPGRADE_INFO_1)pDriverUpgradeInfo) &&
  40. (OpenPrinter(pDUI1->pPrinterName, &hPrinter, &PrinterDef))) {
  41. PPRINTERINFO pPI;
  42. if (pPI = MapPrinter(hPrinter, NULL, NULL, MPF_DEVICEDATA)) {
  43. Ok = AddFormsToDataBase(pPI, TRUE);
  44. UnMapPrinter(pPI);
  45. }
  46. ClosePrinter(hPrinter);
  47. } else {
  48. PLOTERR(("DrvConvertDevMode: OpenPrinter(%ws) failed.",
  49. pDUI1->pPrinterName));
  50. SetLastError(ERROR_INVALID_DATA);
  51. }
  52. return(Ok);
  53. }