Referencing a book or article that has referenced something else (secondary referencing)

I have read a book or an article in which the author has referenced or quoted from another work. I have not read this other work, but I wish to refer to it.  How should I reference it?

This is called secondary referencing.

You must make the situation clear in your text, eg:

Chandler, in a letter quoted by Hiney (1), claimed that most people could do without literature “far more easily than they could do without coffee or whisky”.

You only reference the work which you have read. In this case the reference which would appear in your endnote would be:

(1) HINEY, T., 1998. Raymond Chandler: a biography. London: Vintage. p. 2.