RE Mode S:
It has a code you can enter for that flight, but also a code in the background unique to the airframe. It is - in computer terms - a MAC address and is used like that for data communications in the background.
There are 24 bits in the ICAO mode S address. The USA is assigned a block of codes starting with Axxxxx, where A is the first Hexadecimal digit and xxxxx are 5 Hexadecimal digits unique to the aircraft.
Does the 777 let the pilots change the tail number as well as the flight ID?