diff options
| author | Petr Mrázek | 2011-11-03 02:40:49 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2011-11-03 02:40:49 +0100 |
| commit | a6eea1adfd60c7ff8f3af9bd88dd6b046a447d10 (patch) | |
| tree | e20b8666e9b06a40a0abd02fad35feedb5388d4c /library/Process-linux.cpp | |
| parent | dc629bc2519b216673b1ab2e378fd8d0055643cd (diff) | |
| download | dfhack-a6eea1adfd60c7ff8f3af9bd88dd6b046a447d10.tar.gz dfhack-a6eea1adfd60c7ff8f3af9bd88dd6b046a447d10.tar.bz2 dfhack-a6eea1adfd60c7ff8f3af9bd88dd6b046a447d10.tar.xz | |
More checks added to MD5.
Diffstat (limited to 'library/Process-linux.cpp')
| -rw-r--r-- | library/Process-linux.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index 59adeeeb..5fc110cc 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -40,6 +40,7 @@ using namespace std; #include "dfhack/VersionInfoFactory.h" #include "dfhack/VersionInfo.h" #include "dfhack/Error.h" +#include <string.h> using namespace DFHack; Process::Process(VersionInfoFactory * known_versions) @@ -54,8 +55,11 @@ Process::Process(VersionInfoFactory * known_versions) my_descriptor = 0; md5wrapper md5; + uint32_t length; + uint8_t first_kb [1024]; + memset(first_kb, 0, sizeof(first_kb)); // get hash of the running DF process - string hash = md5.getHashFromFile(exe_link_name); + string hash = md5.getHashFromFile(exe_link_name, length, (char *) first_kb); // create linux process, add it to the vector VersionInfo * vinfo = known_versions->getVersionInfoByMD5(hash); if(vinfo) @@ -71,6 +75,29 @@ Process::Process(VersionInfoFactory * known_versions) cerr << "File: " << exe_link_name << endl; cerr << "MD5: " << hash << endl; cerr << "working dir: " << wd << endl; + cerr << "length:" << length << endl; + cerr << "1KB hexdump follows:" << endl; + for(int i = 0; i < 64; i++) + { + fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", + first_kb[i*16], + first_kb[i*16+1], + first_kb[i*16+2], + first_kb[i*16+3], + first_kb[i*16+4], + first_kb[i*16+5], + first_kb[i*16+6], + first_kb[i*16+7], + first_kb[i*16+8], + first_kb[i*16+9], + first_kb[i*16+10], + first_kb[i*16+11], + first_kb[i*16+12], + first_kb[i*16+13], + first_kb[i*16+14], + first_kb[i*16+15] + ); + } free(wd); } } |
