"Who was broken the window by?" makes no sense at all.
If you re-order the words, you'll get "Who was the window broken by?", which is correct but unnatural.This is the kind of sentence that only exists in grammar books. Chapter x : Passives. It's technically correct, but we'd never say it. In the real world, we'd say "Who broke the window?".