microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.34k stars 116 forks source link

GetProcessHandleFromHwnd missing from SDK, metadata #1876

Closed mzdk100 closed 5 months ago

mzdk100 commented 7 months ago

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.

riverar commented 7 months ago

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.

mzdk100 commented 7 months ago

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

kennykerr commented 7 months ago

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

mzdk100 commented 7 months ago

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

riverar commented 7 months ago

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 commented 5 months ago

@mikebattista Thanks!