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

The specified program cannot be found #142

Open
zhuyu4839 opened this issue Mar 19, 2024 · 4 comments
Open

The specified program cannot be found #142

zhuyu4839 opened this issue Mar 19, 2024 · 4 comments

Comments

@zhuyu4839
Copy link

The dll file is https://github.com/zhuyu4839/zlgcan-driver/blob/main/zlgcan/library/windows/x86_64/zlgcan.dll

The function named GetIProperty, ReleaseIProperty, ZCAN_GetValue, ZCAN_SetValue can't found

called Result::unwrap()on anErr value: GetProcAddress { source: Os { code: 127, kind: Uncategorized, message: "找不到指定的程序。" } }

@nagisa
Copy link
Owner

nagisa commented Mar 19, 2024

This error comes from your OS and is not an issue with libloading specifically. Unfortunately I am not in a position to provide application support here, please use other appropriate channels to discuss use of these system APIs.

@nagisa nagisa closed this as completed Mar 19, 2024
@zhuyu4839
Copy link
Author

All right. but there is no panic when using dlopen2.

@nagisa
Copy link
Owner

nagisa commented Mar 20, 2024

Okay, that's quite curious. However as the report is written currently I’m still unable to help or investigate by myself.

In order for me to look into this, I would need a reproducer that does not involve binary executable code downloaded off internet. I’m not currently in a position to set up a VM to test your library.


If you are up to testing some things, it would be great if you compared not with dlopen2 and other competing crates, but windows API. Can you try something like:

// use the `windows-sys` crate with the "Win32_Foundation" feature enabled
use windows_sys::Win32::System::LibraryLoader;
let handle = LibraryLoader::LoadLibraryA(b"C:\\path\\to\\zlgcan.dll\0");
assert!(handle != 0);
let symbol = LibraryLoader::GetProcAddress(handle, b"ZCAN_GetValue\0");
assert!(symbol.is_some());

this is effectively what libloading should be doing under the covers. If this fails as well, then it will be curious to see what dlopen2 is doing differently and why it works. If this does work, then it might have something to do with e.g. #125.

Which brings me to another thing to try -- is this something that started happening in a recent release? Can you check if, perhaps, libloading 0.7.4 works? It should need no changes to your reproducer.

@nagisa nagisa reopened this Mar 20, 2024
@zhuyu4839
Copy link
Author

Ok. I'll try it later because i'm refactoring the code.

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

No branches or pull requests

2 participants