Is there ever a reason to want `pResult` to be NULL?  Maybe this should be
```c
if (pResult) {
  *pResult = dwResult;
}
```