in reply to Re^3: how do you propagate Tie::Registry modifications to the system environment (UtS,L)
in thread how do you propagate Tie::Registry modifications to the system environment

My problem is it is not just me. I have several hundred people in multiple states and countries using the code. Randomly we have a machine that hangs and then the user install will fail.

I was hoping that this problem may have been seen and understood some time in the past.

What we don't understand is why the "setx" command will always work when the Broadcast() fails. There must be something Microsoft does with "setx" that is different then the module. My hope would be that this could be figured out and fixed so others don't have problems.

We have found some talk about Google Desktop and a service called NMIndexingService (part Nero software) being culprits in this hang.

  • Comment on Re^4: how do you propagate Tie::Registry modifications to the system environment (UtS,L)

Replies are listed 'Best First'.
Re^5: how do you propagate Tie::Registry modifications to the system environment (UtS,L)
by tye (Sage) on Aug 16, 2010 at 21:38 UTC

    So you still haven't glanced at the code?

    It contains a comment noting a wish to use a slightly different call that includes a time-out.

    - tye        

      I needed this particular thing myself today so I threw together a version that seems to work and should include a time-out:

      use Win32::API qw< >; { use constant HWND_BROADCAST => 0xffff; use constant WM_SETTINGCHANGE => 0x001A; use constant SMTO_ABORTIFHUNG => 2; my $send; sub BroadcastEnv { $send ||= Win32::API->new( 'user32', 'SendMessageTimeout', 'LLLPLLL', 'L', # hWnd, msg, wParam, lParam, flags, msTimeout, pLResults ) or die "Can't load SendMessageTimeout(): $^E\n"; $send->Call( HWND_BROADCAST(), WM_SETTINGCHANGE(), 0, "Environment", SMTO_ABORTIFHUNG(), 5000, 0, # unpack 'L', pack 'P', my $res= ' 'x8; ); } }

      - tye