Git Product home page Git Product logo

Comments (6)

rodrigocfd avatar rodrigocfd commented on June 19, 2024 1

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.

rodrigocfd avatar rodrigocfd commented on June 19, 2024

I tested your code, and it works perfectly for me.

What's your Windows version?

from winsafe.

funArash avatar funArash commented on June 19, 2024

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.

rodrigocfd avatar rodrigocfd commented on June 19, 2024

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.

funArash avatar funArash commented on June 19, 2024

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.

funArash avatar funArash commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.