Comments (6)
Dude... this problem was driving me nuts. I was about to send you a Rust code with exposed raw bindings to find out what was wrong.
Good to know it's fine.
from winsafe.
I tested your code, and it works perfectly for me.
What's your Windows version?
from winsafe.
I have two Windows installs and it was reproducable on both
x64 OS
Edition Windows 11 Enterprise
Version 22H2
Installed on 3/29/2023
OS build 22621.2715
Experience Windows Feature Experience Pack 1000.22677.1000.0
aarch64 OS
Edition Windows 11 Pro
Version 23H2
Installed on 7/11/2023
OS build 22631.2715
Experience Windows Feature Experience Pack 1000.22677.1000.0
funArash@9332457 this works.. it is the check of the data_lens that is causing it. no sure what is its root cause
from winsafe.
Will the code below run?
fn main() {
use winsafe::{self as w, prelude::*, co};
let hkey = w::HKEY::CURRENT_USER.RegOpenKeyEx(
Some("Control Panel\\Mouse"),
co::REG_OPTION::default(),
co::KEY::READ,
).unwrap();
let val = hkey.RegQueryValueEx(Some("Beep")).unwrap();
match val {
w::RegistryValue::Dword(n) => println!("Number u32: {}", n),
w::RegistryValue::Qword(n) => println!("Number u64: {}", n),
w::RegistryValue::Sz(s) => println!("String: {}", s),
w::RegistryValue::ExpandSz(s) => {
println!("Env string: {}", w::ExpandEnvironmentStrings(&s).unwrap());
},
w::RegistryValue::MultiSz(strs) => {
println!("Multi string:");
for s in strs.iter() {
print!("[{}] ", s);
}
println!("");
},
w::RegistryValue::Binary(bin) => {
println!("Binary:");
for b in bin.iter() {
print!("{:02x} ", b);
}
println!("");
},
w::RegistryValue::None => println!("No value"),
}
}
from winsafe.
it panics on line with let val = hkey.RegQueryValueEx(Some("Beep")).unwrap();
thread 'main' panicked at src\main.rs:12:50:
called `Result::unwrap()` on an `Err` value: [0x1a2e 6702] The requested operation is not valid on the Transaction object in its current state.```
from winsafe.
My bad.. the test above was done against version 0.0.18..
using latest master (16f2119a56)
works fine with both my code and yours.
looks like this #103 is the fix.
from winsafe.
Related Issues (20)
- validate_retrieved_reg_val always fails
- [Question] - Calling windows APIs twice best practice HOT 3
- nm_custom_draw should provide a mutable reference? HOT 6
- How do you envision WM_USER being used? HOT 1
- `WC::NoValue`? HOT 1
- I don't think `MultiByteToWideChar` and `WideCharToMultiByte` need to add 1 to `num_bytes` HOT 4
- resizable_layout not work as expect HOT 8
- When the new_dlg function is used to create a window, the wm_create event does not work HOT 6
- Async IO should be marked as "unsafe" HOT 1
- CreateToolhelp32Snapshot error when compiling for x86
- Panic in wstring/ QueryFullProcessImageName HOT 3
- How to set up a transparent window? HOT 1
- Public access ot LocalFreeGuard::new or LocalFree HOT 2
- [BUG?QUESTION?]SendInput example not working HOT 1
- [Question] How can I set the pszText into NMLVDISPINFO correctly when handling lvn_get_disp_info event? HOT 19
- [Question] Using MutFn as WinApi callback
- WString pointers cause issues on stack for certain API calls HOT 5
- Build fails for the i686-pc-windows-(msvc/gnu) targets HOT 8
- winsvc.h HOT 2
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 winsafe.