diff --git a/ntsys b/ntsys index 16a9426..73d2a05 100755 Binary files a/ntsys and b/ntsys differ diff --git a/ntsys.h b/ntsys.h index 247e4ff..6e76e9b 100644 --- a/ntsys.h +++ b/ntsys.h @@ -26,6 +26,10 @@ #define NTSYS_VERSION "1.0" +#define NAME_OF_32_BITS_TYPE unsigned int +#define NAME_OF_64_BITS_TYPE unsigned long int +#define NAME_OF_16_BITS_TYPE unsigned short int + #include #include #include @@ -61,6 +65,10 @@ static void __help(void) { ); } +static int __exe_run(__e_byte_t* memory, unsigned int memorysize, unsigned long filesize, FILE* fp) { + return EXIT_SUCCESS; +} + int ntsys_api_call(char* filename) { /* File data */ @@ -105,14 +113,19 @@ int ntsys_api_call(char* filename) { ntsys_error("Header read error or digital signature is invalid!"); return EXIT_FAILURE; } - - /* - * printf("Filesize: %d bytes\n", *((unsigned short int*)head.e_filesize)); - * printf("Memorysize: %d bytes\n", *((unsigned short int*)head.e_memorysize)); - */ - - - return EXIT_SUCCESS; + unsigned long int filesize = 0; + switch (4) { + case sizeof(NAME_OF_64_BITS_TYPE): filesize = *((NAME_OF_64_BITS_TYPE*)head.e_filesize); break; + case sizeof(NAME_OF_32_BITS_TYPE): filesize = *((NAME_OF_32_BITS_TYPE*)head.e_filesize); break; + default: + ntsys_error("Unknown data type! You must recompile the program and specify a different type."); + return EXIT_FAILURE; + } + __e_byte_t* memory = malloc(*((NAME_OF_16_BITS_TYPE*)head.e_memorysize)); + int stat = __exe_run(memory, (unsigned int)*((NAME_OF_16_BITS_TYPE*)head.e_memorysize), filesize, fp); + fclose(fp); + free(memory); + return stat; } int ntsys_compile_asm(char* in_file, char* out_file) {