2009-07-07 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / metadata / pedump.c
index 9e773c072bb7aec9381e19b7622c8bbf9b86643f..83091fcbffb040c784e2584c45478f661c5b11b5 100644 (file)
@@ -450,6 +450,11 @@ verify_image_file (const char *fname)
        if (!mono_verifier_verify_table_data (image, &errors))
                goto invalid_image;
 
+       mono_image_load_names (image);
+
+       if (!mono_verifier_verify_full_table_data (image, &errors))
+               goto invalid_image;
+
        return 0;
 
 invalid_image:
@@ -659,7 +664,7 @@ main (int argc, char *argv [])
                mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
 
                res = verify_image_file (file);
-               if (res || !verify_pe)
+               if (res || !verify_code)
                        return res;
        }
 
@@ -673,10 +678,19 @@ main (int argc, char *argv [])
                dump_dotnet_iinfo (image);
        if (verify_pe) {
                MonoAssembly *assembly;
+               MonoImage *image;
+               MonoImageOpenStatus status;
 
                mono_verifier_set_mode (verifier_mode);
 
                assembly = mono_assembly_open (file, NULL);
+               /*fake an assembly for netmodules so the verifier works*/
+               if (!assembly && (image = mono_image_open (file, &status)) && image->tables [MONO_TABLE_ASSEMBLY].rows == 0) {
+                       assembly = g_new0 (MonoAssembly, 1);
+                       assembly->in_gac = FALSE;
+                       assembly->image = image;
+                       image->assembly = assembly;
+               }
 
                if (!assembly) {
                        g_print ("Could not open assembly %s\n", file);