Plugin question

May 20, 2008
11,385
99
Syracuse, NY, USA
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;>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
vefatica wrote:
...
| 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++ ).

... and when delivered as email, the code is totally unreadable.
--
Steve
 
May 20, 2008
603
0
Sammamish, WA
> vefatica wrote:
> When I make that routine into a plugin function (only change needed is wprintf() to Printf())
> the same task takes about 40 sec.

I've seen funny behavior especially when 0x07 is included. Try making
a large ASCII file and see if the time still is much different.

This generates about the same file size if test.txt doesn't exist initially.
for /l %i in (1,1,14000) do echo %@repeat[a,80] >> test.txt

On Mon, Mar 16, 2009 at 7:44 AM, Steve Fábián <> wrote:

> vefatica wrote:
> ...
> | Notice how pasting the code into vBulletin, even with CODE tags


> ... and when delivered as email, the code is totally unreadable.

Huh. In my email reader (Gmail), the code itself was rendered must
better than "totally unreadable". It did append after each for (;;)
loop the characters equal quote quote greater and in some places an
equal quote quote. I believe all the line breaks and indenting were
retained. Reading the same email on my iPhone's built-in email
inserted artificial line breaks due to screen size, but was otherwise
the same.




--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
May 20, 2008
11,385
99
Syracuse, NY, USA
:: I've seen funny behavior especially when 0x07 is included. Try making
:: a large ASCII file and see if the time still is much different.

0x07 doesn't matter here; I'm not trying to print it. I'm pretty sure the speed of the EXE and the slowness of the plugin have to do with the buffering of output (which wprintf does). I was calling TCC's Printf to write a few (even one) characters at a time (34 Printf's per line!). When I constructed the whole line before outputting it (33 wsprintf's and 1 Printf) I cut that 40 seconds to 1.5 seconds.
 
Similar threads
Thread starter Title Forum Replies Date
Charles Dye A weirdoid plugin question Plugins 6
vefatica Plugin keyhandler observation/question Plugins 15
vefatica Plugin keyhandler question Plugins 1
Joe Caverly 64-bit Plugin development using PureBasic Plugins 11
R New Plugin Plugins 0
Alpengreis elevated plugin questions Plugins 3
fpefpe utf-8 support in sdk/plugin api Plugins 4
S How to? Can @DU function in 4Utils64 plugin somehow cater for dirs with spaces? Plugins 3
vefatica Plugin access to arrays? Plugins 4
vefatica How big is a plugin's parameter buffer? Plugins 5
C @knownpath plugin Plugins 0
Charles Dye Updated OSD plugin Plugins 0
Joe Caverly C# plugin framework for JPSoft's TCC Plugins 0
dcantor Help for newest version of TEXTUTILS plugin Plugins 10
dcantor UISTUFF plugin missing help topic Plugins 12
M How to? Use SafeChars plugin... Plugins 2
dcantor Error in SAFECHARS plugin v 1.9.0 Plugins 2
dcantor Request for documentation for ISO8601 plugin Plugins 4
vefatica Possible with a plugin? Plugins 6
dcantor Inconsistency between textutils plugin and wrap utility Plugins 2
M (Stupid?) Problem with 64-bit 4Utils plugin... Plugins 3
H Latest ISO8601 plugin? Plugins 1
Charles Dye New plugin: QKeys Plugins 34
S Plugin to quickly locate all files hard linked together Plugins 5
S Documentation Plugin everything.dll Plugins 5
newbie How to? Multi-plugin installation errors, Re: FedUtils8 Plugins 7
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20
M SafeChars plugin misbehaving... Plugins 3
M A weird error re a plugin... Plugins 0
vefatica Plugin dilemma Plugins 2
fpefpe Documentation Plugin API/SDK Plugins 3
C Looking for Vince's old 4UTILS plugin for TCMD v8 Plugins 1
S DESKTOP plugin - anyone ? Plugins 0
C How to? a plugin to sort Outlook Express "rules" Plugins 0
M ISO Plugin: Yes, it's wonderful, but it could be yet more wonderful... Plugins 7
M The ISO plugin is wonderful, but it lacks a little something... Plugins 22
Charles Dye Beta plugin: HidePasswords Plugins 3
M ISO8601 Plugin not "reporting" errors to TCC... Plugins 4
Frank 4console plugin Plugins 4
S WAD ISO8601 Plugin Plugins 15
Joe Caverly Plugin and 64-bit TCC Plugins 3
C Problem with FixNames plugin Plugins 9
dcantor Suggestion and request for DBF plugin Plugins 6
dcantor Suggestion for SafeChars plugin Plugins 7
M Charles, I just installed the "new" SafeChars plugin, ... Plugins 5
M A problem with the SafeChars Plugin... Plugins 30
S WHICHWIN (sysutils plugin) Plugins 13
M A (presumbly pretty simple) SafeChars plugin request... Plugins 2
M A "SafeChars" plugin request... Plugins 2
S ISO 8601 plugin enhancement Plugins 6

Similar threads