Logging tweaks for enrollment token retrieval.

This change suppresses error logging when the Policies key does not
exist, as this is an acceptable (and expected) condition.

This CL also:

- Changes from requesting KEY_READ to KEY_QUERY_VALUE rights when
  opening the Policies key (principle of least privilege).
- Removes some misleading wording in the emitted error messages (the
  call to Open() does not result in the creation of a key, and the call
  to ReadValue() does not write anything).
- Switches to a combination of SetLastError and PLOG so that the log
  messages contain a human-readable error code.
- Shortens the error messages -- the reader can inspect the code given
  the emitted file+line info if needed.
- Removes an early-exit path, as RegKey::ReadValue is documented as not
  modifying its out param in case of error.


Change-Id: I8990f85a4595b5356196e24167738222653846d2
Reviewed-on: https://chromium-review.googlesource.com/1060058
Reviewed-by: Roger Tawa <rogerta@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559116}
1 file changed