First I have to say that that code is not safe. It violates the
unsafe.Pointer rules. The Windows function EvtFormatMessage takes a
pointer. The Go function evtFormatMessage converts the slice address
to uintptr, and passes that. The conversion to uintptr is permitted
in the call to EvtFormatMessage, but that is not where it takes place.
So this code is wrong, although in practice it will usually work as
expected.
That aside, I don't think you're misunderstanding anything. The ? in
the stack traceback means that the value might be wrong. That ? is
printed when the value is not live, meaning that the compiler may have
overwritten or discarded the value at the point of the stack
traceback. In this case the "values" slice is dead at the point of
the call to _EvtFormatMessage. Likely the values shown in the call to
evtFormatMessage are simply wrong.
Ian