Fix error messages in manage_agents
Add error checking to chmod() in manage_agents
Fix client.keys and ossec.conf creation

Create temporary files in a secure manner on both NIX and Windows
platforms that will be used to write client.keys and ossec.conf data to.
Then use atomic operations where possible to replace the current
versions when making updates.

On Windows, decided to hardcode the location of COMSPEC instead of
pulling it from an environment variable each time. It is highly unlikely
the location of this will change but may re-examine in the future.

Since temporary files are now a possibility on agent only installs I
updated the Windows installer to inclue a tmp directory. Need to figure
out what is involved with doing the same on the NIX side.
Add tmp directory creation to InstallAgent.sh
Added code to make temporary file names consistant

This code should make the temporary file names a bit more consistant
with what gets set in the global constants. This way if those ever
change the temporary files should as well and hopefully continue to make
sense as to what they do.
Add headers for Windows builds

This lets the user see progress and where errors/warnings are happening
a bit easier. It also is similar to how the output done by the Make
stuff on the NIX side.
Use copy of marco as argument to basename_ex()

Avoid possible segfault by creating a non-constant copy of macros to
pass to basename_ex() since there is the possibility the arguments
passed could be modified. This is one of the suggestions made in the
documentation. Thanks to @cgzones for catching this issue.
Merge branch 'master' into fix_manage_agents_keys

Conflicts:
	src/InstallAgent.sh.old
	src/addagent/manage_keys.c
Merge pull request #336 from awiddersheim/fix_manage_agents_keys

Fix manage agents keys