https://bugs.winehq.org/show_bug.cgi?id=37185
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net
--- Comment #10 from Anastasius Focht focht@gmx.net --- Hello folks,
thanks for the email Bruno to interrupt my coffee break ... j/k :)
--- quote --- The bug is: Why when running in Wine a crazy GUID is passed to DirectPlayCreate? --- quote ---
The game provided SP enum callback does something stupid: instead of copying the service provider GUID it stores the address in an internal structure for later use. Actually it's an array of structures, with 'IPX' structure entry being indexed.
The GUID variable lives on stack within DirectPlayEnumerateAW() context so the data only remains valid during the enumerate API call.
Source: http://source.winehq.org/git/wine.git/blob/7e17eec75005e0e1c16b9b56422544246...
--- snip --- 5768 static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA, 5769 LPDPENUMDPCALLBACKW lpEnumCallbackW, 5770 LPVOID lpContext) 5771 { ... 5803 /* Traverse all the service providers we have available */ 5804 dwIndex = 0; 5805 while (1) 5806 { 5807 WCHAR subKeyName[255]; /* 255 is the maximum key size according to MSDN */ 5808 DWORD sizeOfSubKeyName = sizeof(subKeyName) / sizeof(WCHAR); 5809 HKEY hkServiceProvider; 5810 GUID serviceProviderGUID; 5811 WCHAR guidKeyContent[(2 * 16) + 1 + 6 /* This corresponds to '{....-..-..-..-......}' */ ]; 5812 DWORD sizeOfGuidKeyContent = sizeof(guidKeyContent); 5813 LONG ret_value; ... 5845 CLSIDFromString(guidKeyContent, &serviceProviderGUID ); ... 5853 if (lpEnumCallbackA) 5854 { 5855 DWORD sizeOfDescription = 0; 5856
5873 if (!lpEnumCallbackA(&serviceProviderGUID, descriptionA, 6, 0, lpContext)) 5874 goto end; ... --- snip ---
This obviously can't work with code that makes the assumption that the address and the referenced content is still accessible outside of DirectPlayEnumerateAW() context.
Since the data is read from registry and not very "dynamic" during runtime, it's probably fine to retrieve and store it upon dplay creation (heap, list) to be returned in DirectPlayEnumerateAW(). This also avoids the registry queries each time DirectPlayEnumerateAW() is getting called.
Regards