[PATCH] combase: Use RtlGenRandom to generate apartment OXID

Huw Davies huw at codeweavers.com
Mon Mar 21 05:21:04 CDT 2022


On Mon, Mar 21, 2022 at 12:17:16AM -0400, Aaron Hill wrote:
> Currently, apartment OXIDs are generated using the process ID
> (and the thread ID for a single threaded-apartment). This means
> that if an apartment is destroyed and re-created (using
> `CoUninitialize` followed by `CoInitializeEx`), the newly created
> apartment will end up with the same OXID as the old apartment.
> 
> However, testing shows that Windows will generate a *new* OXID
> when an apartment is created in the above manner. Using
> RtlGenRandom makes our behavior more consistent with Windows -
> however, the actual OXIDs we generate will still differ
> from those of Windows.

This will ramdomly fail when the generated OXID matches
an existing one.  The correct fix is, as mentioned in the
comment, to generate it in rpcss.

Huw.



More information about the wine-devel mailing list