- May
- 13,566
- 199
Since a UNIX-like shell was mentioned in another thread, I thought I'd see how TCSH was working (after a long time). I'll make a long story short. TCSH's built-in "title" command (set the console title) crashes TCSH like this (ONLY if TCSH was started by TCC).
This does not happen if TCSH was started by a stand-alone CMD, by a stand-alone PowerShell, or by a CMD started by TCC. The story is odd for TCSH started by a PowerShell started by TCC. If I had not manually set PowerShell's title ($Host.UI.RawUI.WindowTitle = "some title") then TCSH will crash as above. If I had manually set PS's title, TCSH's "title" command works OK.
I can't imagine why being in a TCC console would make a difference. FWIW, here's TCSH's "dotitle" code.
Code:
v:/> title foo
title: No match.
free(0x7fbd7748) bad block. (memtop = 0x7fc0f000 membot = 0x7fbb0000)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
(along with a message box: "tcsh.exe has stopped working)
This does not happen if TCSH was started by a stand-alone CMD, by a stand-alone PowerShell, or by a CMD started by TCC. The story is odd for TCSH started by a PowerShell started by TCC. If I had not manually set PowerShell's title ($Host.UI.RawUI.WindowTitle = "some title") then TCSH will crash as above. If I had manually set PS's title, TCSH's "title" command works OK.
I can't imagine why being in a TCC console would make a difference. FWIW, here's TCSH's "dotitle" code.
Code:
void dotitle(Char **vc, struct command * c) {
int k;
char titlebuf[512];
char errbuf[128],err2[128];
char **v;
UNREFERENCED_PARAMETER(c);
vc++;
vc = glob_all_or_error(vc);
cleanup_push(vc, blk_cleanup);
if ((k=GetConsoleTitle(titlebuf,512) ) != 0) {
titlebuf[k]=0;
setcopy(STRoldtitle,str2short(titlebuf),VAR_READWRITE);
}
memset(titlebuf,0,512);
v = short2blk(vc);
cleanup_until(vc);
cleanup_push((Char **)v, blk_cleanup);
for (k = 0; v[k] != NULL ; k++){
__try {
StringCbCat(titlebuf,sizeof(titlebuf),v[k]);
StringCbCat(titlebuf,sizeof(titlebuf)," ");
}
__except(GetExceptionCode()) {
stderror(ERR_TOOMANY);
}
}
if (!SetConsoleTitle(titlebuf) ) {
make_err_str(GetLastError(),errbuf,128);
(void)StringCbPrintf(err2,sizeof(err2),"%s",v[k]);
stderror(ERR_SYSTEM,err2,errbuf);
}
cleanup_until((Char **)v);
return;
}
void docls(Char **vc, struct command *c) {
UNREFERENCED_PARAMETER(vc);
UNREFERENCED_PARAMETER(c);
NT_ClearScreen_WholeBuffer();
}