In the Mars version of Total Recall, it was a doctor. In the 2012 version, his friend, Harry. How did he know to not take the pill / shoot his friend rather than Melina?
In the 1990 version:
- Dr. Edgemar claims it doesn't matter to him if he gets shot, because he isn't actually real. But when Quaid notices a drop of sweat running down Dr. Edgemar's face he takes it as a tell-tale sign that Dr. Edgemar is lying (why would he be afraid to die if he is not real?)
In the 2012 version:
- Harry tells Quaid that Melina (and everything else) is not real. But when Quaid notices that Melina sheds a tear because she is afraid of losing the man she loves, he decides that she must be real.
Wether or not that makes sense is related to this question.
The correct answer is that Quaid gets it wrong. Dr Edgemar really is trying to save him and the whole secret agent saving Mars thing is the memory implant he has purchased transformed into an apparent reality by the schizoid embolism discussed in the early sequences of the film. How do we know?
In the film we know because we see the sequence in which Quaid describes his fantasy. The girl that latter features is constructed on a screen by the computer putting together the memory implant. The telling thing is that the girl on the screen is exactly the same as the one in the latter "events", but the description he gives is only a general one so the computer version would not be identical to the girl in the latter sequences were the latter girl not the computer generated false one - meaning hwe is mistaking the hallucination from the embolism for reality and damning himself when he rejects Dr Edgemar who really is an intrusion from outside the hallucination.
As for in the book, well Dick's work is much more subtle and gives less definitive answers than the film but it was Phil's view that we are in essential the same situation as Quaid (Blake's Lost Travellers Dreaming under the hill). Valis/Jehova is trying to get us to take the "pill" but we have to see through the deception of appearances (as per true scepticism) before we can become open enough to all the divine invasion of Christ and awaken from the dream of the dominion of matter (the hill) to idealism - the recognition that we4 are spirit and spirit constructs matter.