Microsoft does gives out source code for some of its software (including parts of windows) to various universities for research purposes. Ofcourse, there are NDAs involved but that shows they aren't shy to share the code in certain. situations.