I also had the same problem on Windows 2000, running fossil from a process running as a windows service. Using USERPROFILE as yet another fallback seems to have fixed it. So, in db.c, in function db_open_config, add this:
...
if( zHome==0 ){
   zHome = getenv("USERPROFILE");
}
...