Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapViewOfFileEx of winlean.nim has wrong FFI declaration #12186

Closed
jangko opened this issue Sep 13, 2019 · 2 comments
Closed

mapViewOfFileEx of winlean.nim has wrong FFI declaration #12186

jangko opened this issue Sep 13, 2019 · 2 comments

Comments

@jangko
Copy link
Contributor

jangko commented Sep 13, 2019

Current

proc mapViewOfFileEx*(hFileMappingObject: Handle, dwDesiredAccess: DWORD,
                      dwFileOffsetHigh, dwFileOffsetLow: DWORD,
                      dwNumberOfBytesToMap: DWORD,
                      lpBaseAddress: pointer): pointer{.
    stdcall, dynlib: "kernel32", importc: "MapViewOfFileEx".}

dwNumberOfBytesToMap is assigned DWORD type. but according to official doc it should be SIZE_T.

SIZE_T is uint32 on 32-bit target and uint64 on 64-bit target.

It has trigger almost heisenbug like bug and very difficult to probe.

I think the fix is easy, so I left it for you to handle it.

@Araq
Copy link
Member

Araq commented Sep 13, 2019

I think the fix is easy, so I left it for you to handle it.

Not sure I like this attitute :P

@jangko
Copy link
Contributor Author

jangko commented Sep 13, 2019

Sorry, it doesn't meant to offend or insult anyone. But yeah, the sentence is ambiguous and may lead to a wrong interpretation.

vers10ne added a commit to vers10ne/Nim that referenced this issue Sep 15, 2019
`mapViewOfFileEx` of `winlean.nim` has wrong FFI declaration nim-lang#12186
dwNumberOfBytesToMap is assigned DWORD type. but according to official doc it should be SIZE_T.

SIZE_T is uint32 on 32-bit target and uint64 on 64-bit target.
vers10ne added a commit to vers10ne/Nim that referenced this issue Sep 15, 2019
@Araq Araq closed this as completed in f8000d4 Sep 18, 2019
tersec added a commit to status-im/nimbus-eth2 that referenced this issue Oct 31, 2019
mratsim pushed a commit to status-im/nimbus-eth2 that referenced this issue Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants