Valhalla Legends Forums Archive | Assembly Language (any cpu) | Disassembling VB Programs

AuthorMessageTime
Telos
TheMinistered and I have been documenting some of the functions inside of VB programs to understand exactly what is going on. The first thing we noticed is that if you write VB programs with strict type checking and use type specific functions like Mid$, Left$, Right$ instead of variant accepting functions like Mid, Left, and Right, there is a serious decrease in the amount of code that VB generates. It may seem fairly obvious but its a good reminder to use type specific functions whenever possible. Lastly for people interested in working with VB disassembly the documentation on the functions we have done is available at http://www.freewebs.com/telosx
February 11, 2004, 9:11 PM
Grok
That's a well documented fact, which you could have deduced without disassembly.

When using the Variant type functions Mid(), Left(), Right(), Trim(), etc, VB must first determine the vartype of the operands.

In fact it is one of the first things you learn when reading about VB code optimization.
February 11, 2004, 11:04 PM
Telos
Hence the statement:

[quote]
It may seem fairly obvious but its a good reminder to user type specific functions whenever possible.
[/quote]

It should be common sense that when using indetermine forms of variables that extra code will be required to determine the data type. The disassembly simply allows you to see the sheer volume of extra code that Visual Basic has to execute to do this.
February 11, 2004, 11:21 PM
Grok
By the way, why are you two disassembling a dead language?
February 11, 2004, 11:52 PM
Newby
[quote author=Grok link=board=7;threadid=5232;start=0#msg43723 date=1076543525]
By the way, why are you two disassembling a dead language?
[/quote]

[me=Newby]looks at how many posts in the Visual basic section there are compared to any other programming sections (Besides General =P)[/me]

[me=Newby]laughs :P[/me]

It's not dead for Battle.net :P
February 12, 2004, 12:10 AM
Adron
[quote author=Grok link=board=7;threadid=5232;start=0#msg43717 date=1076540676]
That's a well documented fact, which you could have deduced without disassembly.

When using the Variant type functions Mid(), Left(), Right(), Trim(), etc, VB must first determine the vartype of the operands.

In fact it is one of the first things you learn when reading about VB code optimization.
[/quote]

That is strange. I see VB functions getting turned into other calls when compiling to native code. VB should be able to do static selections of what function to use when you call Mid, Left, etc, if they are passed string variable arguments.
February 12, 2004, 1:23 AM
Maddox
Should be
BSTR __fastcall __vbaStrCopy(BSTR destination, BSTR source);

This isn't like like strcpy. It copies source and destination to a new buffer which it returns.
March 1, 2004, 2:32 AM

Search