The correct option is B had been doing
Here, 'had been doing' in Past Perfect Continuous Tense is correct because it
is used to indicate an action in the past that began before a certain point in
the past and continued up untill that time. Here, 'for two hours ..' indicates an action in the past that began before a certain point in the past.
'Was doing' in past continuous is incorrect because it
is used to indicate uncompleted action in the past (with or without time
reference).
'Had done' in past perfect is incorrect it
is used to indicate a completed action of the past that happened before another
event took place.
'Was done' in simple past is incorrect because it indicates an action that has already been completed.