Skip to content

Code Quality: Replaced DllImport calls with CsWin32 generations for event object operations#17086

Closed
Lamparter wants to merge 8 commits intofiles-community:mainfrom
Lamparter:cswin32/events
Closed

Code Quality: Replaced DllImport calls with CsWin32 generations for event object operations#17086
Lamparter wants to merge 8 commits intofiles-community:mainfrom
Lamparter:cswin32/events

Conversation

@Lamparter
Copy link
Contributor

@yair100 yair100 requested a review from 0x5bfa April 30, 2025 21:17
@yair100 yair100 added the ready for review Pull requests that are ready for review label Apr 30, 2025
@yair100
Copy link
Member

yair100 commented Apr 30, 2025

@Lamparter can you please fill out the template with the steps used to validate these changes?

Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM.

@Lamparter
Copy link
Contributor Author

@0x5bfa requesting your review

});

_ = CoWaitForMultipleObjects(
_ = Win32PInvoke.CoWaitForMultipleObjects(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure you should pin the array.

Win32PInvoke.CloseHandle(eventHandle);
unsafe
{
fixed (char* fileDialog = "FILEDIALOG")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pszEventObjectName please.

{
fixed (char* fileDialog = "FILEDIALOG")
{
HANDLE eventHandle = PInvoke.CreateEvent(bManualReset: false, bInitialState: false, lpName: fileDialog);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also hEventHandle please.

public static unsafe void RedirectActivationTo(AppInstance keyInstance, AppActivationArguments args)
{
IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null);
HANDLE eventHandle = PInvoke.CreateEvent(bManualReset: true, bInitialState: false, lpName: null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

public static unsafe void OpenFileFromTile(string filePath)
{
IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null);
HANDLE eventHandle = PInvoke.CreateEvent(bManualReset: true, bInitialState: false, lpName: null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

@yair100 yair100 requested a review from 0x5bfa May 9, 2025 15:10
@0x5bfa
Copy link
Member

0x5bfa commented May 9, 2025

I already did my reviews.

@Lamparter Lamparter force-pushed the cswin32/events branch 2 times, most recently from 52c8594 to 649b6fb Compare May 10, 2025 09:04
@yair100
Copy link
Member

yair100 commented May 15, 2025

@Lamparter can you please resolve the conflicts?

@0x5bfa
Copy link
Member

0x5bfa commented Jun 13, 2025

I recommend to close this PR, and let us handle this.

@yair100 yair100 force-pushed the main branch 2 times, most recently from 42c8207 to 4c7493f Compare July 6, 2025 15:16
@yair100 yair100 closed this Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Pull requests that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants