D3D8_GetCreationParameters fix

Mike Hearn mike at navi.cx
Thu Jul 8 17:10:16 CDT 2004


On Thu, 08 Jul 2004 18:58:57 -0400, Andrei Barbu wrote:
> It doesn't have to return that memory, DX functions work by taking
> parameters they modify. In essence, that's the point, modifying
> pParameters and returning D3D_OK

Right, what he means is that the parameter is basically a pointer to a
pointer, so you have this:

HRESULT SomeFunc(void **output) {
	
	output = HeapAlloc(GetProcessHeap(), 0, sizeof(whatever)); 
	// that is wrong, as you are just modifying a local argument. 
	// the pointer to the new memory will be lost when the function exits

	*output = HeapAlloc(GetProcessHeap(), 0, sizeof(whatever));
	// that's right, as you're now assigning to the location pointed
	// to by output

}

thanks -mike




More information about the wine-devel mailing list