News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

recursive algorithm

Started by Psycho, February 24, 2006, 08:00:45 AM

Previous topic - Next topic

Psycho

Ok so let me see if i undderstand this correctly. Basically there is no way to fully meet the requirements with an masm module?

hutch--

Antony,

What you write is what you get and if you know what you are capable of passing from VB, you write the code accordingly to deal with it. The basic distinction between ByVal and ByRef is no more than the distinction of passing a direct value or passing an address by its value. You need to determine if your internal VB strings are in UNICODE or not. If they are, try and rewrite the code so it deals directly in characters as ANSI code and then pass the ADDRESS of the ansi string.

I know my way around PowerBASIC and it can pass the address of a dynamic string by using the StrPtr() function on the string then passing the result by value. You must have similar capacity in VB to do things like this. What you must avoid is ANSI to UNICODE conversions back and forth as it is very slow.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Psycho

Yes I do believe there is an ansi converson in VB. I will try using that.

MichaelW

Psycho,

Have you considered using BSTRs:

MSDN: Component Automation, String Manipulation Functions

I don't have VB6 installed so I can't test any of this, but I think it is at least possible that one of these methods would work:

1. Pass the VB string ByVal to the MASM module, have the MASM module fill the VB string with the encrypted string, changing the size if necessary with SysReAllocString.
2. Pass the VB string ByVal to the MASM module, have the MASM module create a new string, fill it with the encrypted string, pass it back to VB, and have VB take care of freeing it.

eschew obfuscation

zooba

.const
    szString BYTE "This is my string", 0

.code

ReturnMyString PROC
    invoke  SysAllocByteLen, OFFSET szString, 17
    ret
ReturnMyString ENDP


That is the best way I know of returning a string. SysAllocByteLen does not require you to use Unicode, allows embedded nulls and automatically places a null character at the end (hence length of 17 - copies 17 characters then adds null). :U