Internal functions should return an error code instead of calling SetLastError.
Perhaps in a general sense, but URLCache_CopyEntry already did SetLastError(ERROR_INSUFFICIENT_BUFFER): setting it there means the 4 places that call it don't need to ^ the logic to set the 2 different errors themselves.
^ "repeat" is probably the word I was looking for there :-)