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

Tokio support (Rust) #60

Closed
BlueGradientHorizon opened this issue Jul 19, 2023 · 3 comments
Closed

Tokio support (Rust) #60

BlueGradientHorizon opened this issue Jul 19, 2023 · 3 comments

Comments

@BlueGradientHorizon
Copy link

Hello.
Tokio is an event-driven, non-blocking I/O platform for writing asynchronous applications with the Rust programming language.

I'm currently writing a small server-client application using the Tokio crate. I intended to write a very simple client with minimal dependencies, but it turns out that the core of my program - Tokio - already includes a few unresolved characters on Windows XP.
When I try to run the given program's executable on Win XP:

Cargo.toml:

[package]
...

[dependencies]
tokio = { version = "1", features = ["full"] }

src/main.rs:

#[tokio::main]
async fn main() { }

i get two unresolved characters - GetQueuedCompletionStatusEx (MS docs) in kernel32.dll and NtCancelIoFileEx (MS docs) in ntdll.dll.

And this program (an example of a simple TCP server from https://crates.io/crates/tokio):

use tokio::net::TcpListener;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
     let listener = TcpListener::bind("127.0.0.1:8080").await?;

     loop {
         let (mut socket, _) = listener.accept().await?;

         tokio::spawn(async move {
             let mutbuf = [0; 1024];

             // In a loop, read data from the socket and write the data back.
             loop {
                 let n = match socket.read(&mut buf).await {
                     // socket closed
                     Ok(n) if n == 0 => return,
                     Ok(n) => n,
                     Err(e) => {
                         eprintln!("failed to read from socket; err = {:?}", e);
                         return;
                     }
                 };

                 // Write the data back
                 if let Err(e) = socket.write_all(&buf[0..n]).await {
                     eprintln!("failed to write to socket; err = {:?}", e);
                     return;
                 }
             }
         });
     }
}

adds one more unresolved symbol - SetFileCompletionNotificationModes (MS docs) in kernel32.dll

Is it possible to implement these functions?

Wine implementation of these functions:

I appreciate your work. Thanks.

@mingkuang-Chuyu
Copy link
Collaborator

I'm sorry. I don't know... SetFileCompletionNotificationModes.

mingkuang-Chuyu added a commit that referenced this issue Oct 1, 2023
mingkuang-Chuyu added a commit that referenced this issue Oct 1, 2023
  - 添加 SetFileCompletionNotificationModes
  - 添加 GetQueuedCompletionStatusEx
  - 添加 NtCancelIoFileEx
@mingkuang-Chuyu mingkuang-Chuyu added the 进度:等待发布 处理完毕,耐心等待新版本。 label Oct 1, 2023
mingkuang-Chuyu added a commit that referenced this issue Oct 1, 2023
  - 添加 SetFileCompletionNotificationModes
  - 添加 GetQueuedCompletionStatusEx
  - 添加 NtCancelIoFileEx
@mingkuang-Chuyu
Copy link
Collaborator

@mingkuang-Chuyu mingkuang-Chuyu added 进度:处理完成 and removed 进度:等待发布 处理完毕,耐心等待新版本。 labels Oct 1, 2023
@zhuxiujia
Copy link

zhuxiujia commented Feb 20, 2024

https://github.com/Chuyu-Team/YY-Thunks/releases/tag/v1.0.9-Beta3

done!

yy-thunks version: v1.0.9 beta3

i try this code(tokio) on
windows server 2008( win vista)
fail (PermissionDenied, this is run on administrator )

1708449346053

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