#include "stdafx.h" #include "protect_info.h" #include "util_path.hpp" #include "util_path.hpp" /* struct enc_info { CString major; CString minor; CString type; CString version; CString brand; }; */ #include "util_file.hpp" int get_file_information(const char* path, enc_info* info) { FILE* fp = fopen(path, "rb"); if(fp == NULL) return -1; int size = get_file_size(fp); char* buf = new char[size]; fread(buf, 1, size, fp); fclose(fp); int hr = get_file_information_from_memory(buf, info); info->path = path; if(hr <= 0) return hr -10; return 1; } int get_file_information_from_memory(char* buf, enc_info* info) { char major[5]; char minor[5]; char type[5]; char version[20+1]; // 8 ÀÚ¸®¿¡¼­ 20ÀÚ¸®·Î º¯°æ - cjy, 08_0403 17:08 char company_name[17]; memset(version, 0, sizeof(version)); int pp = 0; memcpy(major, buf+pp, 4); major[4] = 0; pp += 4; memcpy(minor, buf+pp, 4); minor[4] = 0; pp += 4; memcpy(type, buf+pp, 4); type[4] = 0; pp += 4; memcpy(version, buf+pp, 8); //version[8] = 0; - cjy, 08_0407 16:42 pp += 8; memcpy(company_name, buf+pp, 16); company_name[16] = 0; pp += 16; pp += 16; // reversed space // ¹öÁ¯ ±æÀ̱â 8ÀÚ¸®¿¡¼­ 20ÀÚ¸®·Î ´Ã¾î³µ´Ù. - cjy, 08_0407 16:41 memcpy(version+8, buf+pp, 12); // - cjy, 08_0403 17:08 pp += 12; // save data info->major = major; info->minor = minor; info->type = type; info->version = version; // info->version2 = version2; // - cjy, 08_0403 17:08 info->company_name = company_name; return 1; }