[Selfext-user] SFX protection
Brought to you by:
mweth
|
From: Ho K. L. <ywc...@ho...> - 2003-09-12 23:41:55
|
<html><div style='background-color:'><DIV>
<P>Last night I've decided that removing 4 bytes is too much of a hassle because it requires the offset to be corrected at later Fileread incidents, so instead I've not altered the cabinet size, instead changing the first byte from 'M' to a NULL. This is enough to trick other archivers :)</P>
<P>This is the working code that I've got after struggling for a whole night.. (g_iExeSize is the size of the EXE file, while g_bMutant is a BOOL which is true when we are dealing with the "mutant cabinet" (the Cabinet with a NULL in the first char))</P>
<P>By the way... is there a way that I can extract data directly to memory or to a buffer instead of writing it physically to the disk? (Because the data is not supposed to be known by the user, it's for the SFX's internal use)</P>
<P>I'd be glad if you can help me~ </P>
<P>Kei</P>
<P>
<HR>
</P>
<P><FONT face="Courier New, Courier, Monospace" size=2>FNREAD(file_read)<BR>{ <BR> DWORD rslt;<BR> int iPos = SetFilePointer(GetHandle(hf), 0, 0, FILE_CURRENT);<BR> if(iPos==g_iExeSize && g_bMutant)<BR> {<BR> char* cTmp = (char*) pv;<BR> ReadFile(GetHandle(hf), cTmp, cb, &rslt, NULL); <BR> cTmp[0]='M';<BR> return (rslt);</FONT></P>
<P><FONT face="Courier New, Courier, Monospace" size=1><FONT size=2> } else<BR> {<BR> ReadFile(GetHandle(hf), pv, cb, &rslt, NULL); <BR> return rslt; <BR> }<BR>}</FONT><BR></FONT></P>
<P><BR><BR> </P></DIV></div><br clear=all><hr>Add photos to your messages with <a href="http://g.msn.com/8HMCEN/2749??PS=">MSN 8. </a> Get 2 months FREE*.</html>
|