Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal Xerithane's Journal: Cry for help: Win32 DLLs 6

Need some quick and relatively easy help. I need to code up a Win32 DLL to be imported by a Visual Basic or VBA app (I'm not sure which, because that shit is like greek to me.)

Anybody available to offer some quick tutorials on how to do this, I have no documentation for Win32 code at all.

IM me at AIM: Xerithane if you can help. Thanks.

Update: Let me go ahead and tell you what we're doing. We are using a Blowfish algorithm to encrypt/decrypt information of arbitrary lengths. I'm doing it in 8-byte chunks on the Unix side, and just working with the data raw (no encoding.) We have a Visual Basic application that needs to be able to use the same algorithm, but all Blowfish algorithms in VB are refusing to work.

This discussion has been archived. No new comments can be posted.

Cry for help: Win32 DLLs

Comments Filter:
  • Do you need a COM server? VB/VBA normally consume these but they can also use "normal" libraries via a hacky import mechanism.

    Of course if you need a COM server DLL, then you can use VB, not C++.

    If you tell me what it is you need I can probably help you.

    Sorry, no AIM, and I can't check Hotmail from here right now =(

    • Yes, as Bungi said, there are two ways to write a DLL in C++ to be used in a VB or VBA application. Let me expand a teeny bit on what he said:

      1) Write a COM server that implements the correct interfaces. I'm not a real strong C++ programmer, but I believe the best way to do it is have a dual interface COM server that implements both a custom interface and IDispatch.
      2) Write a standard C++ DLL and use the importing mechanisms of VB. Visual Basic has a way to use an "old-school" Windows DLL so it can use

      • 2) Write a standard C++ DLL and use the importing mechanisms of VB. Visual Basic has a way to use an "old-school" Windows DLL so it can use the Win32 API directly (user32.dll, etc.) This is definately not the prefered way to integrate C++ functionality with VB since it is, as Bungi said, a bit "hacky".

        This is what we are doing. I just need to export two functions: encrypt and decrypt. Everything else can be handled internal to the DLL.
        • This is what we are doing. I just need to export two functions: encrypt and decrypt. Everything else can be handled internal to the DLL.

          Well, having the ability to set the key used might help ;-)

          It looks like this [wiretapped.net] DLL would fit the bill? It's under a Bernstein-style license ("Like the algorithm itself, this DLL may be freely used and distributed.") and all the source code and documentation you'd need seems to be here [wiretapped.net].

          Example usage as follows (with hexadecimal data; it can handle binary as well, by set

          • Well, having the ability to set the key used might help ;-)

            Actually, no. I'm perfectly ok with forcing the key in C:\keyfile or something.

            Basically, just set the Key, call Init, then call Encipher or Decipher as needed. (One constraint: they require 8 byte blocks, rather than arbitrary length chunks, since Blowfish is a 64-bit block cipher.) Put a trivial wrapper around it - chop the input into 8 byte blocks, null-padding the last one as needed - and it's exactly what you're after AFAICS.

            That's exact
            • No source code. This is the DLL that we are trying to get working. We've gotten their demo program to export proper strings and we can decrypt them on the unix side. Now we just need to get the DLL working.

              Ah, I see. Try this [di-mgt.com.au] one then - a pure VB version, or an alternative DLL. Basically old-style BSD license, at least on the VB version, and apparently this one does have source code.

              I'm just sitting in the eye of a hurricane right now. Weird feeling. And I get next Friday off for surgery, and the follow

If you had better tools, you could more effectively demonstrate your total incompetence.

Working...