1 static MonoBundledAssembly **bundled;
2 int mono_main (int argc, char* argv[]);
9 my_inflate (const Byte *compr, uLong compr_len, Byte *uncompr, uLong uncompr_len)
14 memset (&stream, 0, sizeof (z_stream));
15 stream.next_in = (Byte *) compr;
16 stream.avail_in = (uInt) compr_len;
17 err = inflateInit (&stream);
22 stream.next_out = uncompr;
23 stream.avail_out = (uInt) uncompr_len;
24 err = inflate (&stream, Z_NO_FLUSH);
25 if (err == Z_STREAM_END) break;
32 err = inflateEnd (&stream);
36 if (stream.total_out != uncompr_len)
42 int main (int argc, char* argv[])
44 char **newargs = (char **) malloc (sizeof (char *) * (argc + 2));
46 CompressedAssembly **ptr;
47 MonoBundledAssembly **bundled_ptr;
51 newargs [0] = argv [0];
52 newargs [1] = image_name;
53 for (i = 1; i < argc; i++)
54 newargs [i+1] = argv [i];
57 if (config_dir != NULL && getenv ("MONO_CFG_DIR") == NULL)
58 mono_set_dirs (getenv ("MONO_PATH"), config_dir);
60 install_dll_config_files ();
62 ptr = (CompressedAssembly **) compressed;
64 while (*ptr++ != NULL)
67 bundled = (MonoBundledAssembly **) malloc (sizeof (MonoBundledAssembly *) * (nbundles + 1));
68 bundled_ptr = bundled;
69 ptr = (CompressedAssembly **) compressed;
70 while (*ptr != NULL) {
74 MonoBundledAssembly *current;
76 real_size = (*ptr)->assembly.size;
77 zsize = (*ptr)->compressed_size;
78 buffer = (Bytef *) malloc (real_size);
79 result = my_inflate ((*ptr)->assembly.data, zsize, buffer, real_size);
81 fprintf (stderr, "Error %d decompresing data for %s\n", result, (*ptr)->assembly.name);
84 (*ptr)->assembly.data = buffer;
85 current = (MonoBundledAssembly *) malloc (sizeof (MonoBundledAssembly));
86 memcpy (current, *ptr, sizeof (MonoBundledAssembly));
87 current->name = (*ptr)->assembly.name;
88 *bundled_ptr = current;
93 mono_register_bundled_assemblies((const MonoBundledAssembly **) bundled);
94 return mono_main (argc+1, newargs);