cleanup a->w cross calls in advapi32/crypt.c

Dmitry Timoshkov dmitry at baikal.ru
Thu Jul 29 23:36:05 CDT 2004


"James Hawkins" <truiken at gmail.com> wrote:

> This is a resubmit of my original patch that cleans up a->w cross
> calls in crypt.
> 
> Changelog
>     * cleanup a->w cross calls in advapi32/crypt.c

> + static const WCHAR KEYSTR[] = {
> +  'S','o','f','t','w','a','r','e','\\','\\',
> +         'M','i','c','r','o','s','o','f','t','\\','\\',
> +  'C','r','y','p','t','o','g','r','a','p','h','y','\\','\\',
> +  'D','e','f','a','u','l','t','s','\\','\\',
> +  'P','r','o','v','i','d','e','r','\\','\\',0
> + };

Remove double backslashes here and everywhere else.

> - keyname = CRYPT_Alloc(strlen(KEYSTR) + strlen(pProvName) +1);
> + keyname = CRYPT_Alloc(strlenW(KEYSTR) + strlenW(pProvName) + 1);

Add '* sizeof(WCHAR)' and everywhere else where storage for unicode
strings is allocated.

> - keyname = CRYPT_Alloc( (user ? strlen(USERSTR) : strlen(MACHINESTR)) +1);
> + keyname = CRYPT_Alloc( (user ? strlenW(USERSTR) : strlenW(MACHINESTR)) +1);

Add '* sizeof(WCHAR)'

> + static WCHAR nameW[] = {'N','a','m','e',0};
> + static WCHAR typeW[] = {'T','y','p','e',0};
> + static WCHAR imagePathW[] = {'I','m','a','g','e',' ','P','a','t','h',0};
> + static WCHAR signatureW[] = {'S','i','g','n','a','t','u','r','e',0};
> + static WCHAR sigInFileW[] = {'S','i','g','I','n','F','i','l','e',0};

Add 'const'.
 
> -  if ( !(provname = CRYPT_Alloc(strlen(pszProvider) +1)) )
> +  if ( !(provname = CRYPT_Alloc(strlenW(pszProvider) +1)) )

Add '* sizeof(WCHAR)'

> - len = ExpandEnvironmentStringsA(temp, NULL, 0);
> + len = ExpandEnvironmentStringsW(temp, NULL, 0);
>   if ( !(imagepath = CRYPT_Alloc(len)) )

Add '* sizeof(WCHAR)'

...
And lots of similar bugs.

-- 
Dmitry.




More information about the wine-devel mailing list