dcsimg
Results 1 to 14 of 14

Thread: [VB6] - Trick Advanced Tools.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,360

    [VB6] - Trick Advanced Tools.

    Hello everyone!
    I present to you a small project - Add-in that allows to some extent alleviate debugging some programs as well expand compilation possibilities. All the source codes are in the attachment.
    This Add-in has the following features:
    1. Fixes the bug with Not Not Array statement that causes error "Expression too complex" if you'll work with float numbers;
    2. Allows to utilize the automatic conditional constants depending on run mode (IDE/EXE) look like in C++ (NDEBUG);
    3. Allows to disable integer overflow checking in IDE;
    4. Allows to disable floating point result checking in IDE;
    5. Allows to disable array bounds checking in IDE;
    6. Provides the compilation/linking events (both in IDE and EXE), i.e. you can run the commands before/after this events. By using this events you can do many useful things (encryption, replace OBJ files, static linking, etc.)


    How does it work?



    For fixing Not Not bug and disabling checking it uses the module of replacing of the opcodes handlers (P_Code) to ours. Firstly it finds the table of the opcodes by the signature in the ENGINE section of VBA6.dll module. There are two opcodes types - single-byte and double-bytes. Teh single-byte opcodes is less that 0xFB. It uses the length dissasembler by Ms-Rem that i ported to VB6. Besides it finds the subroutine that redirectes performing to the next opcode as well the subroutine that handles the errors. Since now it is very easy to get an access violation error i kept some checking. For example, access to uninitialized array causes the memory violation error - it handles that error. Because of there isn't an official documentation about VB6 opcodes (i've not found it) i did all the investigations, therefore some opcodes can raise error. In this case you can write them - i'll add handlers.
    For others features it uses splicing of the following functions:
    1. TipCompileProject;
    2. TipCompileProjectFull;
    3. TipMakeExe2;
    4. TipFinishExe2.
    TipSetConstantValues/TipGetConstantValues functions are used in order to set/get the conditional compilation arguments. The events is just calling of ShellExecuteEx function. There are events before/after project compilation (IDE/EXE) and linking. This project was weakly testing therefore it can contain bugs.
    Regading,
    Кривоус Анатолий (The trick)
    Attached Files Attached Files

  2. #2
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [VB6] - Trick Advanced Tools.

    typo? thinking it should be a *
    modDisasm.bas
    Code:
    line 63:        retOpcode = Opcode Or (cPtrData & &H100&)

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    5,520

    Re: [VB6] - Trick Advanced Tools.

    Quote Originally Posted by DEXWERX View Post
    typo? thinking it should be a *
    modDisasm.bas
    Code:
    line 63:        retOpcode = Opcode Or (cPtrData & &H100&)
    I would think possibly "And" if the code is meant to clear the bits in a bit field (but leave bit 9 unaltered) before Or'ing the Opcode into the return value.
    retOpcode = Opcode Or (cPtrData And &H100&)

    I didn't look at the actual code though to get a sense of the context, but & is the binary operand "And" in C and C++ (and possibly other languages I'm not familiar with).

  4. #4
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    371

    Re: [VB6] - Trick Advanced Tools.

    sometimes can you complete tool for vb addin about png? i see the video you upload to youtube!

  5. #5
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [VB6] - Trick Advanced Tools.

    Quote Originally Posted by passel View Post
    I would think possibly "And" if the code is meant to clear the bits in a bit field (but leave bit 9 unaltered) before Or'ing the Opcode into the return value.
    retOpcode = Opcode Or (cPtrData And &H100&)

    I didn't look at the actual code though to get a sense of the context, but & is the binary operand "And" in C and C++ (and possibly other languages I'm not familiar with).
    you would think that yes - That was my first assumption. I should have posted more context of the code. It's supposed to be combining 2 1 byte opcodes, to a single 2 byte opcode. So it's definitely supposed to be a *

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,360

    Re: [VB6] - Trick Advanced Tools.

    Quote Originally Posted by DEXWERX View Post
    typo? thinking it should be a *
    modDisasm.bas
    Code:
    line 63:        retOpcode = Opcode Or (cPtrData & &H100&)
    ̶Y̶e̶s̶.̶ ̶T̶h̶a̶n̶k̶ ̶y̶o̶u̶!̶ ̶I̶'̶v̶e̶ ̶f̶i̶x̶e̶d̶ ̶i̶t̶.̶ ̶I̶t̶ ̶s̶h̶o̶u̶l̶d̶ ̶b̶e̶:̶ ̶
    Code:
     ̶r̶e̶t̶O̶p̶c̶o̶d̶e̶ ̶=̶ ̶O̶p̶c̶o̶d̶e̶ ̶O̶r̶ ̶(̶c̶P̶t̶r̶D̶a̶t̶a̶ ̶A̶n̶d̶ ̶&̶H̶1̶0̶0̶&̶)̶
    Quote Originally Posted by passel View Post
    I would think possibly "And" if the code is meant to clear the bits in a bit field (but leave bit 9 unaltered) before Or'ing the Opcode into the return value.
    retOpcode = Opcode Or (cPtrData And &H100&)

    I didn't look at the actual code though to get a sense of the context, but & is the binary operand "And" in C and C++ (and possibly other languages I'm not familiar with).
    ̶Y̶o̶u̶ ̶a̶r̶e̶ ̶r̶i̶g̶h̶t̶!̶
    Quote Originally Posted by xxdoc123 View Post
    sometimes can you complete tool for vb addin about png? i see the video you upload to youtube!
    Yes, i'm working on it. It nicely works in IDE, i'm working on adding this feature to EXE. In the compiled form it's just an OBJ module that is linked to main exe and starts before main executable code will be launched.

    EDITED:
    DEXWERX, you are right. I was inattentive. It should be * 0x100 because this is 2-bytes opcode. http://read.pudn.com/downloads158/so.../LDasm.c__.htm

  7. #7
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [VB6] - Trick Advanced Tools.

    @Trick - it should be * not &

    a) You're combining 2 1 byte Opcodes according to the comments. ie: w = b1 Or (b2 * &H100&)
    b) cPtrData is Byte. If you And any Byte with &H100 - it becomes 0



    edit: Thanks for posting this!
    Last edited by DEXWERX; Sep 29th, 2016 at 09:07 AM.

  8. #8
    Lively Member
    Join Date
    Oct 2010
    Posts
    67

    Re: [VB6] - Trick Advanced Tools.

    Hi,

    I am still getting Run-time error "Expression too complex". How to fix that?

  9. #9

  10. #10
    Lively Member
    Join Date
    Oct 2010
    Posts
    67

    Re: [VB6] - Trick Advanced Tools.

    Quote Originally Posted by The trick View Post
    Kunical , hi. Please show the code that causes the error. Thank.
    Hellow the trick,

    Here is the code

    Code:
     ' --For themed style, we are not able to draw borders
          ' --after drawing the caption. i mean the whole button is painted at once.
          If m_ButtonStyle = eWindowsTheme Then
             If .Left < 4 Then .Left = 4
             If .Right > ScaleWidth - 4 Then .Right = ScaleWidth - 4
             If .Top < 4 Then .Top = 4
             If .Bottom > ScaleHeight - 4 Then .Bottom = ScaleHeight - 4
          End If
       End With
    This is from Jcbutton user control.

  11. #11
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,314

    Re: [VB6] - Trick Advanced Tools.

    This Addin is great! Especially the events to intercept in the linking process to replace .obj files.

    Compiling the source to dll works and is properly registered.
    However, any further attempt with regsvr32 (register or unregister) fails with the error "LoadLibrary("TrickAdvancedTools.dll") failed - The specified module could not be found"
    So that makes it a pain to ship the dll to another computer.

    I tested to replace all the typelib functions, consts etc. into the project as normal declarations and it solved the issue and I see no difference in the functionality.

    Attached is the modified source. I hope that is OK by the trick? If not, please let me know I will remove it.
    Attached Files Attached Files

  12. #12
    Lively Member
    Join Date
    Aug 2008
    Location
    Denmark
    Posts
    85

    Re: [VB6] - Trick Advanced Tools.

    First, Thanks for the many great contributions to The Trick and Krool!
    I agree it's a great Addin but when it's loaded i experience an issue in many projects that is using sub classing while using Krools mod. TrickAdvancedTools_NoTypeLib.zip

    run-time error '16'
    Expression too complex

    E.g. pvSafeOffset32() in [vb6]Common Dialog Class (Yet Another One) by LaVolpe
    http://www.vbforums.com/showthread.p...t-Another-One)

    This happen when the Addin is loaded (even when no settings are active)
    As soon as the Addin is unloaded the code work again without the runtime error

  13. #13
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,314

    Re: [VB6] - Trick Advanced Tools.

    Quote Originally Posted by DracullSoft View Post
    First, Thanks for the many great contributions to The Trick and Krool!
    I agree it's a great Addin but when it's loaded i experience an issue in many projects that is using sub classing while using Krools mod. TrickAdvancedTools_NoTypeLib.zip

    run-time error '16'
    Expression too complex

    E.g. pvSafeOffset32() in [vb6]Common Dialog Class (Yet Another One) by LaVolpe
    http://www.vbforums.com/showthread.p...t-Another-One)

    This happen when the Addin is loaded (even when no settings are active)
    As soon as the Addin is unloaded the code work again without the runtime error
    It must be something with the modCheckingOptions
    If I comment them out in the conAddIn designer and re-compile then it works without that error.
    But then of course you loose some functionality.

  14. #14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width