[PATCH 02/11] [Kernel32]: ActCtx: Added infrastructure for loading a manifest (app,

Alexandre Julliard julliard at winehq.org
Thu May 10 05:09:53 CDT 2007


Eric Pouech <eric.pouech at wanadoo.fr> writes:

> +    hFile = CreateFileW(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
> +    if (hFile != INVALID_HANDLE_VALUE)
> +    {
> +        hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
> +        if (hMap != INVALID_HANDLE_VALUE)
> +        {

CreateFileMapping returns 0 on error.

> +            base = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
> +            if (base)
> +            {
> +                HANDLE      hModule = (HMODULE)(ULONG_PTR)base;
> +
> +                if (RtlImageNtHeader(hModule)) /* we got a PE file */
> +                {
> +                    if (first)
> +                    {
> +                        LPWSTR  manifestfile;
> +
> +                        manifestfile = HeapAlloc(GetProcessHeap(), 0,
> +                                                 lstrlenW(name) * sizeof(WCHAR) + sizeof(dotManifestW));
> +                        if (manifestfile)
> +                        {
> +                            strcpyW(manifestfile, name);
> +                            strcatW(manifestfile, dotManifestW);
> +                            ret = get_manifest_in_file(acl, ai, manifestfile,
> +                                                       resname, FALSE);
> +                            HeapFree(GetProcessHeap(), 0, manifestfile);
> +                        }
> +                    }
> +                    if (ret) ret = get_manifest_in_module(acl, ai, hModule, resname);

You cannot pretend that a file mapping is a module and call resource
functions on it. You have to use LOAD_LIBRARY_AS_DATAFILE for that.

I don't think this patch series is quite ready to go in; this is the
third resend and all patches still have obvious bugs. You need to
spend more time on it, this is kernel stuff, it needs to be correct.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list