To get the mask, you can try EnumIPinfo() or if that fails you, Howard's UDF GetIPinfo(). Jens has a whole bunch of UDFs as well.

If you plan to change the GW in the reg, then you'll need to figure out where it is. Once you get that figured out, you'll see the SubNet Mask is in the same reg key.

I still don't see why the INI route would be such a big deal. You only need to have entries for those that need to be changed. You certainly don't need 8000 entries unless you plan to change all of them. You could also use the INI file as a control file to determine what subnets need to be changed.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.