66 questions
1
vote
3
answers
209
views
launch application using app id and get pid in return on windows
how can i get the pid of application after running it from start command?
as an example, i launched firefox now i want to get the pid of firefox in return, how can i do it?
my current approach is to ...
1
vote
1
answer
83
views
Why does setting a value on a opened (vs created) registry key throw "Acess is denied"?
Open a registry key to write to using create:
pub fn main() -> Result<(), windows::core::Error> {
let auto_start = windows_registry::CURRENT_USER.create("SOFTWARE\\Microsoft\\Windows\...
1
vote
2
answers
163
views
How to convert a u32 pid to windows-rs HANDLE
I'm trying to make the NtOpenProcess syscall in rust using the windows-rs crate. I've got the following code but cannot figure out how to convert a u32 pid to a HANDLE type, which is needed for the ...
1
vote
0
answers
99
views
Why are the COM interface types in the `windows` crate not `Send`?
As I understand it, COM objects have a "threadedness" that is associated with them when they are created. If an object needs to be handled on a certain thread, then method calls against that ...
0
votes
1
answer
141
views
RtmRegisterEntity Access violation
Summary
I try to implement this example: Register with the Routing Table Manager, but I get an error:
Exception has occurred: W32/0xC0000005
Unhandled exception at 0x00007FFCFACEBCE4 (rtm.dll) in ...
0
votes
1
answer
120
views
Communicate with a TNewCheckBoxList of an Inno Setup in Rust
I am trying to automate the installation of an Inno Setup, I have already been able to communicate with a Button and a Checkbox but I have been stuck for communication with a TNewCheckListBox. If I ...
4
votes
0
answers
237
views
How to fullscreen a 3rd-party application by its hwnd?
I'm looking to fullscreen 3rd-party windows in a (hopefully) reliable and consistent way for a window manager project. The goal is to have the fullscreen window cover the taskbar completely.
My ...
1
vote
1
answer
236
views
Passing argument to method on COM Dispatch in Rust with windows-rs
I am trying to Invoke the method Move on an Outlook MailItem Dispatch object and need to provide a MAPIFolder as an argument.
I am able to call/get other methods/properties that do not require any ...
0
votes
0
answers
273
views
EnumWindows Behavior
I've been using MSDN for the documentation, and I've also found EnumChildWindows, the rust documentation is a stub.
My question is what the behavior of EnumWindows actually is.
I've been under the ...
0
votes
1
answer
38
views
GetInterfaceDnsSettings does not accept *mut DNS_INTERFACE_SETTINGS3
I am trying to get the ServerProperties member from a DNS_INTERFACE_SETTINGS3 struct.
The documentation states to use GetInterfaceDnsSettings, and under the Settings parameter, it explicitly states ...
0
votes
1
answer
134
views
How to retrieve a struct in window_proc function in WM_COMMAND msg?
I'm trying to write a simple windows app in rust with windows-rs crate. I'd like to have a state wrapped in Counter struct and pass it to window_proc function. It is successful to retrieve the pointer ...
1
vote
1
answer
78
views
How can I create a mock Web::Syndication::SyndicationFeed with the Rust for Windows API for unit testing
I have started out with the Rust for Windows RSS reader example documented on Microsoft's website. It works as expected but is rather simplistic. I want to expand on this example, turn it into ...
0
votes
0
answers
555
views
How can I set HINSTANCE (Rust windows API) to NULL
I'm using windows-rs (version 0.52.0). I wanted to capture certain events (in my case, a keyboard input) for the entire system (by that I mean not limited to a single window thread). To achieve it, I'...
0
votes
0
answers
192
views
Using the HANDLE returned by LoadImageA in WNDCLASSEXA (instead of HICON)
I'm new to both Rust and win32 (using windows-rs), and have been trying to understand both. However, I'm running into issues setting the icon for the window class I'm trying to create. The example ...
0
votes
3
answers
357
views
Unlocking file using Restart Manager from Rust
I'm trying to convert this function from C++ to Rust using the windows crate:
#include <iostream>
#include "windows.h"
#include <RestartManager.h>
#pragma comment(lib ,"...
0
votes
1
answer
174
views
"The parameter is incorrect" error when trying to get a registry key using Windows API via windows crate
I am trying to get a registry key using Windows API via the windows crate. But I am getting this error:
Error: Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." }
...
0
votes
1
answer
221
views
Get D3D1211On12 example working using call to D3D11On12CreateDevice
I'm trying to get the C++ D3D1211On12 example working using windows-rs, but I can't get the call to D3D11On12CreateDevice to return a valid ID3D11Device.
The code I'm using is:
fn create_d11_device(...
0
votes
0
answers
148
views
Rust window created with CreateWindowExW() does not receive winEventHook messages
So I setup windows hook for EVENT_SYSTEM_FOREGROUND event then in order to receive events from windows there must be message loop in the same thread, this requires setting up a window or using ...
0
votes
1
answer
1k
views
Rust get executable path of process by window handle or process id
I'm trying to get executable path of process on Windows OS. I have window handle coming from some windows event, from window handle I can acquire process id using GetWindowThreadProcessId(). Then, ...
0
votes
1
answer
226
views
How to initialize a data type that doesn't have a default trait (such as IWICBitmapFrameEncode)?
I'm using the windows-rs, the official crate for Windows API.
Usually I have no problem with data object initialization, I can use several way to do it, for example:
let bitmap = BITMAP::default();...
1
vote
1
answer
510
views
Why does the Windows crate contain compiled static libraries?
The windows crate, which provides Rust bindings to the Windows API, is split into a few internal crates, one of them being the windows-targets. This create is also split in a few internal crates, and ...
0
votes
2
answers
328
views
Binding a Pidl with function BindToObject?
Here is my Rust code:
use std::mem::ManuallyDrop;
use windows::core::ComInterface;
use windows::Win32::System::Com::*;
use windows::Win32::UI::Shell::Common::ITEMIDLIST;
use windows::{core::Result, ...
0
votes
1
answer
584
views
consume COM library from C# to rust
Question
I want to rewrite my project from C# to rust.
But I stuck in Segmentation Fault situation.
I think I misunderstood something, or meet crate limitation, hope for some help.
Rust Code
find ...
0
votes
1
answer
888
views
Convert *mut c_void to HWND
I'm trying to convert a *mut c_void to HWND (https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Foundation/struct.HWND.html) but it keeps throwing this error:
mismatched types
expected ...
0
votes
1
answer
474
views
DescribePixelFormat from windows crate always returns 0 when given PixelFormat to fill with "parameter is incorrect" (error 87)
I am trying to use the windows crate to set and get the pixel format descriptor of a window. When I pass None to the PPFD parameter, the return value is something reasonable (the maximum pixel format ...