2

settings location settings window

I'm trying to automate the setup of printer settings, are settings stored to a standard location? The preference window is just a proprietary driver window

I'm aware of some of the registry values stored here : Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\HP DeskJet 2600 series

Are some settings stored somewhere else? using just those doesn't seem to work

Axeltherabbit
  • 123
  • 1
  • 6
  • They are probably stored on the printer itself. – DavidPostill Mar 10 '23 at 16:18
  • I think so, yes. Some are also stored in the App as well (Windows Edge and Office Apps) – John Mar 10 '23 at 16:25
  • Yeah but you can setup default trays, margins, etc.. via that window, I'm trying to automate this process, I know some App can setup some of those things themself but that's not what I'm trying to do now – Axeltherabbit Mar 10 '23 at 16:31
  • 1
    On this PC, I see some settings at `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\PrinterMigrationEx\\DsDriver`, such as paper size supported, though these might be added when driver was installed. BTW, since some settings are visible even with printer offline, you know at least *those settings* are stored on the PC. – DrMoishe Pippik Mar 10 '23 at 17:10

3 Answers3

2

There is not one answer for this question, and answers may potentially differ for each printer and each driver.

Many parameters are stored in the registry, but some may be stored by the driver software on disk and some in non-volatile memory on the printer.

Even in the registry, in addition to items that are user-readable, the printer software usually stores the printer's DEVMODE structure. This is a very comprehensive binary structure that is intended to be used by C/C++ programs.

There are also two copies of DEVMODE - one for the default and one for each user. The user's is stored under the HKEY_CURRENT_USER registry key, while the default is stored in HKEY_LOCAL_MACHINE and requires administrator permissions to modify.

Finding out all the the places where printer settings could be stored, would probably entail tracing the printer's installation and settings dialogs, and will be a hard project.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • 1
    But as you point out, it depends on whoever authored the drivers. My printer drivers had so many settings that weren't accounted for in the DEVMODE so I used my own structure in the windows registry. It was up to me where I put them and how I stored them. I believe when HP went to India, they started using a funky sqlite file to store them. – Señor CMasMas Mar 10 '23 at 21:54
  • @SeñorCMasMas: None-related question : Which company did you write drivers for? – harrymc Mar 11 '23 at 11:20
  • Thanks for your reply, I suspected it can't really work for any printer but I'm happy to partially have it working with the registry, are there any other location other than `Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers` that I should look for? Thanks – Axeltherabbit Mar 11 '23 at 17:40
  • A quick search on my computer found `HKEY_CURRENT_USER\Printers`, also `HKEY_USERS` and specifically `HKEY_USERS\.DEFAULT\Printers`, also `HKEY_CLASSES_ROOT\Printers`. That's surely not a complete list. – harrymc Mar 11 '23 at 19:05
  • 2
    A useful tool to analyze what do an installation or printer settings dialog will be [RegistryChangesView](https://www.nirsoft.net/utils/registry_changes_view.html). – harrymc Mar 11 '23 at 19:09
  • 1
    @harrymc , Rena GmbH, Neopost, Astro Machine Corp, Pitney Bowes, Satori, and a number of other brands working from the same hardware. 180+ of them. mostly PCL5/6. The printer divisions from almost all of those companies have been sold (nobody wants paper anymore). – Señor CMasMas Mar 11 '23 at 19:52
1

HP has a "HP Device Configuration Utility" shown here

enter image description here

and

enter image description here

You open the CFG file found in the driver folder that you downloaded from hp.

Then it presents you with all of these options.

They only question is does it support your printer. If it does then whenever you install said printer it will automatically have these settings.

cybernard
  • 13,380
  • 3
  • 29
  • 33
0

I actually found a way to do that easily,

  • to extract:

    rundll32 printui.dll,PrintUIEntry /Ss /n "PRINTERNAMEHERE" /a File.dat d g

  • to restore:

    rundll32 printui.dll,PrintUIEntry /Sr /n "PRINTERNAMEHERE" /a File.dat u

As other mentioned this might still not work for some printers/drivers but simplifies the job of actually having to figure out where things are

Axeltherabbit
  • 123
  • 1
  • 6