Implemented retrieval of szDeviceIdentifier property in dxdiagn

Vitaliy Margolen wine-devel at kievinfo.com
Fri Jan 2 16:30:44 CST 2009


Markus wrote:

Few problems with your patch:

> +    IDirect3D9             *(WINAPI *pDirect3DCreate9)(UINT) = NULL;
> +    IDirect3D9             *pD3d = NULL;
No need to initialize something you'll assign to anyway.

> +    d3d9_handle = LoadLibraryA( "d3d9.dll" );
You need to unload it when you done.

> +    memset(&adapter_ident, 0, sizeof(adapter_ident));
No need to clear this structure.

> +        StringFromGUID2(&adapter_ident.DeviceIdentifier, adapter_ident_str, 39);
Why don't you put it directly into szIdentifierBuffer?

> +        memcpy( szIdentifierBuffer, adapter_ident_str, sizeof(adapter_ident_str) * sizeof(WCHAR) );
sizeof() gives size in bytes. You don't need to multiply it by sizeof(WCHAR).

> +    WCHAR                   deviceIdentBuffer[256];
First why 256 if all you need is 39? Second, why do you need it at all?
There is already "buffer" which is big enough.

> +    DXDiag_GetDisplayDeviceIdentifier( &deviceIdentBuffer );
You don't need to take a reference from array. It's already a pointer
(remove "&"). Any time you pass array like that you should also pass it's size.


Vitaliy.



More information about the wine-devel mailing list