api: print correct last error when failing
Prior to the conversion, LastError is ERROR_SUCCESS, so move the logging to be after the conversion. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
48bbaa0be3
commit
bf5b170101
@ -1747,10 +1747,10 @@ static _Return_type_success_(return != NULL) WINTUN_ADAPTER *CreateAdapter(
|
|||||||
0) ||
|
0) ||
|
||||||
PropertyType != DEVPROP_TYPE_INT32)
|
PropertyType != DEVPROP_TYPE_INT32)
|
||||||
ProblemCode = 0;
|
ProblemCode = 0;
|
||||||
LOG_ERROR(LastError, L"Failed to setup adapter (code: 0x%x, status: 0x%x)", ProblemCode, ProblemStatus);
|
|
||||||
LastError = RtlNtStatusToDosError(ProblemStatus);
|
LastError = RtlNtStatusToDosError(ProblemStatus);
|
||||||
if (LastError == ERROR_SUCCESS)
|
if (LastError == ERROR_SUCCESS)
|
||||||
LastError = ERROR_NOT_READY;
|
LastError = ERROR_NOT_READY;
|
||||||
|
LOG_ERROR(LastError, L"Failed to setup adapter (code: 0x%x, status: 0x%x)", ProblemCode, ProblemStatus);
|
||||||
goto cleanupTcpipAdapterRegKey;
|
goto cleanupTcpipAdapterRegKey;
|
||||||
}
|
}
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user