Fix memory leak in `GetFileShares` by xtqqczze · Pull Request #25896 · PowerShell/PowerShell
We have no need to use
unsafecontext. In original definitionLPVOIDis used. It isIntPtrin C# ornint.
I suggest using an unmanaged pointer (void*) rather than nint.
LPVOID means "any pointer", not a handle. Mapping it to void* better reflects the native contract, whereas nint is more appropriate for handles or opaque values. This keeps the API surface closer to Win32 and clearer for maintainers.