Those code have hard-coded /etc, which might not make sense on Windows.
There are some different cases:
(1) For files like /etc/hosts , it should be replaced by the correct path Windows\System32\drivers\etc\hosts
(2) For some configuration files, it should use sysconfdir.
(3) For some specific cases, it should use CSIDL_APPDATA , CSIDL_DEFAULT_APPDATA, or something relevant.