Black_Fox wrote:Aha, now I see I probably misunderstood Aleksey's post. Sorry about that
Dont't feel bad, I dont get it neither.
So this part of the code...
Code: Select all
if (rc != ERROR_SUCCESS)
return rc;
For me has sense: In case the API is failing(aka rc is not ERROR_SUCCESS), we are returning the proper ERROR.(Maybe the function needs which is the exactly system error in order to perform other operations)
but the...
...Doesnt have any sense for me.
This means:
In case the API is working (aka rc is ERROR_SUCCESS) we are returning it didn't success at all. This doesnt have sense.
Let's see from another POV: If the API is working, we are forcing it to return ERROR_UNSUCCESSFUL.
And from another POV(2nd part): When are we supposely to be returning ERROR_SUCCESS?We aren't, in any case.
So for me, the correct code would be:
Code: Select all
if (rc != ERROR_SUCCESS)
return rc;
else
return ERROR_SUCCESS;
which is equivalent to: