Comments (17)
This is good. Thank you. I'll let you know how it goes
from winapi-rs.
Thank you very much.
from winapi-rs.
What exactly are you asking? That function does exist: https://docs.rs/winapi/latest/winapi/um/propsys/struct.IPropertyStore.html#method.SetValue
from winapi-rs.
What exactly are you asking? That function does exist: https://docs.rs/winapi/latest/winapi/um/propsys/struct.IPropertyStore.html#method.SetValue
@sollyucko Thank you for the quick response :) I'm asking how to make a shell extension that will register this function and allow me to call it. I think I have to make a dll and then register it. What I want to know is how to make that dll in Rust. Do I need to write a DllMain
? Where do I go from there?
from winapi-rs.
I will try to explain better. I want to create a shell extension, with just Rust, that will let me modify how Windows Explorer deals with reading details from a certain file type. But the issue is I don't know how to make something like that.
from winapi-rs.
You can use crate-type=cdylib
to generate a C-compatible DLL: https://doc.rust-lang.org/reference/linkage.html
from winapi-rs.
Awesome :) now what functions do I add here to make it work with the shell? DllMain
perhaps? And how do I implement the interface
from winapi-rs.
Yeah, I guess so. I'm not very familiar with this, but I think these resources should help you get started:
- Well-commented example C++ source code: https://www.tecgraf.puc-rio.br/iup/examples/shell_extensions/ (start with dllmain.cpp)
- "Initializing Shell Extension Handlers": https://learn.microsoft.com/en-us/windows/win32/shell/int-shell-exts
from winapi-rs.
@sollyucko How to implement IClassFactory? https://www.tecgraf.puc-rio.br/iup/examples/shell_extensions/ClassFactory.cpp They did it here. I have to implement https://docs.rs/winapi/latest/winapi/um/unknwnbase/struct.IClassFactory.html somehow
from winapi-rs.
I'm not sure. Maybe use RIDL!
somehow?
from winapi-rs.
I'm gonna use https://raw.githubusercontent.com/GabrielMajeri/com-impl-rs for now. So I have to Rewrite-it-in-Rust for everything in that example you sent?
from winapi-rs.
I've started to remake all of it. I'm not sure it'll work because the macro doesn't tell me whether I'm using the correct function signatures or not. I may miss a *mut
or a *
or a **
somewhere.
from winapi-rs.
I will post my progress at https://github.com/duckfromdiscord/midi-windows-ext periodically.
for RegCreateKeyExW
, if phkResult
is an out, why does it ask me to initialize it?
error[E0381]: used binding `hKey` isn't initialized
--> src\reg.rs:28:47
|
20 | let mut hKey: *mut HKEY;
| -------- binding declared here but left uninitialized
...
28 | KEY_WRITE, &mut security_attributes, hKey, 0 as *mut u32).try_into().unwrap());
| ^^^^ `hKey` used here but it isn't initialized
|
help: consider assigning a value
|
20 | let mut hKey: *mut HKEY = todo!();
|
from winapi-rs.
So I have to Rewrite-it-in-Rust for everything in that example you sent?
Yeah, probably, unless you want to deal with C++ FFI.
I may miss a
*mut
or a*
or a**
somewhere.
Just keep in mind that P
or LP
means *mut
and PC
or LPC
means *const
, and you should be fine, I think.
for
RegCreateKeyExW
, ifphkResult
is an out, why does it ask me to initialize it?
You're trying to directly read the value of an uninitialized variable. Assuming you're trying to have the handle end up directly in hKey
, not in what in points to, do one of the following:
- Declare
hKey
asHKEY
and initialize it to some value, e.g.std::ptr::null_mut()
, and callRegCreateKeyExW
with&mut hKey
- Declare
hKey
asMaybeUninit<HKEY>
and initialize it asMaybeUninit::uninit()
, callRegCreateKeyExW
withhKey.as_mut_ptr()
, and, if you're completely sure it's initialized, get theHKEY
out usinghKey.assume_init()
from winapi-rs.
We don't have StringCchPrintf
from winapi-rs.
winapi does have w(v)sprintf(A/W)
; can you use that instead? The buffer has a fixed length of 1024 bytes though...
libc::snprintf
is probably a much better option.
format!
/write!
is another option, but that has different format string syntax and output semantics.
I think the String...
functions are only defined in strsafe.h
, not in any built-in object files, but you could write a bit of C code to generate an object file with them, then write custom bindings to link it to your Rust code.
from winapi-rs.
Yeah, I guess so. I'm not very familiar with this, but I think these resources should help you get started:
* Well-commented example C++ source code: https://www.tecgraf.puc-rio.br/iup/examples/shell_extensions/ (start with dllmain.cpp) * "Initializing Shell Extension Handlers": https://learn.microsoft.com/en-us/windows/win32/shell/int-shell-exts
Looks like somehow, between the last time I was looking at this code 3 weeks ago, and today, they privated all the code.
from winapi-rs.
Related Issues (20)
- Error when calling winapi::um::fileapi::CreateFileW()
- [Help] crate winapi 0.28 cannot be found HOT 1
- Error: could not find `wow64apiset` in `um`
- Missing most ole2.h definitions
- add richedit?
- Missing SHGetDesktopFolder
- winapi crashes on x86 because of conflicting stack alignment assumptions HOT 16
- ID3D11Device1::CreateRasterizerState1 is called “CreateRasterizerState” in winapi
- devquery, swdevice, shlwapi, verrsrc and winternl related modules are not defined
- Usage of GetThumbnail (?)
- Hide `winapi`'s documentation behind a feature flag?
- WritePrinter doesn't support international characters HOT 2
- CopyFileTranslatedA takes LPCWSTR as a parameter type HOT 2
- Linker error when cross compiling on Linux for Windows HOT 1
- Is this project dead replaced by windows-rs? HOT 1
- Add missing `GetIconInfoEx` and related structures
- Superseded by windows-sys? HOT 1
- Hi,there, does anyone know how to record drag event on windows?
- ConvertStringToSidA is missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winapi-rs.