What the blazes

[What/Why/Who etc.] the (blue) blazes

  (old-fashioned, informal)
if you start a question with what/who/why etc. the blazes, you show that you are very surprised or angry about the thing you are asking about What the blazes are they doing up on the roof?
See also: blaze, what