Jdmundrawala/windows env path

Fixes issues: 
https://github.com/opscode/chef/issues/2016 
https://github.com/opscode/chef/issues/2009

Includes changes from/Should replace:
https://github.com/opscode/chef/pull/1876
This uses the windows api instead of find/replace and I've added functional tests
http://blogs.msdn.com/b/oldnewthing/archive/2010/02/03/9957320.aspx

It's not clear why this person hit the 2k limit.

On Thu, Sep 11, 2014 at 2:51 PM, lamont-granquist <notifications@github.com>
wrote:

> In lib/chef/mixin/windows_env_helper.rb:
>
> > +
> > +      #see: http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx
> > +      HWND_BROADCAST = 0xffff
> > +      WM_SETTINGCHANGE = 0x001A
> > +      SMTO_BLOCK = 0x0001
> > +      SMTO_ABORTIFHUNG = 0x0002
> > +      SMTO_NOTIMEOUTIFNOTHUNG = 0x0008
> > +
> > +      def broadcast_env_change
> > +        flags = SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG
> > +        SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string('Environment').address, flags, 5000, nil)
> > +      end
> > +
> > +      def expand_path(path)
> > +        # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724265%28v=vs.85%29.aspx
> > +        # Max size of env block on windows is 32k
>
> isn't max size of the PATH env variable 2k? ie.
> http://brucebcampbell.wordpress.com/2014/04/13/path-environment-variable-max-size-limit-and-related-ills-on-windows-7/
>
> i haven't been able to dig up real windows documentation on this since
> most google results are for the 256-ish MAX_PATH issue...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/opscode/chef/pull/2024/files#r17451710>.
>