Commit c3eda248 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

winedump: Use a switch in the generated DllMain().

parent 8c6dbc7a
...@@ -238,35 +238,30 @@ void output_c_preamble (void) ...@@ -238,35 +238,30 @@ void output_c_preamble (void)
fprintf (cfile, fprintf (cfile,
"BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID " "BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID "
"lpvReserved)\n{\n\tTRACE(\"(0x%%p, %%d, %%p)\\n\",hinstDLL," "lpvReserved)\n{\n"
"fdwReason,lpvReserved);\n\n\t" "\tTRACE(\"(0x%%p, %%d, %%p)\\n\", hinstDLL, fdwReason, lpvReserved);\n"
"if (fdwReason == DLL_WINE_PREATTACH) return FALSE;\t" "\n\tswitch (fdwReason)\n\t{\n"
"/* prefer native version */\n\n\t" "\t\tcase DLL_WINE_PREATTACH:\n"
"if (fdwReason == DLL_PROCESS_ATTACH)\n\t{\n\t\t"); "\t\t\treturn FALSE; /* prefer native version */\n"
"\t\tcase DLL_PROCESS_ATTACH:\n");
if (globals.forward_dll) if (globals.forward_dll)
{ fprintf (cfile, "\t\t\thDLL = LoadLibraryA(\"%s\");\n"
fprintf (cfile, "\t\t\tTRACE(\"Forwarding DLL (%s) loaded (%%p)\\n\", hDLL);\n",
"hDLL = LoadLibraryA( \"%s\" );\n\t\t"
"TRACE(\":Forwarding DLL (%s) loaded (%%ld)\\n\",(LONG)hDLL);",
globals.forward_dll, globals.forward_dll); globals.forward_dll, globals.forward_dll);
}
else else
fputs ("/* FIXME: Initialisation */", cfile); fprintf (cfile, "\t\t\t/* FIXME: Initialisation */\n"
"\t\t\tDisableThreadLibraryCalls(hinstDLL);\n\t\t\tbreak;\n");
fputs ("\n\t}\n\telse if (fdwReason == DLL_PROCESS_DETACH)\n\t{\n\t\t", fprintf (cfile, "\t\t\tbreak;\n\t\tcase DLL_PROCESS_DETACH:\n");
cfile);
if (globals.forward_dll) if (globals.forward_dll)
{ fprintf (cfile, "\t\t\tFreeLibrary(hDLL);\n"
fprintf (cfile, "\t\t\tTRACE(\"Forwarding DLL (%s) freed\\n\");\n",
"FreeLibrary( hDLL );\n\t\tTRACE(\":Forwarding DLL (%s)" globals.forward_dll);
" freed\\n\");", globals.forward_dll);
}
else
fputs ("/* FIXME: Cleanup */", cfile);
fputs ("\n\t}\n\n\treturn TRUE;\n}\n\n\n", cfile); fprintf (cfile, "\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n"
"\treturn TRUE;\n}\n\n\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment