Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 30 15:28

    AArnott on pinvokegeneration

    Add support for `null` constants (compare)

  • Nov 30 05:13

    AArnott on addApis

    (compare)

  • Nov 30 05:13

    AArnott on master

    Add User32 `ChangeWindowMessage… Merge pull request #543 from do… (compare)

  • Nov 30 05:13
    AArnott closed #532
  • Nov 30 05:13
    AArnott closed #543
  • Nov 30 05:13
    AArnott closed #540
  • Nov 30 05:11

    AArnott on pinvokegeneration

    Add ability to generate constan… (compare)

  • Nov 30 03:47
    AArnott synchronize #543
  • Nov 30 03:47

    AArnott on addApis

    Add User32 `ChangeWindowMessage… (compare)

  • Nov 29 04:55

    AArnott on pinvokegeneration

    More TODO updates Improve scraping of structs wit… (compare)

  • Nov 29 03:34

    AArnott on pinvokegeneration

    Capture C# metadata for generat… Avoid using `nint` when under C… Update TODO comments and 1 more (compare)

  • Nov 28 20:40

    AArnott on pinvokegeneration

    Generate multiple files Unique assembly version for eac… Add option to generate just one… and 2 more (compare)

  • Nov 28 19:40

    AArnott on pinvokegeneration

    Change default to generating in… Rename `OneClass` setting to `C… Generate multiple files and 1 more (compare)

  • Nov 28 14:40

    AArnott on pinvokegeneration

    Add option sschema file Update NB.GV Expose public dependency on Sys… and 1 more (compare)

  • Nov 28 07:04

    AArnott on pinvokegeneration

    Update StyleCop for C# 9 Allow for json file to configur… (compare)

  • Nov 28 04:59

    AArnott on pinvokegeneration_metadataUpdate

    (compare)

  • Nov 28 04:58

    AArnott on pinvokegeneration

    Update metadata dll Generate our own fixed lengths … Generate COM interfaces and 19 more (compare)

  • Nov 28 04:58
    AArnott opened #543
  • Nov 28 04:41

    AArnott on addApis

    Add User32 `ChangeWindowMessage… (compare)

  • Nov 28 04:40
    AArnott closed #537
Johan Larsson
@JohanLarsson
Could not find any docs for it, ended up doing:
  1. SendInput(Move | Absolute) // restore cursor
  2. SendInput(LeftUp) // update focus
2 a massive hack
Andrew Arnott
@AArnott
And this was in lieu of a SetCursor method?
Johan Larsson
@JohanLarsson
No :D
Tried SetCursor also of course
This was in lieu of win32 knowledge :)
Johan Larsson
@JohanLarsson
Just fished a bit here in case someone knows win32 well.
Andrew Arnott
@AArnott
Care to do a code review for the cursor functions, @JohanLarsson ? AArnott/pinvoke#421
Johan Larsson
@JohanLarsson
Wrote a couple of comments but I don't know pinvoke well so probably mostly noise.
Andrew Arnott
@AArnott
Thanks. I made one change based on your comments.
Johan Larsson
@JohanLarsson
All looks good, I put a :thumbsup: on it, not sure if I should do anything more.
Andrew Arnott
@AArnott
Nothing more, thanks.
Johan Larsson
@JohanLarsson
Did a search for the -1 case but could not find it in the docs.
Andrew Arnott
@AArnott
Thanks. Finding it in the .h files themselves is good justification as well. There are sometimes .h constants defined that aren't documented online.
We can always add an enum value later. And in the meantime, someone could cast the enum to an int and check for -1 to get unblocked if it really does work.
Johan Larsson
@JohanLarsson
yep
Shimmy
@weitzhandler

Hi,
I'm unable to load the projects in VS 2019.
I'm getting this error in the Solution output:

The expression "[System.IO.Path]::GetDirectoryName('')" cannot be evaluated. The path is not of a legal form. C:\Users\Shimmy.nuget\packages\msbuild.sdk.extras\2.0.54\Sdk\Sdk.props
Please mention my name if you reply so I get notified.
Thank you!

What I wanna contribute is User32.EnumDisplaySettings, and maybe another few.
Shimmy
@weitzhandler
Please mention me with @ if/when you reply, so I get an email notification. Thanks.
Andrew Arnott
@AArnott
@weitzhandler Have you run the init script at the root of the repo? The easiest way to work is run init -installlocality machine from an elevated prompt.
Shimmy
@weitzhandler
Shimmy
@weitzhandler
Please update this to include information on how to trigger the analyzers to generate the shipped/unshipped stuff
Shimmy
@weitzhandler
When pressing Ctrl+period over the relevant items in code issuing the RS0016 warnings, I see no offer to apply auto-fix
Andrew Arnott
@AArnott
I'll look into that Ctrl+period not working. Thanks for reporting, @weitzhandler .
@weitzhandler: update complete: dotnet/pinvoke@b8977c1
Shimmy
@weitzhandler
You're awesome, thank you!
Shimmy
@weitzhandler
Where do structures from wingdi.h go? It's mainly used in User32, should I add them to this project?
In fact, the DISPLAY_DEVICE structure also belongs there. It's used by the EnumDisplayDevice function that was merged. I can move these structures to Gdi32, but we'll have to add a project dependency.
Shimmy
@weitzhandler
I see that Gdi32 rather depends on User32, so I'll keep them all in User32
Shimmy
@weitzhandler
From what I gather, the only dependency of Gdi32 on User32 is the SafeDCHandle. Isn't it something common that should be abstracted out to a lower level shared project?
Because really looking at the Windows API it seems User32 depends on Gdi32, not the other way around.
Another option would be including these interfaces in the Windows.Core lib?
Andrew Arnott
@AArnott
@weitzhandler Ya, these issues are little cumbersome to deal with in .NET assemblies. SafeDCHandle is defined in User32 because ReleaseDC is defined there.
I would tend to define structures from wingdi.h in Gdi32, and only move them into the User32 assembly if User32 needs access to these types.
Perhaps where there are structures that might get moved 'up' toward Windows.Core we should define them as top-level types in the PInvoke namespace instead of as a nested type. That would make 'promoting' them later much easier.
Shimmy
@weitzhandler
@AArnott thanks for your reply.
So where do you want me to create those interfaces (i.e. DEVMODE), in Windows? Or Gdi32 (which in case I'm gonna have to move the SafeDCHandle over, because currently Gdi32 references User32, not the other way around 🤔
Shimmy
@weitzhandler
Ok, I'm gonna start by adding them to the Windows.Core lib.
Vatsan Madhavan
@vatsan-madhavan

How do you deal with fns that have moved around from one apiset dll to another. For e.g., kernel32!FlushProcessWriteBuffers:

"Introduced into api-ms-win-core-processthreads-l1-1-2.dll in 10.0.10240. Moved into api-ms-win-core-processthreads-l1-1-3.dll in 10.0.10586. Moved into api-ms-win-core-processthreads-l1-1-2.dll in 10.0.14393. Moved into api-ms-win-core-processthreads-l1-1-0.dll in 10.0.16299."

When I looked at the exports, l1-1-0 had the export, but l1-1-2, l1-1-1 did not have the export (this was on recent Windows Insider Dev Branch build; so I guess the exports aren't preserved out of compat consideration etc.).

For reference, Win8/8.1 had this in api-ms-win-core-processthreads-l1-1-1.dll.

Andrew Arnott
@AArnott
@vatsan-madhavan I haven't noticed that they move around API sets like that, but I'd say let's keep them in the oldest location for Win8 apps so that they work everywhere, since I must assume Microsoft wouldn't release breaking changes.
Vatsan Madhavan
@vatsan-madhavan
:thumbsup:
Shimmy
@weitzhandler

Hi,
I don't know what I screwed up, but I'm unable to open any projects in VS2019.
I get the following error when running Init:

❯ .\init -installlocality machine
The netcore Credential Provider is already in C:\Users\Shimmy.nuget\plugins
Downloading .NET Core SDK 3.1.100...
Installing .NET Core SDK 3.1.100...
Downloading .NET Core 2.1...
Installing .NET Core 2.1...
Downloading .NET Core 2.1...
Installing .NET Core 2.1...
Restoring NuGet packages
D:\Users\Shimmy\Source\Repos\weitzhandler\pinvoke\src\BCrypt\BCrypt.csproj : warning MSB4242: The SDK resolver "NuGetSdkResolver" failed to run. Unable to find fallback package folder 'C:\Microsoft\Xamarin\NuGet\'.
Write-Error: Failure while restoring packages.

Any ideas?

This helped. Just had to create a dummy folder at that location
Shimmy
@weitzhandler
@AArnott
I started working on the DEVMODE structure (in Windows.Core).
Can you please have a look and tell me if I'm headed the right direction. Here's what I wrote.
I guess it'll all be chopped up into small files with DEVMODE_ prefixes (or you tell me how), but please compare my code to the actual DEVMODE.
I'll also format the enum comments etc. and make it look nice after I get some comments from you if this is how you'd want it to be.
Thank you!
Andrew Arnott
@AArnott
@weitzhandler Thanks for working on DEVMODE. Union structs are tricky. You'll need to use an Explicit layout in order for .NET to actually overlap fields over the same memory the way union structs do in native code.
Also, while I appreciate the extra structure you gave it (nested structs), it's beyond the original API and we generally aren't trying to improve on the original header file APIs. The precedent in this repo is that union structs simply contain every field as a flat list, exposing the overlapping members the same way the .h file does.
Shimmy
@weitzhandler
@AArnott The problem with these unions is that they contain identical fields, such as dmPosition.
Andrew Arnott
@AArnott
Those identical fields are placed in the same memory location though, I suspect. I checked and it's at least true for dmPosition. In C, there can't really be multiple identical fields because there would be no way to distinguish them. So while a single field may appear in multiple options in a union, it must be placed at exactly the same location so that it doesn't matter which one the user is thinking of when they access it.
Shimmy
@weitzhandler
@AArnott I need your help please, can you please read my commit or clone it to make that test pass? #510
Andrew Arnott
@AArnott
Done. See the PR for my comments.
Vatsan Madhavan
@vatsan-madhavan
Thought I'd leave a note that I'm still working on part-3 of #491 but haven't made much progress recently. I expect to get back to it slowly as my day-job lets up a bit :-).
Andrew Arnott
@AArnott
Sounds good, @vatsan-madhavan. Thanks for contributing.
I just submitted a significant enhancement to code-gen. We now have Span<T> and ReadOnlySpan<T> friendly overloads where any native pointer was that represented an array. The friendly overload even removes the "length" parameter as it takes it from the span.
Next up: #286 for string-friendly overloads. We almost don't need these with the span overloads already there, since .NET Core implicitly converts string to ReadOnlySpan<char>, but on .NET Framework it's still something of a mild pain.
Cristian Giagante
@cristiangiagante
hello everybody
Andrew Arnott
@AArnott
Hi @cristiangiagante