Autodetermine WIN_DEBUG and WIN_VERSION values

We now automatically determine the WIN_DEBUG value
from the version info, so if the version contains debug,
we set it to yes otherwise to no.

For the WIN_VERSION, we check if the name contains "64",
if so the WIN_VERSION is 64 else it is 32.
Fix some more compiler warnings.
Fix resource leak in create_pid_file().
Fix buffer overrun.
Explicitly return NULL or 0 on M_ABORT error.

This makes the work for static analyzing tools a lot easier that
don't understand that a M_ABORT means stop executing the program
and abort creating a crash on our way out.
Fix wrong return.
Use bstrncpy and not strncpy.
Don't return a pointer to a local variable.
Remove useless debug message.