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

NtCancelIoFileEx function is missing #9

Closed
kennykerr opened this issue Nov 18, 2022 · 9 comments · Fixed by #37
Closed

NtCancelIoFileEx function is missing #9

kennykerr opened this issue Nov 18, 2022 · 9 comments · Fixed by #37
Assignees
Labels
missing api Some documented API is missing from the metadata

Comments

@kennykerr
Copy link

The function is documented here:

https://learn.microsoft.com/en-us/windows/win32/devnotes/nt-cancel-io-file-ex

It seems like this should be included as it is clearly for desktop use and the Win32 metadata includes various other functions exported from ntdll.dll. I'm just not sure where to find the header.

Originally posted by @Thomasdezeeuw in tokio-rs/mio#1632 (comment)

@KalleOlaviNiemitalo
Copy link

Is the documentation correct in that NtCancelIoFileEx returns BOOL? I'd expect Nt functions to return NTSTATUS.

@Thomasdezeeuw
Copy link

Is the documentation correct in that NtCancelIoFileEx returns BOOL? I'd expect Nt functions to return NTSTATUS.

Mio has been handling it as a NTSTATUS and it hasn't blow up yet (https://github.com/tokio-rs/mio/blob/fc2080cd0a663125b59f0afa2bc1c771a3fbec1e/src/sys/windows/afd.rs#L28).

@kennykerr
Copy link
Author

Yes, the docs are not correct either. 😜

@KalleOlaviNiemitalo
Copy link

Huh so there is a third parameter as well.

Anyway, why would an application call NtCancelIoFileEx rather than the better-documented CancelIoEx? Does win32metadata attempt to support native NT (not Win32) applications?

@mikebattista
Copy link
Contributor

Is this header in the WDK? I don't see it in the SDK.

@kennykerr
Copy link
Author

I haven't been able to find a public version of it.

@Thomasdezeeuw
Copy link

Huh so there is a third parameter as well.

Anyway, why would an application call NtCancelIoFileEx rather than the better-documented CancelIoEx? Does win32metadata attempt to support native NT (not Win32) applications?

Because we use the third argument: https://github.com/tokio-rs/mio/blob/fc2080cd0a663125b59f0afa2bc1c771a3fbec1e/src/sys/windows/afd.rs#L119. Although I'm too familiar with Windows. Perhaps this can be rewritten to use CancelIoEx? For context wepoll also uses NtCancelIoFileEx: https://github.com/piscisaureus/wepoll/blob/0598a791bf9cbbf480793d778930fc635b044980/wepoll.c#L404-L405.

@elachlan
Copy link

elachlan commented Dec 3, 2022

Related: #1, #3, #6, #7, etc.

@mikebattista mikebattista transferred this issue from microsoft/win32metadata Feb 22, 2023
@mikebattista mikebattista added the missing api Some documented API is missing from the metadata label Feb 27, 2023
@mikebattista mikebattista added the help wanted Extra attention is needed label Mar 31, 2023
@kennykerr
Copy link
Author

Just following up on this issue. I can't find the public header with it but since it is documented here's the correct definition:

NTSTATUS
NTAPI
NtCancelIoFileEx(
    _In_ HANDLE FileHandle,
    _In_opt_ PIO_STATUS_BLOCK IoRequestToCancel,
    _Out_ PIO_STATUS_BLOCK IoStatusBlock
    );

Perhaps we can manually include it in the WDK metadata along with all of the other NtXxx APIs that are now present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing api Some documented API is missing from the metadata
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants