-
-
Notifications
You must be signed in to change notification settings - Fork 223
Add kernel32!SetHandleInformation
and kernel32!GetHandleInformation
#440
Add kernel32!SetHandleInformation
and kernel32!GetHandleInformation
#440
Conversation
…ndleFlags` to PublicAPI.Unshipped.txt
@AArnott if you have any ideas on how to test these, please let me know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. You've obviously taken care t
Thank you for your contribution! You obviously were careful to conform to our conventions and I appreciate it.
I've called out some changes to be made, then we'll be happy to merge.
src/Kernel32/Kernel32.cs
Outdated
/// </remarks> | ||
[DllImport(api_ms_win_core_handle_l1_1_0, SetLastError = true)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern bool SetHandleInformation([In] SafeHandle hObject, HandleFlags dwMask, HandleFlags dwFlags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [In]
is not ordinarily necessary. Unless there's some reason you had to add it, please remove.
src/Kernel32/Kernel32.cs
Outdated
/// </returns> | ||
[DllImport(api_ms_win_core_handle_l1_1_0, SetLastError = true)] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
public static extern unsafe bool GetHandleInformation([In] SafeHandle hObject, [Out] out HandleFlags* lpdwFlags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove [In]
and [Out]
here as well. The out
modifier as well should be removed since this isn't a pointer to a pointer. It's just a pointer that we must pass in so that Win32 knows where to write the DWORD
. I'm pretty sure this would fail as written here.
Also please add [Friendly(FriendlyFlags.Out)]
to the HandleFlags*
parameter so that an overload is generated that has an out HandleFlags
parameter.
Regarding how to test this (which seems like a good idea), you could create a |
parameter attributes, see #440
Thanks for the feedback! Hope I understood you correctly. Also, I'd like to point out two things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Can you touch up the test methods slightly?
You can check for store-banned status from the Microsoft API docs for the method: So that's a good point: we need to move these methods to the storebanned folder so they don't cause store app rejection. |
Yes: that's the nature of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to store banned folder.
Thanks for the help! Hope now it's all OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
kernel32!SetHandleInformation
andkernel32!GetHandleInformation