Hi Ivan, I am perhaps beating a dead horse here, but how about this instead?
if (n > 0) { NET_ThrowNew(env, err, buf); LocalFree(buf); } else { NET_ThrowNew(env, err, "FormatMessage failed"); } After all, an error *did* occur. Thanks, Brian > On Jun 11, 2019, at 7:11 PM, Ivan Gerasimov <ivan.gerasi...@oracle.com> wrote: > > The webrev looks fine to me. > > I think that *most likely* the check if (buf != NULL) will work as expected: > buf will only be set to non-NULL value upon success. > > However, the documentation for the function FormatMessage states: > """ > If the function fails, the return value is zero. > """ > > So, my preference would be if (n > 0).