[1/2] imagehlp/tests: Add test for BindImageEx (try 12)

Alexandre Julliard julliard at winehq.org
Thu Jul 24 11:33:28 CDT 2014


Bernhard Reiter <ockham at raz.or.at> writes:

> @@ -31,6 +31,8 @@
>  static HMODULE hImageHlp;
>  
>  static BOOL (WINAPI *pImageGetDigestStream)(HANDLE, DWORD, DIGEST_FUNCTION, DIGEST_HANDLE);
> +static BOOL (WINAPI *pBindImageEx)(DWORD Flags, const char *ImageName, const char *DllPath,
> +                                   const char *SymbolPath, void *StatusRoutine);

That's not the correct prototype.

> +static BOOL WINAPI testing_status_routine(IMAGEHLP_STATUS_REASON reason, char *ImageName,
> +                                          char *DllName, ULONG_PTR Va, ULONG_PTR Parameter)
> +{
> +    char kernel32_path[MAX_PATH];
> +
> +    status_routine_called[reason]++;

This will have nasty results if you get an unexpected code.

> +        default:
> +            ok(0, "expected reason to be one of BindImportModule, BindImportProcedure, or "
> +               "BindForwarderNOT, got %d\n", reason);

Please simplify your error messages. In particular, this one would need
to be changed every time the test is expanded, that's not a good idea.

> +static void test_bind_image_ex(void)
> +{
> +    BOOL ret;
> +    HANDLE file;
> +    char temp_file[MAX_PATH] = "nonexistant.dll";

There's no reason to use a variable for this.

> +    /* Under 64 bit images of Vista Ultimate, 2008 Server, and 7 Pro, StatusRoutine is called with
> +     * reason BindForwarderNOT instead of BindImportProcedure. */
> +    todo_wine ok((status_routine_called[BindImportProcedure] == 1) ||
> +                 (status_routine_called[BindForwarderNOT] == 1),
> +                 "Expected StatusRoutine to be called once with reason BindImportProcedure or "
> +                 "BindForwarderNOT, but it was called %d and %d times, respectively\n",
> +                 status_routine_called[BindImportProcedure], status_routine_called[BindForwarderNOT]);

You'd most likely want the test to depend on 32/64-bit instead of always
accepting both.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list