Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

fix(device): Report Device architecture or Null if it cannot reliably#247

Merged
bruno-garcia merged 1 commit into
developfrom
fix/device-arch
May 2, 2018
Merged

fix(device): Report Device architecture or Null if it cannot reliably#247
bruno-garcia merged 1 commit into
developfrom
fix/device-arch

Conversation

@bruno-garcia

Copy link
Copy Markdown
Member

Resolves #245

@bruno-garcia bruno-garcia requested review from asbjornu and jan-auer May 1, 2018 17:29
@bruno-garcia bruno-garcia self-assigned this May 1, 2018
@bruno-garcia bruno-garcia added this to the 3.0.0 milestone May 1, 2018

[DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWow64Process([In] IntPtr hProcess, [Out] out bool wow64Process);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this just silently fail and return null on Mono?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On Windows it should work. On non-Windows it returns false.

P/Invoke calls return false if they fail. We can set SetLastError = true which allows us to get it via Marshal.GetLastWin32Error but I thought it's not worth making another platform call to find out why it was not possible to get the value. If it fails to get it, we return null and don't report any Arch.

@bruno-garcia bruno-garcia merged commit 309a536 into develop May 2, 2018
@bruno-garcia bruno-garcia deleted the fix/device-arch branch May 11, 2018 08:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants