On Fri, 12 Mar 2021 11:29:17 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> Is this only about addition/removal? What about printer name change? 
>> Shouldn't we get notified in that case as trying to print on printer with 
>> old name will not find the printer!!
>> If yes, in that regard I guess REG_NOTIFY_CHANGE_LAST_SET is the one to go 
>> for as it states
>> `"Notify the caller of changes to a value of the key. This can include 
>> adding or deleting a value, or changing an existing value. "`
>
>> Is this only about addition/removal? What about printer name change?
> 
> You cannot change the name of a remote printer.
> 
> Opening *Printer Properties* dialog from the printer context menu on the 
> local host and editing its name changes the name of the printer on the remote 
> host which shares it. Windows warns, “This is a shared printer. If you rename 
> a shared printer, existing connections to this printer from other computers 
> will break and will have to be created again.”
> 
> Nothing has been updated on the local system after renaming the printer. As 
> the warning said, the printer does not work any more because it refers to a 
> printer that does not exist.
> 
> To fix this, one has to add a new remote printer which refers to the new name 
> of the printer on the remote host.
> 
>> Shouldn't we get notified in that case as trying to print on printer with 
>> old name will not find the printer!!
> 
> I'm afraid there's nothing Java can do to mitigate renaming the printer.
> 
>> If yes, in that regard I guess `REG_NOTIFY_CHANGE_LAST_SET` is the one to go 
>> for as it states
>> _"Notify the caller of changes to a value of the key. This can include 
>> adding or deleting a value, or changing an existing value. "_
> 
> Since no values are created, removed, or changed when a remote printer is 
> added or removed under `Connections` key, adding `REG_NOTIFY_CHANGE_LAST_SET` 
> to `dwNotifyFilter` is not required. There are some values stored in the 
> printer key but Java does not use them directly; if any value is changed 
> there, getting notifications about such an event only creates noise.
> 
> So, as far as Java is concerned, getting notifications about new keys being 
> created or removed under `Connections` is enough. This is what 
> `REG_NOTIFY_CHANGE_NAME` filter does.

I can understand that as a user, you cannot /shouldn't change the name of a 
remote network printer but a network admin can change the name, so shouldn't we 
get notification on that name change when this method gets called after the 
name change? or would it be notified as a new printer in that case? Then what 
will happen to the old stale printer in the registry?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2915

Reply via email to