I've been trying to get NEW-ENVIRON working. By I typically get [ IAC SB NEW-ENVIRON VAR IAC SE ] in response to [ IAC SB NEW-ENVIRON SEND IAC SE ]. Is that not how to request the client enumerate the names of variables it offers?
Ah, my problem was that my request for supported variables names was not working, and my requesting of variables caused Windows Telnet to crash.
Reading the RFC, it seems very clear that you can request that the client list the default variables it will send.
If a list of variables is specified, then only those variables should be sent. If no list is specified, then the default environment, of both well known and user defined variables, should be sent. If one of the variables has no name, then all the variables of that type (well known or user defined) in the default environment should be sent.
However, Windows Telnet returns an empty list for [ IAC SB NEW-ENVIRON SEND IAC SE ] , [ IAC SB NEW-ENVIRON SEND VAR IAC SE ] and [ IAC SB NEW-ENVIRON SEND USERVAR IAC SE ].
Going back to my disassembly of it, it explicitly calls a function to insert the default variables if it receives any of these sequences, but given that it sends nothing back this must be a bug. Looking further, there are two supported variables (USER and SYSTEMTYPE) for Windows Telnet. However, by setting a registry key (Software\\Microsoft\\TelnetClient\\AllowedEnvVariables), you can define which variables in the environment can be accessed on demand. And googling for this key yields a relevant MSDN page.
Querying all the variables listed there crashes Windows Telnet. None of them other than SYSTEMTYPE have a value. It turns out that the specific variable that causes the crash is USER.
Anyway, thanks for the reply, it got me back on track :smile: