As far as I know, the hosts file is optional. Windows (every version) comes with only an example file hosts.sam.
So if there is no hosts files, it's hard coded. That's no magic at all.
Kees
I have a hosts file that has absolutely EVERYTHING commented out - specifically:
[pre]
# 127.0.0.1 localhost
# ::1 localhost
[/pre]
Also, I do NOT have a lmhosts file
but SOMEHOW when I do:
[pre]ping localhost[/pre]
I get replies from ::1 as in:
C:\> ping localhost
Pinging PC11 [::1] with 32 bytes of data:
Reply from ::1: time <1ms
...
Note:
1. The ping replies came from PC11 - so somehow localhost was translated to the computer name (PC11)
2. Somehow either PC11 or localhost got resolved to ::1
3. A Wireshark capture showed that there were NO DNS requests sent (yes - I did do an ipconfig /flushdns first)
Once upon a time (pre Windows 8.1) I thought I understood this - you had to have "localhost" in the hosts file to get resolved.
So my question is, what magic does Win8.1 use to resolve the hostname "localhost"?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic