PC Review


Reply
Thread Tools Rate Thread

Conversion from unmanaged data to managed.

 
 
Eduardo Pavinato Klein
Guest
Posts: n/a
 
      30th Sep 2003
Hi.

I have a Embedded C++ DLL that exports byte arrays. My export function
header is:

BOOL RSATest_GetKeyPair (BYTE **pubKey, BYTE **privKey, DWORD & dwPubKSize,
DWORD & dwPrivKSize)

How do I do it on the .NET CF?
I don't know how to retrieve byte arrays from unmanaged code.

Thanks,
Eduardo


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003


 
Reply With Quote
 
 
 
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      1st Oct 2003
You will need to modify your C++ dll to fill supplied buffers instead of
allocating memory internally and returning pointer:

BOOL RSATest_GetKeyPair (BYTE *pubKey, BYTE *privKey, DWORD & dwPubKSize,
DWORD & dwPrivKSize)
On invoke dwPubKSize and dwPrivKSize should be set to the size of the
supplied buffers and upon return you will set them to the actual data size.
Make sure you check for that the buffers are sufficient

[DllImport("yourdll")]
extern public static bool RSATest_GetKeyPair (byte[] pubKey, byte[] privKey,
ref int dwPubKSize, ref int dwPrivKSize);


"Eduardo Pavinato Klein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi.
>
> I have a Embedded C++ DLL that exports byte arrays. My export function
> header is:
>
> BOOL RSATest_GetKeyPair (BYTE **pubKey, BYTE **privKey, DWORD &

dwPubKSize,
> DWORD & dwPrivKSize)
>
> How do I do it on the .NET CF?
> I don't know how to retrieve byte arrays from unmanaged code.
>
> Thanks,
> Eduardo
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003
>
>



 
Reply With Quote
 
Geoff Schwab [MSFT]
Guest
Posts: n/a
 
      2nd Oct 2003
Hi Eduardo,

Here are some references that may help:

An intro to P/Invoke:
http://msdn.microsoft.com/library/en...ntrointerp.asp

Advanced P/Invoke:
http://msdn.microsoft.com/library/en...advinterop.asp


--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.


"Eduardo Pavinato Klein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi.
>
> I have a Embedded C++ DLL that exports byte arrays. My export function
> header is:
>
> BOOL RSATest_GetKeyPair (BYTE **pubKey, BYTE **privKey, DWORD &

dwPubKSize,
> DWORD & dwPrivKSize)
>
> How do I do it on the .NET CF?
> I don't know how to retrieve byte arrays from unmanaged code.
>
> Thanks,
> Eduardo
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Managed/Unmanaged code and #pragma managed/unmanaged ajtaylor@hushmail.com Microsoft VC .NET 6 18th Feb 2008 09:33 AM
Conversion of unmanaged structure containing array to the managed one! pkoniusz@gmail.com Microsoft VC .NET 16 11th Dec 2007 06:07 AM
Data from unmanaged to managed =?Utf-8?B?U2hhcm9u?= Microsoft C# .NET 3 11th Jun 2007 12:39 PM
Conversion between managed class and unmanaged structure zhphust Microsoft VC .NET 3 5th Oct 2004 09:21 AM
RE: conversion from managed to unmanaged code Peter Huang [MSFT] Microsoft VC .NET 0 25th Jul 2003 01:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:32 AM.