c# - Assembly.Load won't Invoke entrypoint on decrypted byte[] (exe), but will if from raw exe in resource, same MD5, what is the error? -
this code works
[stathread] static void main() { assembly psrja = assembly.load(properties.resources.original ); psrja.entrypoint.invoke(null, null); } but when encrypting or compressing same byte[] stalls cpu , hangs or exits, md5 of both of final executed exe's same did file.write on decrypted exe , tested them both, reason wont invoke on decrypted wrong it?
example of process hang (not working)
[stathread] static void main() { assembly psrja = assembly.load(decompressgzip(properties.resources.gzippedfile)); psrja.entrypoint.invoke(null, null); } public static byte[] decompressgzip(byte[] bytestodecompress) { using (gzipstream stream = new gzipstream(new memorystream(bytestodecompress), compressionmode.decompress)) { const int size = 4096; byte[] buffer = new byte[size]; { } using (memorystream memorystream = new memorystream()) { int count; { count = stream.read(buffer, 0, size); if (count > 0) { memorystream.write(buffer, 0, count); } } while (count > 0); return memorystream.toarray(); } } }
Comments
Post a Comment