Fix build issue on Win/Haiku.

       This fixes a build issue with C variable declarations in my refcounting
       change.
Fix linker error for Win32 tests.

       This adds the new testautomation_main.c to the VisualC projects.