MSDN contains a lot of info on your problem.
This[
^] article offers you to use
GetAdaptersAddresses()[
^] function on Windows XP and later,
this[
^] page tells you
IpAddressList is actually a linked list (you can use
Next member) and
this[
^] article describes function that can query loopback interface parameters, if needed