You're overestimating the importance of source code, and underestimating the importance of everything else in the value chain of selling software.
Sure, a contractor might steal your source code. But what then? Will they be able to create a release, maintain the code further, contact your customers and sell them a knock-off for a lower price? Almost certainly not. Particularly for extremely large companies like Microsoft, making money from software involves a hell of a lot more then compiling the classes and shipping them to people for money. Nobody could possibly steal the Windows source code and proceed to put Microsoft out of business; the legal, practical and logistical hurdles are just way too high to pull that off.
That leaves the fear that by reading the source, competitors will learn the clever tricks you used and gain an advantage. This, too, is almost always grossly overrated; if your ideas are any good, you will have to ram them down people's throats! Software succeeds big not because it uses clever tricks, but because it fulfills a need accurately. Successful software shops do good market research, gather good requirements, have a solid production and testing process in place and generally do things in the most predictable, easy-to-plan way.
To be sure, sometimes there is a market advantage to be gained from having more brilliant engineers than the competition. Read Paul Graham's description of Viaweb one day - the competition didn't even know they were using Common Lisp! But are you really a Paul Graham? Probably not.
(And Microsoft does in fact make windows source code available to many partner universities - under non-disclosure agreements, to be sure, but still, exactly to the people that might use the ideas gleaned from it to compete with Microsoft! But this never happens, because possessing someone's source code doesn't magically equate to usurping their market position.)