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.

39 lines
1.2 KiB

  1. #include "shellprv.h"
  2. #pragma hdrstop
  3. #include "printer.h"
  4. // PRINTUI.DLL calls this export to load shell exts registered for this printer
  5. STDAPI_(void) Printer_AddPrinterPropPages(LPCTSTR pszPrinterName, LPPROPSHEETHEADER lpsh)
  6. {
  7. // Add hooked pages if they exist in the registry
  8. HKEY hkeyBaseProgID = NULL;
  9. RegOpenKey(HKEY_CLASSES_ROOT, c_szPrinters, &hkeyBaseProgID);
  10. if (hkeyBaseProgID)
  11. {
  12. // we need an IDataObject
  13. LPITEMIDLIST pidl;
  14. HRESULT hr = ParsePrinterNameEx(pszPrinterName, &pidl, TRUE, 0, 0);
  15. if (SUCCEEDED(hr))
  16. {
  17. IDataObject *pdtobj;
  18. hr = SHGetUIObjectFromFullPIDL(pidl, NULL, IID_PPV_ARG(IDataObject, &pdtobj));
  19. if (SUCCEEDED(hr))
  20. {
  21. // add the hooked pages
  22. HDCA hdca = DCA_Create();
  23. if (hdca)
  24. {
  25. DCA_AddItemsFromKey(hdca, hkeyBaseProgID, STRREG_SHEX_PROPSHEET);
  26. DCA_AppendClassSheetInfo(hdca, hkeyBaseProgID, lpsh, pdtobj);
  27. DCA_Destroy(hdca);
  28. }
  29. pdtobj->lpVtbl->Release(pdtobj);
  30. }
  31. ILFree(pidl);
  32. }
  33. RegCloseKey(hkeyBaseProgID);
  34. }
  35. }