[PATCH] hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName().

Zebediah Figura zfigura at codeweavers.com
Mon Jun 25 10:02:10 CDT 2018


On 25/06/18 08:20, Nikolay Sivov wrote:
> On 06/25/2018 06:46 AM, Zebediah Figura wrote:
> 
>> Should hopefully fix test failures on Windows.
>>
>> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
>> ---
>>   dlls/hnetcfg/apps.c         | 17 ++++++++++++-----
>>   dlls/hnetcfg/tests/policy.c |  5 ++++-
>>   2 files changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
>> index 34ef108..fe47721 100644
>> --- a/dlls/hnetcfg/apps.c
>> +++ b/dlls/hnetcfg/apps.c
>> @@ -268,7 +268,7 @@ static HRESULT WINAPI
>> fw_app_put_ProcessImageFileName(
>>   {
>>       fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
>>       UNIVERSAL_NAME_INFOW *info;
>> -    WCHAR *netpath;
>> +    WCHAR *path;
>>       DWORD res;
>>       DWORD sz;
>>   @@ -281,22 +281,29 @@ static HRESULT WINAPI
>> fw_app_put_ProcessImageFileName(
>>       res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL,
>> NULL, &sz);
>>       if (res == WN_MORE_DATA)
>>       {
>> -        if (!(netpath = heap_alloc(sz)))
>> +        if (!(path = heap_alloc(sz)))
>>               return E_OUTOFMEMORY;
>>   -        info = (UNIVERSAL_NAME_INFOW *)&netpath;
>> +        info = (UNIVERSAL_NAME_INFOW *)&path;
>>           res = WNetGetUniversalNameW(image,
>> UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
>>           if (res == NO_ERROR)
>>           {
>>               SysFreeString(This->filename);
>>               This->filename = SysAllocString(info->lpUniversalName);
>>           }
>> -        heap_free(netpath);
>> +        heap_free(path);
>>           return HRESULT_FROM_WIN32(res);
>>       }
>>   +    sz = GetFullPathNameW(image, 0, NULL, NULL);
>> +    if (!(path = heap_alloc(++sz)))
>> +        return E_OUTOFMEMORY;
>> +
>> +    GetFullPathNameW(image, sz, path, NULL);
> 
> ...
> 
>>
>>   +    GetFullPathNameW(image, sizeof(fullpath), fullpath, NULL);
> ...
> 
> This one takes character length I think, not byte length.
> 
> 

Thanks for the catch; resent.



More information about the wine-devel mailing list