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

GetProcessHandleFromHwnd missing from SDK, metadata #1876

Closed
mzdk100 opened this issue Mar 22, 2024 · 6 comments
Closed

GetProcessHandleFromHwnd missing from SDK, metadata #1876

mzdk100 opened this issue Mar 22, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@mzdk100
Copy link

mzdk100 commented Mar 22, 2024

Suggestion

I need to use the GetProcessHandleFromHwnd function, but it was not found in windows-rs.
I tried using search and only received the following results:

PS E:\repositories\rust\windows-rs> Get-ChildItem -Recurse .\crates/\libs\windows\src | Select-String -Pattern "GetProce
ssHandle" -CaseSensitive

crates\libs\windows\src\Windows\Win32\System\Threading\mod.rs:995:pub unsafe fn GetProcessHandleCount<P0>(hprocess: P0,
 pdwhandlecount: *mut u32) -> windows_core::Result<()>
crates\libs\windows\src\Windows\Win32\System\Threading\mod.rs:999:    windows_targets::link!("kernel32.dll" "system" fn
 GetProcessHandleCount(hprocess : super::super::Foundation:: HANDLE, pdwhandlecount : *mut u32) -> super::super::Founda
tion:: BOOL);
crates\libs\windows\src\Windows\Win32\System\Threading\mod.rs:1000:    GetProcessHandleCount(hprocess.param().abi(), pd
whandlecount).ok()


PS E:\repositories\rust\windows-rs>

I'm not sure if this is a bug, so I want to know how to call this function.

@mzdk100 mzdk100 added the enhancement New feature or request label Mar 22, 2024
@riverar
Copy link
Collaborator

riverar commented Mar 22, 2024

This API doesn't appear in SDK headers or metadata, so I'll forward this issue to the appropriate repository. (https://learn.microsoft.com/windows/win32/winauto/getprocesshandlefromhwnd)

That said, I recommend you use GetWindowThreadProcessId instead.

@riverar riverar transferred this issue from microsoft/windows-rs Mar 22, 2024
@riverar riverar changed the title Perhaps some API bindings are missing. GetProcessHandleFromHwnd missing from SDK, metadata Mar 22, 2024
@mzdk100
Copy link
Author

mzdk100 commented Mar 25, 2024

Okay, then I'll use the GetWindowThreadProcessId function instead.

@kennykerr
Copy link
Contributor

Yep, I wouldn't add this to metadata given that it's not generally available and there's a reasonable alternative.

@mzdk100
Copy link
Author

mzdk100 commented Mar 25, 2024

I don't have any further questions, this issue can be closed.

@mikebattista mikebattista closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
@riverar
Copy link
Collaborator

riverar commented Mar 25, 2024

Hey no take backs, it's documented so SDK/metadata needs an update.

Dump of file oleacc.dll

File Type: DLL

  Section contains the following exports for OLEACC.dll

    00000000 characteristics
    66CABA88 time date stamp
        0.00 version
           1 ordinal base
          28 number of functions
          28 number of names

    ordinal hint RVA      name

          3    0 00042230 AccGetRunningUtilityState
          4    1 000429F0 AccNotifyTouchInteraction
          5    2 00042A80 AccSetRunningUtilityState
          6    3 00013A30 AccessibleChildren
          7    4 00006130 AccessibleObjectFromEvent
          8    5 00042AD0 AccessibleObjectFromPoint
          9    6 0000EC80 AccessibleObjectFromWindow
         10    7 00003F80 AccessibleObjectFromWindowTimeout
         11    8 00017BB0 CreateStdAccessibleObject
         12    9 00042B20 CreateStdAccessibleProxyA
         13    A 00042B70 CreateStdAccessibleProxyW
         14    B 00017E40 DllCanUnloadNow
         15    C 000039E0 DllGetClassObject
          1    D 0001E170 DllRegisterServer
          2    E 0001E170 DllUnregisterServer
         16    F 00042BC0 GetOleaccVersionInfo
+        17   10 00003840 GetProcessHandleFromHwnd
         18   11 00042C10 GetRoleTextA
         19   12 00018FF0 GetRoleTextW
         20   13 00042C60 GetStateTextA
         21   14 0001A850 GetStateTextW
         22   15 000525B8 IID_IAccessible
         23   16 00052C40 IID_IAccessibleHandler
         24   17 00054008 LIBID_Accessibility
         25   18 00012100 LresultFromObject
         26   19 00019610 ObjectFromLresult
         27   1A 0000B4A0 PropMgrClient_LookupProp
         28   1B 00019A30 WindowFromAccessibleObject

@riverar riverar reopened this Mar 25, 2024
@riverar
Copy link
Collaborator

riverar commented May 7, 2024

@mikebattista Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants