ansicon icon indicating copy to clipboard operation
ansicon copied to clipboard

ANSICON potentially interferes with Composer installation

Open CJDennis opened this issue 8 years ago • 8 comments

The developers of Composer think that ANSICON interferes with its installation by returning an exit code of 1.

https://github.com/composer/windows-setup/issues/74

I have no idea if this is the case or not, but if it is, it would be good to fix it.

CJDennis avatar Oct 26 '17 10:10 CJDennis

I was not able to replicate it (ANSICON 1.66, Composer-Setup 4.7.0).

adoxa avatar Oct 27 '17 06:10 adoxa

@adoxa Me neither, for the few times it has come up.

However if ANSICON is located in a system directory, as per https://github.com/composer/windows-setup/issues/80#issuecomment-339877955, then bingo!

I'll handle it better in the next release, as per this beta:

https://s3-eu-west-1.amazonaws.com/johnstevenson/composer/Composer-Setup.4.7.1.exe

johnstevenson avatar Oct 27 '17 11:10 johnstevenson

Ah, I was supposed to make a note not to install in the system directory, because things like this happen (you would need to install to SysWOW64 as well to avoid it). Still, I renamed the path where I had it installed so it wouldn't be found and it still worked.

adoxa avatar Oct 27 '17 11:10 adoxa

This only seems to be a problem (at least on Windows 64-bit) if it is installed in C:\Windows\System32 and it is a per-user installation ansicon -i (because HKCU Software keys are shared, not redirected).

For an ansicon -I installation, writing to HKLM, then ansicon is not invoked (because Composer-Setup.exe is a 32-bit application, calling the 32-bit cmd.exe which reads from HKLM\Software\WOW6432Node).

How come ansicon works fine (ie doesn't return exit code 1) from SysWOW64 but not from System32?

johnstevenson avatar Oct 27 '17 12:10 johnstevenson

Because a 32-bit process redirects System32 to SysWOW64, where ANSICON doesn't exist (at least, that's what I expect is happening).

adoxa avatar Oct 27 '17 12:10 adoxa

But if you specifically put it in SysWOW64 then it gets invoked:

C:\Windows\SysWOW64\cmd.exe loads C:\Windows\SysWOW64\ansicon\x64\ANSI32.dll and the correct exit code is returned.

johnstevenson avatar Oct 27 '17 12:10 johnstevenson

Well, yeah, why wouldn't it? The real question is why it seems to partially fail when it's only in System32 - perhaps there's some weird interaction, so it does load System32\ansicon.exe, but that's looking for SysWOW64\ANSI32.dll, not finding it and that's where the exit code of 1 comes from. Anyway, the next release will tell people not to install in System32, so that's that (yeah, right :smirk:).

adoxa avatar Oct 27 '17 13:10 adoxa

Cool. If it is a known bug/limitation, then fair enough. I've updated the error info for the next release:

A setting in your registry could be causing the problem. Check this value and remove it if necessary:

HKCU\Software\Microsoft\Command Processor\AutoRun = (if %ANSICON_VER%==^%ANSICON_VER^% "C:\Windows\System32\ANSICON\x64\ansicon" -p)

Note: ANSICON should not be installed in the system directory.

Thanks for you help.

johnstevenson avatar Oct 27 '17 14:10 johnstevenson