Skip to content

Conversation

@mkurkute
Copy link

@mkurkute mkurkute commented Mar 5, 2024

Please check the link.

4th parameter (lpNumberOfBytesWritten) is expecting pointer to DWORD value when you pass NULL to that parameter it attempts to write DWORD to null pointer which causes exception.

To fix this problem, you need to declare a DWORD variable and pass its address as the fourth parameter, like this:

DWORD at;
iWriteFile(File, WriteBuf, WriteBufNext, &at, NULL)

This way, you can also check the value of 'at' after the function returns to see if it matches the expected number of bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant