Raphael wrote:
if (!bTest) return E_FAIL;
Don't use E_FAIL. Try to return a proper error code, preferably using what native returns in this circumstance by adding a test case.
see http://msdn.microsoft.com/workshop/delivery/download/overview/launchinfsecti... Native function returns E_FAIL
Maybe you are being naïve in believing MSDN or maybe MSDN is correct, but I'm basing this opinion on other tests for advpack that are returning values like HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND). The best way to prove it either way is to write a test case that exercises this code path. Where this is not possible then you should return as appropriate an error message as possible and this will typically not be E_FAIL.