72 Commits

Author SHA1 Message Date
Jason Hood
b5e7a01f7f Mention you shouldn't install to System32 2017-10-27 21:28:52 +10:00
Jason Hood
3fb6b5aa65 Fix unloading 2017-10-26 21:46:53 +10:00
Jason Hood
bff5e90eda Add some comments 2017-10-26 12:58:17 +10:00
Jason Hood
40f59c543c Many changes, bad programmer!
Just copying the history from the source:

recognize the standard handle defines in WriteFile;
minor speed improvement by caching GetConsoleMode;
keep track of three handles (ostensibly stdout, stderr and a file);
test a DOS header exists before writing to e_oemid;
more flexible/robust handling of data directories;
files writing to the console will always succeed;
log: use API file functions and a custom printf;
     add a blank line between processes;
     set function name for MyWriteConsoleA;
scan imports from "kernel32" (without extension);
added dynamic environment variable CLICOLOR;
removed _hwrite (it's the same address as _lwrite);
join multibyte characters split across separate writes;
remove wcstok, avoiding potential interference with the host;
similarly, use a private heap instead of malloc.
2017-07-25 18:18:34 +10:00
darealshinji
2f18f10719 Support cross-compiling (#104)
* Support cross-compiling

* Don't fail to detect i686-w64-mingw32 targets
2017-07-07 10:59:25 +10:00
Jason Hood
6d2a75e0b5 Merge pull request #86 from amullins83/vs2015_crt_non
Add _CRT_NON_CONFORMING_WCSTOK define
2015-10-23 23:08:43 +10:00
Austin Mullins
690f8056bd Add _CRT_NON_CONFORMING_WCSTOK define 2015-10-23 07:49:33 -05:00
Jason Hood
3acc7a9f14 Remove version history & my postal address from readme.md. 2014-07-04 12:57:06 +10:00
Jason Hood
902df27762 Merge branch 'sun-readme' 2014-07-04 12:48:46 +10:00
Jason Hood
e7be303e84 Merge branch 'readme' of https://github.com/sun/ansicon into sun-readme
Add readme.md, but still keep readme.txt.
2014-07-04 12:47:12 +10:00
sun
dfc8a43ac8 Converted readme.txt into Markdown. 2014-07-01 22:56:13 +02:00
Jason Hood
1fe1d8f130 Recognise more sequences; ignore newline immediately after wrap.
Added support for CHT & CBT (move forward/backward by tabs), DECAWM (don't
wrap at EOL), CRM (display control characters, but still perform newline)
and REP (repeat last character, including BEL, BS, TAB, LF and CR).

It always bugged me that newline would add an unneeded blank line due to
wrap, but not enough to do anything about it.  For some reason, adding CRM
got me to thinking about it, so I finally did it.

Stopped \e[K from erasing the first character of the next line.
Restore cursor visibility on unload.
2014-02-26 21:18:45 +10:00
Jason Hood
7539473550 Use window height, not buffer.
Clear screen (\e[2J) will scroll in a new window the first time it's used,
or the window has scrolled, or the cursor is on the last line of the buffer.

Restore Cursor Position (\e[u) will recognise screen size changes and limit
itself to the new boundaries.
2014-02-20 18:06:28 +10:00
Jason Hood
9fa86512f3 Better parsing of escape & CSI sequences.
Recognise general Parameter & Intermediate Bytes, rather than testing
specific characters.  Explicitly ignore xterm 38 & 48 SGR values.
2014-02-18 21:34:39 +10:00
Jason Hood
bd696b55c8 Exclude entire programs; better hooking of dynamically-loaded libraries.
ANSICON_EXC can now be used to exclude an entire program (including children).
This is achieved by simply not specifying an extension: ANSICON_EXC=program.exe
will just ignore program.exe (its DLLs will still be hooked, as will its child-
ren), but ANSICON_EXC=program will not hook program at all (which also means
its children will not be hooked).

The various LoadLibrary hooks would only hook the DLL that was specified - any
DLLs it loaded would be missed.  That has now been rectified.  Similarly, a DLL
that is injected via CreateRemoteThread, using LoadLibraryA or LoadLibraryW as
its ThreadProc, will now be hooked.
2014-02-10 16:33:42 +10:00
Jason Hood
6da33b2af0 Attributes and saved position are local to each console window. 2014-02-08 18:30:53 +10:00
Jason Hood
453db81af5 Fixed restoring original attributes on detach. 2014-02-08 12:04:43 +10:00
Jason Hood
db36552c42 Work with 64-bit AnyCPU; copy original IDT to IAT; log improvements. 2014-02-08 01:10:51 +10:00
Jason Hood
dc7569dc26 Inject by adding to the Import Directory Table.
-p uses CreateRemoteThread, determining kernel32.dll & LLW dynamically.
Loading via LoadLibrary will remember the current attributes, restoring them on
unload.
Tweaked log output (remove quotes around CreateProcess command line; add an
underscore to 64-bit addresses).
ansicon.exe will really output (to the console) strings as Unicode.
Fixed ansicon.exe, if installed, restoring the default attributes, not current.
ansicon.exe will start with ANSICON_DEF (if defined and -m not used).
2014-02-05 00:21:42 +10:00
Jason Hood
bccf933c0a Always find the base address of kernel32.dll. 2014-01-27 14:03:53 +10:00
Jason Hood
b2c8a9ec12 LoadLibrary hooking improvements.
Don't hook ourself from LoadLibrary or LoadLibraryEx.
Test additional LoadLibraryEx flags before deciding to hook.
2014-01-25 23:43:41 +10:00
Jason Hood
cf6f8c741e Enable makefile.gcc V=0 to work with CMD.EXE. 2013-11-13 20:30:09 +10:00
Jason Hood
5e7590e3a9 Fixed the 32-bit detecting 64-bit improvement. 2013-09-21 01:11:53 +10:00
Jason Hood
0394977368 Improve 32-bit detecting 64-bit; release v1.66. 2013-09-20 03:15:05 +10:00
Jason Hood
75a65af4d6 Fix finding 32-bit LLW from 64-bit; fix \e[K; release v1.65. 2013-09-04 19:37:55 +10:00
Jason Hood
1448c72b66 Better method of determining a console handle. 2013-08-02 23:21:07 +10:00
Jason Hood
98e81c1da3 Don't write reset sequence if redirected; release v1.63. 2013-07-25 16:42:27 +10:00
Jason Hood
1fc43d46c3 Remove ANSI-LLW.exe for good; tweak makefiles & doc; release v1.62. 2013-07-19 00:14:54 +10:00
Jason Hood
d77831ce12 Minor change to the readme. 2013-02-20 10:16:39 +10:00
Jason Hood
2607b6156d Commit the updated readme... 2013-02-14 18:35:00 +10:00
Jason Hood
80ce96981f Updated readme; added zlib license. 2013-02-14 18:28:06 +10:00
Jason Hood
c5cb4788c2 Go back to using ANSI-LLW.exe. 2013-02-14 18:12:13 +10:00
Jason Hood
a52a46c9c1 New method to obtain 32-bit LoadLibraryW from 64-bit code, eliminating the need
for ANSI-LLW.exe.
Set the code page so ansicon.exe can display some strings properly.
Expand wildcards for -t.
VC6 can now compile the 32-bit version; use it for the release binaries.
Improvements to the VC makefile.
Describe the sequences in a bit more detail.
2012-11-24 23:41:29 +10:00
Jason Hood
ef587f0dee Fixed multiple simultaneous process creation. 2012-06-12 14:38:00 +10:00
Jason Hood
b3e905eeae Added some more sequences; released v1.52. 2012-06-02 17:20:21 +10:00
Jason Hood
4f78bdba6d Implemented \e[39m & \e[49m. 2012-06-01 23:42:58 +10:00
Jason Hood
4d2dec15d3 Enable 32-bit to inject into 64-bit. 2012-04-10 15:39:58 +10:00
Jason Hood
6fc87e3a06 Hook _lwrite & _hwrite; release v1.51. 2012-02-24 12:53:07 +10:00
Jason Hood
4add6313e9 Fix 32-bit process identifying 64-bit process. 2012-02-05 11:31:39 +10:00
Jason Hood
b73334ae08 Ignore version within core API DLL names. 2012-01-15 15:24:01 +10:00
Jason Hood
f3c69d9d21 Fixed installing into redirected CMD.EXE. 2012-01-07 15:34:43 +10:00
Jason Hood
790de57763 Exclude modules from being hooked; hook only selected GUI programs.
Added environment variable ANSICON_EXC to specify modules that should not be
hooked.  This should work around the nvd3d9wrap.dll issue.  Since it helps to
know what the modules are, logging is now always available, controlled by -l
or ANSICON_LOG.  A side-effect caused debugstr.c to move to util.c.

GUI programs are once again not hooked, unless run by "ansicon" directly or in
the ANSICON_GUI environment variable.  Since not hooking still leaves ANSICON in
the environment, created ANSICON_VER as a dynamic-only variable, which can also
serve as a version check.

Due to an email requesting a reverse video option, realised I always take the
current attributes as default.	This means if you turned on reverse and ran a
program, it would take the reverse as its default.  Created ANSICON_DEF variable
to explicitly set the default attribute, using the current if it doesn't exist.
The reverse video option is done via a "negative" attribute (e.g. "-m-f0" is
reversed black on white, meaning you'll get white on black, with foreground
sequences changing the background).  (The difference from "\e[7m" is that it
won't be reset on "\e[m".)

A child program will inherit the parent's modes (but not shift); the parent will
read the child's modes on exit (but not unload).  The exception is "ansicon",
which will always start with the default modes and leave the parent unchanged.

Improved the AutoRun entry, only running "ansicon" if ANSICON_VER doesn't exist.
The "ansicon" command is always first.

Stopped -u implying -p; return the program's exit code; don't restore the
original color when just using -p; output error messages to stderr.
2011-12-14 20:53:51 +10:00
Jason Hood
a87891fa6a Added Leigh's surname to the readme. 2011-03-04 10:55:06 +10:00
Jason Hood
21be0fa511 Updated DLL version resource. 2011-03-04 01:45:25 +10:00
Jason Hood
0f90c1c620 Restored readme's version date. 2011-03-03 17:26:14 +10:00
Jason Hood
9f939f78db Documentation improvements. 2011-03-03 17:23:45 +10:00
Jason Hood
ecc746bdb7 Added the G1 text files. 2011-03-01 21:08:00 +10:00
Jason Hood
b6e61429d7 Added DECTCEM to show/hide the cursor. 2011-03-01 21:01:37 +10:00
Jason Hood
ad82e4e642 Support SO/SI using DEC's Special Graphics Characters 2011-02-26 17:14:21 +10:00
Jason Hood
6d7cd9212c Hook GetProcAddress (.NET support for PowerShell) 2011-02-26 01:12:35 +10:00