ansicon icon indicating copy to clipboard operation
ansicon copied to clipboard

All x86 processes in x64 cmd.exe crash when ansicon is loaded (Win 8.1)

Open rahul-ramadas opened this issue 12 years ago • 28 comments

I'm trying this on Win 8.1 Preview. I don't know if it reproes on earlier OSes.

Steps:

  1. Start a x64 cmd.exe (the default when you just run cmd.exe on a 64-bit Windows).
  2. Run ansicon.exe -p (the x64 version)
  3. Now try running any x86 console process from within the cmd.exe.

The new process will crash.

rahul-ramadas avatar Aug 09 '13 16:08 rahul-ramadas

Are you using NVIDIA perchance? Try set ANSICON_EXC=nvd3d9wrap.dll;nvd3d9wrapx.dll and see if that helps.

adoxa avatar Aug 14 '13 15:08 adoxa

I do have nVidia, and AMD as well if that matters. I tried setting that variable before calling "ansicon -p"; no effect.

Are those DLLs typically specified in the AppInit_DLLs registry value? A while back I had uninstalled nVidia 3D vision and those DLLs from my system, so I no longer have them.

rahul-ramadas avatar Aug 14 '13 16:08 rahul-ramadas

Could you try v1.53? If that works, I might have to stick with ANSI-LLW after all... Oh, could you give me the crash offset, too? (I also tried the 64-bit Win8 preview repair disc, but it doesn't support 32-bit at all).

adoxa avatar Aug 15 '13 08:08 adoxa

I had tried that version as well. There seems to be some other problem with that version that I can't pinpoint. In my build environment I have a whole bunch of batch scripts, and some of them just mysteriously start to fail with very bizzare errors:

" 'set' is not recognized as an internal or external command, operable program or batch file. "

I don't know where in the script this error is coming from.

As for the offset, that seems to change everytime, so I'm not sure how that is going to help. The issue is that it is calling into an invalid location.

To repro the issue:

  1. Install 64-bit Win 8.1 preview
  2. Run cmd.exe (this will start 64-bit cmd.exe)
  3. Run ansicon.exe -p (the 64-bit version)
  4. cd C:\Windows\SysWoW64
  5. This location has 32-bit executables. Run something, eg: fc.exe

On Thu, Aug 15, 2013 at 1:30 AM, Jason Hood [email protected]:

Could you try v1.53https://github.com/downloads/adoxa/ansicon/ansi153.zip? If that works, I might have to stick with ANSI-LLW after all... Oh, could you give me the crash offset, too? (I also tried the 64-bit Win8 preview repair disc, but it doesn't support 32-bit at all).

— Reply to this email directly or view it on GitHubhttps://github.com/adoxa/ansicon/issues/61#issuecomment-22690970 .

rahul-ramadas avatar Aug 15 '13 16:08 rahul-ramadas

The only reason I mentioned 1.53 is because it used ANSI-LLW.exe and was still available in the downloads.

I don't currently have the bandwidth to download 3.8 gig, but I may not have to, as I've found a bug. I've uploaded a new ANSI64.dll to my SkyDrive. It also adds a couple of extra log entries, to check the entry point (a potential problem, but probably not, now). Here's how it looks on my 7 system (from just x64\ansicon -l1 and using x86\ansicon --version as the test):

ANSICON (64-bit) v1.64 log (1) started 2013-08-16 12:47:14
ansicon (5556): C:\Windows\system32\cmd.exe (1860)
ansicon (5556):   64-bit console (base = 0000000049FE0000)
cmd (1860): hDllInstance = 00000000AC000000
cmd (1860): CreateProcessW: (1732) "C:\Projects\git\ansicon\x86\ansicon.exe", "x86\ansicon  --version"
cmd (1860): 32-bit console (base = 00400000)
cmd (1860): Entry point (header) = 004027AF
cmd (1860): Entry point (EAX)    = 004027AF
cmd (1860): LLW32 = 768D492B (1988970795)
ansicon (1732): hDllInstance = 00AC0000
ansicon (1732): Terminating
cmd (1860): Terminating

The problem was the base address used to calculate LLW32 was wrong. The value above should match what you see from ANSI-LLW (echo %errorlevel%). However, this still assumes the address is constant for each boot (which you could check by runnning ANSI-LLW a few times).

adoxa avatar Aug 16 '13 03:08 adoxa

Im getting this problem as well. Windows 8 64 bit with the surface pro. Now none of my command line apps are working. They all freeze. I tried uninstalling it with -u, but is still fails. How do I fix this?

CMCDragonkai avatar Sep 03 '13 10:09 CMCDragonkai

Use Run (Win+R) to run cmd /d - that will start a new command prompt without ANSICON. Then use reg delete "HKCU\Software\Microsoft\Command Processor" /v AutoRun to do it permanently.

adoxa avatar Sep 04 '13 07:09 adoxa

I've released v1.65, deleting the files on SkyDrive.

adoxa avatar Sep 04 '13 09:09 adoxa

I've installed the new ANSI165 on Windows 7, it works on CMD, but not on Console2, any ideas why?

---EDIT---

I added the x64 to the PATH and it started working. However it now stops me from scrolling inside the terminal.

CMCDragonkai avatar Sep 14 '13 11:09 CMCDragonkai

Console2 is a GUI process, so ANSICON will not hook it and thus nothing Console2 starts will be hooked (except CMD.EXE if you use -i). You can start Console2 directly via ANSICON (i.e. prefix your Console2 shortcut with ansicon) to override the GUI detection (or if you happen to start Console2 from within a shell, use set ANSICON_GUI=console.exe to do it automatically).

Scrolling worked fine for me. Are you sure you actually have a scrollable buffer (View|Console Window to verify).

adoxa avatar Sep 14 '13 13:09 adoxa

It crashes for me as well... no luck with any of the solutions above (Windows 7 64bits with NVIDIA

raulriera avatar Dec 05 '13 09:12 raulriera

Just to make sure we're still talking about the same thing, can you try this in a new Command Prompt (since it's not working, I'm assuming it's not already installed):

rem go to the 64-bit binaries
cd whatever\x64
rem exclude the known problem DLLs - perhaps there are later versions of these as well?
set ANSICON_EXC=nvd3d9wrap.dll;nvd3d9wrapx.dll
rem start a new cmd with a logging ansicon
ansicon -l3
rem start a 32-bit cmd
%systemroot%\syswow64\cmd
rem now it crashes?

Post %temp%\ansicon.log and we'll see if we can see what's going on.

adoxa avatar Dec 18 '13 03:12 adoxa

I was having lots of issues with ansicon.exe crashing in Console2 on Windows 8.1 whenever I'd preface another shell with it. I finally realized I had the 32-bit version of Console2 (2.00b148-Beta_32bit) installed and was using the x64 ansicon files.

btm avatar Feb 24 '14 19:02 btm

The only way i can get Ansicon to work on Windows 8.1 is to create a shortcut with C:\ansi160\x86\ansicon.exe %ComSpec% target to the x86 version.

rarepixel-studio avatar Jun 11 '14 09:06 rarepixel-studio

I can't seem to get it to work period. Just keeps crashing upon startup. It prevents any shell or command prompt window from executing anything until I do

ansicon -u

It just crashes.

EvanHerman avatar Jun 12 '14 15:06 EvanHerman

Could you try the steps in the December comment with the preliminary 1.70?

adoxa avatar Jun 13 '14 10:06 adoxa

I think I know what the issue is. When I got home last night I was able to set everything up without much hiccup on my windows 7 machine. I think it has to do with an anti-virus program I was running.

One question I do have for you, where I can get a fresh copy of the x64/x86 folder and files? They seem to have been added to the .gitignore list and all previous tags I'm checking don't have them attached.

EvanHerman avatar Jun 13 '14 14:06 EvanHerman

Yea, it was my antivirus that was quarantining the .exe file inside of the x64 folder. After setting my antivirus to exclude that folder, things work. The color coding seems to work in Shell for me, but not in Powershell of the standard command prompt. But very glad I got things working now.

Thanks!

EvanHerman avatar Jun 13 '14 15:06 EvanHerman

The binaries (all that's in the x86/x64 directories) are under releases here or on my site.

On 7, it seems to be mscorwks.dll that controls Powershell output (at least excluding it stops ANSICON working), so do a full log (ansicon -l7 powershell) and see if it gets hooked.

adoxa avatar Jun 14 '14 14:06 adoxa

Adoxa, holy hell. I appreciate your efforts, I've spent the entire day pulling my hair out trying to get Ansicon to work. I finally went to https://onedrive.live.com/?cid=0D18DE9C2F9D17ED&id=D18DE9C2F9D17ED!111 --- tried my installation again, and now it works! Thought I'd share.

gomhon avatar Jul 26 '14 22:07 gomhon

@gomhon Tanks sooo much! i was pulling my hair out trying to get this to work. I read all the articles and all the problems related to ANSICON colorizing.

No idea why this is happening in V1.66, but I think they should release this as soon as possible as it costed me 3 hours of googling, before I found this post. and exploring in different shells (cmd problem issue related? but tuts are for cmd , thinking ) This resolved the colorizer issue for me.

cablegunmaster avatar Oct 09 '14 10:10 cablegunmaster

I ran into this issue on Windows 7 x64, with ansicon v1.66 installed in c:\ansicon and added to the system environment PATH variable, and running "C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe" from a post build event in a Visual Studio 2013 project.

Unhandled exception at 0x3F9313DF (wshext.dll) in signtool.exe: 0xC0000005: Access violation executing location 0x3F9313DF.

(C:\Windows\SysWOW64\wshext.dll)

After uninstalling ansicon, things started to work as expected.

icnocop avatar Oct 11 '14 20:10 icnocop

FWIW, I also noticed that my Team Foundation Server shell context (windows explorer right-click) menu (TFS Power Tools 2010) stopped working after installing ansicon v1.66.

I still haven't test with the newer (preliminary) version (v1.70) previously linked in this thread.

Thank you.

icnocop avatar Oct 13 '14 18:10 icnocop

I might have run into the same issue. After installing ANSICON 1.66 on WIndows 8.1 x64, NuGet command line started to crash on launch. I had to uninstall ANSICON.

DKroot avatar Jul 13 '16 17:07 DKroot

Using described previous version solves mine, win10 x64

feber avatar Aug 22 '16 08:08 feber

You can stop it running when under 32 bit by changing the autorun to (IF NOT "%PROCESSOR_ARCHITECTURE%"=="x86" if %ANSICON_VER%==^%ANSICON_VER^% "C:\Cucumber\ANSI160\x64\ansicon" -p)

Change the path to point to your location

Bluesman74 avatar Mar 20 '17 19:03 Bluesman74

same issue with v1.84 on windows server 2008 R2 on 64bit

Piioo avatar Jun 18 '18 09:06 Piioo

I'm going to need more information, as it seems to work fine with 8.1 and 10 (using 32-bit cmd.exe and VS2010 signtool).

adoxa avatar Jun 20 '18 00:06 adoxa