Skip to content

Commit

Permalink
Fix failing windows event log unit test. (#431)
Browse files Browse the repository at this point in the history
* Fix failing windows event log unit test.
Ignore EvtFormatMessage() errors if data is returned.

* Run unit tests on Windows Server 2019 and 2022/latest.
  • Loading branch information
adam-mateen authored Apr 5, 2022
1 parent 100ecb5 commit b6e6822
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019 ]
os: [ windows-2019, windows-latest ]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (w *windowsEventLog) getRecord(evtHandle EvtHandle) (*windowsEventLogRecord
var bufferUsed uint32
err = EvtFormatMessage(publisherMetadataEvtHandle, evtHandle, 0, 0, 0, EvtFormatMessageXml, uint32(bufferSize), &renderBuf[0], &bufferUsed)
EvtClose(publisherMetadataEvtHandle)
if err != nil {
if err != nil && bufferUsed == 0 {
return nil, fmt.Errorf("EvtFormatMessage() publisher %v, err %v", newRecord.System.Provider.Name, err)
}
descriptionBytes, err := UTF16ToUTF8BytesForWindowsEventBuffer(renderBuf, bufferUsed)
Expand Down

0 comments on commit b6e6822

Please sign in to comment.