TYPE, Unicode, installer

#1
Is TYPE supposed to recognize Unicode and display it properly? I found this (fragment of a?) batch file in my temp directory, apparently left by the installer.
Code:
t:\> type {1948DD3B-5B8E-48E1-B620-385FB506AAF2}.bat
  e c h o  o f f
d e l  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d 4 8 c 3 1 3 9 4 9
d 1 2 2 0 \ u p d a t e r . i n i "
d e l  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d 4 8 c 3 1 3 9 4 9
d 1 2 2 0 \ u p d a t e r . d a t "
: a g a i n
i f  n o t  e x i s t  " h : \ T e m p \ d c 6 d 7 5 a d 8 2 2 6 e 2 0 7 0 d
4 8 c 3 1 3 9 4 9 d 1 2 2 0 \ u p d a t e r . e x e "  g o t o  e n d
i f  e x i s t  " h : \ T e m p \
It has no BOM. It starts with an '@' which was lost by TYPE. The Unicode isn't handled correctly and the first line is off (compared to the others) by a byte.

That's the whole file. How did it get chopped off? What about the Unicode?
 

rconn

Administrator
Staff member
May 14, 2008
10,417
95
#2
TYPE recognizes Unicode files if (1) they have a BOM, or (2) they have recognizable (by Windows) Unicode sequences (like a Unicode CR/LF), and (3) they're not an odd number of bytes (which cannot be Unicode).

Without seeing the entire physical file, I can't say why it failed the test. And I have no idea what the installer was doing with the file or how/why it was truncated -- that's a question for Microsoft.
 
#4
P.S. Also left, in %TEMP=h:\temp, is a directory, "dc6d75ad8226e2070d48c313949d1220" containing

4/24/2012 20:55 11,459 updater.dat
4/23/2012 0:24 524,392 updater.exe
4/24/2012 20:55 227 updater.ini

The same structure, with the same names, timestamped a few hours earlier, exists in the old temp location (in appdata). That batfile is longer, but still incomplete/truncated and not recognized as Unicode by TYPE. It's attached.
 

Attachments

#7
It's 683 bytes, so it obviously cannot be a Unicode (UTF-16) file. So TCC doesn't even bother scanning the file for Unicode strings.
So I deleted the old stuff and upgraded to build 63 ... got new leftovers in TEMP. This time the batfile (attached) is 480 bytes. TYPE doesn't show it properly. Why is it there in the first place? Why is it corrupted?
 

Attachments

#10
As far as I can tell, CMD can't execute a Unicode batfile, even with a BOM. Why in the world would Microsoft create one? Googling turns up no connection between the Windows installer and anything called "updater.ini"
 
#11
And upon checking, I find that the same thing happens on XP ... in TEMP, a folder containing updater.dat|.exe|.ini and a truncated Unicode batfile without a BOM that was apparently not executed.