msi/tests: Skip the tests if we are unable to identify the user SID. This fixes crashes on Win9x.

Paul Vriens paul.vriens.wine at gmail.com
Tue Mar 18 09:29:26 CDT 2008


Francois Gouget wrote:
> ---
>  dlls/msi/tests/source.c |   50 ++++++++++++++++++++++++++++++++++++++--------
>  1 files changed, 41 insertions(+), 9 deletions(-)
> 
> diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c
> index 49e40c7..5f75159 100644
> --- a/dlls/msi/tests/source.c
> +++ b/dlls/msi/tests/source.c
> @@ -122,18 +122,22 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed)
>      WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
>  }
>  
> -static void get_user_sid(LPSTR *usersid)
> +static int get_user_sid(LPSTR *usersid)
>  {
>      HANDLE token;
>      BYTE buf[1024];
>      DWORD size;
>      PTOKEN_USER user;
> +    BOOL rc;
>  
> -    OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
> +    rc=OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
> +    if (!rc && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
> +        return 0;
>      size = sizeof(buf);
>      GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
>      user = (PTOKEN_USER)buf;
>      pConvertSidToStringSidA(user->User.Sid, usersid);
> +    return 1;
>  }
>  
>  static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
> @@ -186,7 +190,11 @@ static void test_MsiSourceListGetInfo(void)
>      }
>  
>      create_test_guid(prodcode, prod_squashed);
> -    get_user_sid(&usersid);
> +    if (!get_user_sid(&usersid))
> +    {
> +        skip("User SID not available -> skipping MsiSourceListGetInfoA tests\n");
> +        return;
> +    }
>  

Couldn't we just check for pConvertSidToStringSidA like we do in the msi.c tests 
(line 6039)?

-- 
Cheers,

Paul.



More information about the wine-devel mailing list