5332: Pass output parameter to WriteFile that is required on Windows 7 r=heinrich5991 a=Robyt3

Maybe closes #5322. I can't reproduce the crash. Can you try if this fixes it, `@Chairn?`

Looks like Windows 7 needs this parameter.

Alternative to #5331.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
bors[bot] 2022-06-05 20:52:42 +00:00 committed by GitHub
commit ef5501c4da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,8 +399,9 @@ public:
void Log(const CLogMessage *pMessage) override
{
m_OutputLock.lock();
WriteFile(m_pFile, pMessage->m_aLine, pMessage->m_LineLength, NULL, NULL);
WriteFile(m_pFile, "\r\n", 2, NULL, NULL);
DWORD Written; // we don't care about the value, but Windows 7 crashes if we pass NULL
WriteFile(m_pFile, pMessage->m_aLine, pMessage->m_LineLength, &Written, NULL);
WriteFile(m_pFile, "\r\n", 2, &Written, NULL);
m_OutputLock.unlock();
}
};