Welcome! Log In Create A New Profile

Advanced

WINDEV ->C<->D buffer, unsigned byte

Posted by BLS 
BLS
WINDEV ->C<->D buffer, unsigned byte
December 15, 2008 08:25PM
Hi,
yeah the title is a bit confusing. So what's the story ?
atm I am creating a tiny crypto dll for Windev. Problem is based on parameter passing.

//C code
void rc2_decrypt( const unsigned short xkey[64],
                   unsigned char *plain,
                   const unsigned char *cipher )
{
         unsigned x76, x54, x32, x10, i;

         x76 = (cipher[7] << 8) + cipher[6];
.........

Not yet a DLL function but I am not a C/C++ fan, so here the D port.

//D programming language 
export extern(Windows) /*create DLL function */
void rc2_decrypt( const(ushort)[64] xkey, ubyte* plain, const(ubyte)* cipher )

ubyte is unsigned byte, allready more readable, right ?

But instead of using a pointer to unsigned byte, I would prefer to use arrays:...
//D programming language  
export extern(Windows) /*create DLL function using arrays*/
void rc2_decrypt( const(ushort)[64] xkey, ubyte[] plain, const(ubyte)[] cipher )

In order to use the array based DLL function, I just can hope that WINDEVs buffer is usable:
// WINDEV
plain is  buffer = "DecryptMePlease" // the rc2-decrypt plain parameter

Any ideas ?
bjoern
Edit [ D is C ABI compatible, ABI not API ]

Sorry I can't drive any tests: Most of my hardware is damaged due high voltage accident.
Hope, I'll get new toys within the next 2 days.






Edited 1 time(s). Last edit at 12/15/2008 08:39PM by BLS.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: