- May
- 13,199
- 180
I wrote a little EXE to do a version of "TYPE /X". This loop is at its heart:
while ( ReadFile(hFileIn, buf, 16, &dwRead, NULL) && dwRead )
{
Printf(L"%08.8X ", 16 * dwCount++);
for ( i=0; i<dwread; i++="" )="">
Printf(L"%02.2X ", buf);
dwPad = 49 - 3 * dwRead;
wsprintf(szFormat, L"%%%lu.%lus", dwPad, dwPad);
Printf(szFormat, L"");
for ( i=0; i<dwread; i++="" )="">
{
if ( buf > 31 && buf < 128 )
Printf(L"%c", buf);
else
Printf(L".");
}
Printf(L"\r\n");
}
<dwread; i++="" )=""><dwread; i++="" )=""><dwread; i++="" )=""><dwread; i++="" )="">
<dwread; i++="" )=""><dwread; i++="" )="">When I use TCC to run the EXE on EXPLORER.EXE (1.1MB) and redirect the output to a file, it takes about 1/2 sec. When I make that routine into a plugin function (only change needed is wprintf() to Printf()) the same task takes about 40 sec. Why the big difference? I've never seen that with other plugin functions I've written. I figure I've got something wrong.
Notice how pasting the code into vBulletin, even with CODE tags removes characters from my "for" statements! Buth should also contain: i (less) dwRead; i++ ).
</dwread;></dwread;></dwread;></dwread;></dwread;></dwread;></dwread;></dwread;>
while ( ReadFile(hFileIn, buf, 16, &dwRead, NULL) && dwRead )
{
Printf(L"%08.8X ", 16 * dwCount++);
for ( i=0; i<dwread; i++="" )="">
Printf(L"%02.2X ", buf);
dwPad = 49 - 3 * dwRead;
wsprintf(szFormat, L"%%%lu.%lus", dwPad, dwPad);
Printf(szFormat, L"");
for ( i=0; i<dwread; i++="" )="">
{
if ( buf > 31 && buf < 128 )
Printf(L"%c", buf);
else
Printf(L".");
}
Printf(L"\r\n");
}
<dwread; i++="" )=""><dwread; i++="" )=""><dwread; i++="" )=""><dwread; i++="" )="">
<dwread; i++="" )=""><dwread; i++="" )="">When I use TCC to run the EXE on EXPLORER.EXE (1.1MB) and redirect the output to a file, it takes about 1/2 sec. When I make that routine into a plugin function (only change needed is wprintf() to Printf()) the same task takes about 40 sec. Why the big difference? I've never seen that with other plugin functions I've written. I figure I've got something wrong.
Notice how pasting the code into vBulletin, even with CODE tags removes characters from my "for" statements! Buth should also contain: i (less) dwRead; i++ ).
</dwread;></dwread;></dwread;></dwread;></dwread;></dwread;></dwread;></dwread;>