microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.32k stars 113 forks source link

Determine if we need to do something re: nonmoveable structures #1905

Open riverar opened 3 months ago

riverar commented 3 months ago

Pulled out of #1821 so we don't lose it.

CREDENTIALW is an interesting related case. It isn't empty in the metadata, nor should it be. But CredReadW returns a PCREDENTIALW that is important to not copy around. The original pointer is native allocated memory that must be freed via the original pointer. Further, the struct may point to addresses outside itself but within the same memory allocation. So it's important that projections not simply copy the struct and/or release the memory and expect the copy to be self-contained. I think these fall in with the native classes mentioned in the description, in that the metadata should be able to indicate that this type should never be dereferenced for purposes of copying around, as the original pointer is important.

Originally posted by @AArnott in https://github.com/microsoft/win32metadata/issues/1821#issuecomment-1917749940