[PATCH] crypt32/tests: Use GetWindowsDirectoryA instead of GetEnvironmentVariableA to avoid a test failure.

Zebediah Figura z.figura12 at gmail.com
Fri Nov 8 15:59:57 CST 2019


On 11/8/19 3:54 PM, Sven Baars wrote:
> Signed-off-by: Sven Baars <sven.wine at gmail.com>
> ---
>   dlls/crypt32/tests/sip.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 

As far as I see this only happens on Wine, and only on one machine. So 
while this code is simpler and probably more desirable anyway, "to avoid 
a test failure" is probably not a good reason for it.

> diff --git a/dlls/crypt32/tests/sip.c b/dlls/crypt32/tests/sip.c
> index d8d6a87445..f0849219f5 100644
> --- a/dlls/crypt32/tests/sip.c
> +++ b/dlls/crypt32/tests/sip.c
> @@ -145,8 +145,6 @@ static void test_SIPRetrieveSubjectGUID(void)
>       BOOL ret;
>       GUID subject;
>       HANDLE file;
> -    static const CHAR windir[] = "windir";
> -    static const CHAR regeditExe[] = "regedit.exe";
>       static const GUID nullSubject  = { 0x0, 0x0, 0x0, { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 }};
>       static const WCHAR deadbeef[]  = { 'c',':','\\','d','e','a','d','b','e','e','f','.','d','b','f',0 };
>       /* Couldn't find a name for this GUID, it's the one used for 95% of the files */
> @@ -183,10 +181,9 @@ static void test_SIPRetrieveSubjectGUID(void)
>        *
>        * Use A-functions where possible as that should be available on all platforms
>        */
> -    ret = GetEnvironmentVariableA(windir, regeditPath, MAX_PATH);
> -    ok (ret > 0, "expected GEVA(windir) to succeed, last error %d\n", GetLastError());
> -    strcat(regeditPath, "\\");
> -    strcat(regeditPath, regeditExe);
> +    ret = GetWindowsDirectoryA(regeditPath, MAX_PATH-12);
> +    ok (ret > 0, "Expected GetWindowsDirectoryA to succeed, last error %d\n", GetLastError());
> +    strcat(regeditPath, "\\regedit.exe");
>       MultiByteToWideChar(CP_ACP, 0, regeditPath, strlen(regeditPath)+1, regeditPathW,
>                           ARRAY_SIZE(regeditPathW));
>   
> 




More information about the wine-devel mailing list