#include "image.h"
#include <glib.h>
#include "cil-coff.h"
-#include "private.h"
#include "mono-endian.h"
#include "verify.h"
#include <mono/metadata/class.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/metadata-internals.h>
+#include <mono/metadata/rawbuffer.h>
+#include <mono/metadata/class-internals.h>
+#include "mono/utils/mono-digest.h"
gboolean dump_data = TRUE;
gboolean verify_pe = FALSE;
printf ("\t%s: 0x%08x [0x%08x]\n", label, de.rva, de.size);
}
+static void
+dump_blob (const char *desc, const char* p, guint32 size)
+{
+ int i;
+
+ printf ("%s", desc);
+ if (!p) {
+ printf (" none\n");
+ return;
+ }
+
+ for (i = 0; i < size; ++i) {
+ if (!(i % 16))
+ printf ("\n\t");
+ printf (" %02X", p [i] & 0xFF);
+ }
+ printf ("\n");
+}
+
+static void
+dump_public_key (MonoImage *m)
+{
+ guint32 size;
+ const char *p;
+
+ p = mono_image_get_public_key (m, &size);
+ dump_blob ("\nPublic key:", p, size);
+}
+
+static void
+dump_strong_name (MonoImage *m)
+{
+ guint32 size;
+ const char *p;
+
+ p = mono_image_get_strong_name (m, &size);
+ dump_blob ("\nStrong name:", p, size);
+}
+
static void
dump_datadir (MonoPEDatadir *dd)
{
printf ("\n");
printf (" CLI header size: %d\n", ch->ch_size);
printf (" Runtime required: %d.%d\n", ch->ch_runtime_major, ch->ch_runtime_minor);
- printf (" Flags: %s, %s, %s\n",
+ printf (" Flags: %s, %s, %s, %s\n",
(ch->ch_flags & CLI_FLAGS_ILONLY ? "ilonly" : "contains native"),
(ch->ch_flags & CLI_FLAGS_32BITREQUIRED ? "32bits" : "32/64"),
- (ch->ch_flags & CLI_FLAGS_ILONLY ? "trackdebug" : "no-trackdebug"));
+ (ch->ch_flags & CLI_FLAGS_ILONLY ? "trackdebug" : "no-trackdebug"),
+ (ch->ch_flags & CLI_FLAGS_STRONGNAMESIGNED ? "strongnamesigned" : "notsigned"));
dent (" Metadata", ch->ch_metadata);
hex32 ("Entry Point Token", ch->ch_entry_point);
dent (" Resources at", ch->ch_resources);
{
printf ("%s: 0x%08x - 0x%08x [%d == 0x%08x]\n",
label,
- sh->data - meta->raw_metadata, sh->data + sh->size - meta->raw_metadata,
+ (int)(sh->data - meta->raw_metadata), (int)(sh->data + sh->size - meta->raw_metadata),
sh->size, sh->size);
}
dump_metadata_ptrs (meta);
printf ("Rows:\n");
- for (table = 0; table < 64; table++){
+ for (table = 0; table < MONO_TABLE_NUM; table++){
if (meta->tables [table].rows == 0)
continue;
printf ("Table %s: %d records (%d bytes, at %p)\n",
dump_dotnet_header (&iinfo->cli_header);
dump_sections (iinfo);
dump_cli_header (&iinfo->cli_cli_header);
+ dump_strong_name (image);
+ dump_public_key (image);
dump_metadata (image);
dump_methoddef (image, iinfo->cli_cli_header.ch_entry_point);
errors = mono_method_verify (method, flags);
if (errors) {
char *sig;
- sig = mono_signature_get_desc (method->signature, FALSE);
- g_print ("In method: %s.%s::%s(%s)\n", method->klass->name_space, method->klass->name, method->name, sig);
+ MonoClass *klass = mono_method_get_class (method);
+ sig = mono_signature_get_desc (mono_method_signature (method), FALSE);
+ g_print ("In method: %s.%s::%s(%s)\n", mono_class_get_namespace (klass), mono_class_get_name (klass), mono_method_get_name (method), sig);
g_free (sig);
}
if (!file)
usage ();
+ mono_metadata_init ();
+ mono_raw_buffer_init ();
+ mono_images_init ();
+ mono_assemblies_init ();
+ mono_loader_init ();
+
image = mono_image_open (file, NULL);
if (!image){
fprintf (stderr, "Can not open image %s\n", file);
mono_init (file);
assembly = mono_assembly_open (file, NULL);
dump_verify_info (assembly->image, f);
- }
-
- mono_image_close (image);
+ } else
+ mono_image_close (image);
return 0;
}