What is the Windows drivers\etc\services file for?
Normally there's a "services" file in C:\Windows\System32\drivers\etc , it lists out the services running and the port to be used.
However what does the word "service" mean here? It's not the "Windows Service", which could be seen when you run "services.msc". Such 2 lists don't tally.
And, this "services" file content could be outdated -- nobody to update it: programs still can communicate through some port without updating the "services" file, if they have some agreement; also, if some program is not running, some port is not taken, the "Windows services file" is also not updated.
So what is this file for?
Anywhere could I find some documents? Maybe because of the popular file name, I have searched on internet but most links are about "Windows Services"... not this "Windows Services File"...
EDIT:
One more question, since the "services" file can be outdated, is there a way to list out all active "services"?
This file tells services written by Microsoft what port to use, as well as files that wish to use Windows APIs and/or that file to turn a service name into a port. These service names are defined by the IETF.
Here is an example of instructions to change a port to make room for another SMTP server.
And here is more explanation about the service names:
servicename [in]
A NULL-terminated string that contains the service name or destination port of the host on which to connect for IPv4 or IPv6.
A service name is a string alias for a port number. For example, “http” is an alias for port 80 defined by the Internet Engineering Task Force (IETF) as the default port used by web servers for the HTTP protocol. Possible values for the servicename parameter when a port number is not specified are listed in the following file:
%WINDIR%\system32\drivers\etc\services
— MSDN - Winsock - WSAConnectByName function