Mohtaram @memad Sahib,
Here are my points:
The CVR (cockpit voice recorder) records for 120 minutes and has a battery backup in case of main power loss in the aircraft.
The FDR (Flight Data Recorder) will indeed be disabled in the event of data input loss as a consequence of power loss in the aircraft. If the aircraft were to run out of fuel, there would not be any data input into the FDR. However, when the aircraft runs out of fuel and there is loss of electrical power as a result of loss of power generation, electricity can still be generated by engaging RAT (Ram Air Turbine), a mini-windmill and you would still be able to operate flight controls through the generation of electrical power through RAT. RAT is installed outside the aircraft and can be engaged to generate electrical power. So if you have to glide a 777 in the event of total power loss due to loss of both engines, you can still generate electricity through RAT and operate flight controls. A 777 can be glided for as far as 90 nautical miles (about 170km) if you have total engine failure at 35000 feet. Both CVR and FDR would operate through RAT during the glide.
Mind you, there is a backup battery system in the aircraft in the event of loss of engine power which also powers electrical generators. You would engage RAT after loss of total power.
Was it done on MH370? No one knows.
One can also disable both CVR (cockpit voice recorder) and FDR (flight data recorder) from inside the cockpit by pulling on a circuit breaker.
MH370 appears to be a pilot suicide. If the pilot disabled the transponders, he must also have done the same with both the CVR and FDR. So you could have no relevant information for MH370 even if you do find the two black boxes.
Regards.