Work with Visual Studio and Bug Fixes

Pull this branch you'll get some bugs fixed and support *Visual Studio*, following is a list of changes:

* Add  Visual Studio support. But instead of including Visual Studio project files directly, add a [CMake](http://www.cmake.org/) rule file for generating Visual Studio project files (I'd test both 2008 and 2012).
* Fix some bugs for *win32*.