If Windows is reporting ERROR_ACCESS_DENIED maybe Windows is reporting that error because of a problem that is different than the one you anticipated.
It's not a matter of anticipation.
ERROR_ACCESS_DENIED is
defined as a permissions issue.
If Windows is returning it for a non-permissions problem, Windows (or a driver instructing Windows to do it) is at fault.