Aw: Re: [PATCH 1/2] shell32: Add a basic implementation for SHGetStockIconInfo

Detlef Riekenberg wine.dev at web.de
Fri Feb 8 04:11:10 CST 2013


Dimitry wrote:

>> +/****************************************************************************
>> + * helper for SHGetStockIconInfo
>> + */
>> +typedef struct stockiconentry_t {
>> + SHSTOCKICONID id;
>> + DWORD iconid;
>> +} stockiconentry;

>Why bother with a typedef?

I prefer typedef to reduce a bit of typing.
Changed here, to make you happy and to feel the difference.

>> +static stockiconentry stockicontable[] = {
>> + {SIID_DOCNOASSOC, IDI_SHELL_DOCUMENT},

>Please don't forget to add 'const'.

Done. Thanks

>> +static int cmp_stockiconentry(const void *entry1, const void *entry2)
>> +{
>> + stockiconentry *p1 = (stockiconentry *) entry1;
>> + stockiconentry *p2 = (stockiconentry *) entry2;
>> +
>> + return p1->id - p2->id;
>> +}

> Don't cast away 'const'.

Fixed. Thanks

>> +HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO *sii)
...
>> + GetModuleFileNameW(shell32_hInstance, sii->szPath, MAX_PATH);

> GetModuleFileNameW can fail, so filling 'sii' may be a bit premature.

What is the failure case???
The module-handle, the target buffer pointer and the buffer size are valid.
A path longer as MAX_PATH for shell32.dll is not supported in windows.

-- 
By by ... Detlef





More information about the wine-devel mailing list