Click here to Skip to main content
15,892,797 members
Home / Discussions / C#
   

C#

 
QuestionHow to add Restart Dialog to Installer Pin
remex_1980_junyongwu28-Mar-07 17:13
remex_1980_junyongwu28-Mar-07 17:13 
QuestionSnippets Pin
Mike Hankey28-Mar-07 17:07
mveMike Hankey28-Mar-07 17:07 
QuestionHow to reconnect to the server when the ethernet cable unplugged and replugged using Socket Pin
engsrini28-Mar-07 16:34
engsrini28-Mar-07 16:34 
Questionhow to use the a interface declared in a dll Pin
goldli28-Mar-07 16:21
goldli28-Mar-07 16:21 
AnswerRe: how to use the a interface declared in a dll Pin
wulixu28-Mar-07 17:31
wulixu28-Mar-07 17:31 
GeneralRe: how to use the a interface declared in a dll [modified] Pin
goldli28-Mar-07 19:15
goldli28-Mar-07 19:15 
Question"Attempted to read or write protected memory." Pin
User 137680028-Mar-07 14:58
User 137680028-Mar-07 14:58 
AnswerRe: "Attempted to read or write protected memory." Pin
Dewald30-Mar-07 23:25
Dewald30-Mar-07 23:25 
Hi YttriumOxide,

I've been struggling with something very similar recently. You can read my question here[^]:

I seem to have found an answer and it turned out to be far simpler than I thought it was going to be. Having said that, I might still be doing something wrong which will come back to bite me later but for now I seem to be OK and on my way.

What I did different from you was not to pass a pointer to the byte array as a parameter to the function but the byte array itself. I did not even do it in an unsafe block (which I probably should) but it worked.

So, leaving your declaration of your function unchanged (where you import it from the DLL), I would have called it like this:
ABCdecrypt(100, yData, yData.Length);

I have to stress though that I am by no means an expert in this field. I'm only just starting to meddle in C# and I haven't the faintest clue about marshalling. By the way, why did you marshal your first parameter as UnmanagedType.I4? And why did you not marshal the other two parameters? Do you know of any sites where I can read up on the MarshalAs attribute when used in this context?

Good luck
QuestionWindows Forms book suggestions? Pin
Mark J. Miller28-Mar-07 12:11
Mark J. Miller28-Mar-07 12:11 
AnswerRe: Windows Forms book suggestions? Pin
J$28-Mar-07 12:54
J$28-Mar-07 12:54 
GeneralRe: Windows Forms book suggestions? Pin
Mark J. Miller28-Mar-07 13:30
Mark J. Miller28-Mar-07 13:30 
AnswerRe: Windows Forms book suggestions? Pin
Mike Hankey28-Mar-07 13:32
mveMike Hankey28-Mar-07 13:32 
AnswerRe: Windows Forms book suggestions? Pin
Scott Dorman28-Mar-07 13:36
professionalScott Dorman28-Mar-07 13:36 
AnswerRe: Windows Forms book suggestions? Pin
Rudolf Jan29-Mar-07 0:41
Rudolf Jan29-Mar-07 0:41 
Questionaccessing a remote gateway/box Pin
mfmaneef28-Mar-07 10:42
mfmaneef28-Mar-07 10:42 
QuestionUsing NotifyIcon Pin
gantww28-Mar-07 10:21
gantww28-Mar-07 10:21 
AnswerRe: Using NotifyIcon Pin
kubben28-Mar-07 11:02
kubben28-Mar-07 11:02 
QuestionC# / C++ interop - Functions returning pointers Pin
User 58261928-Mar-07 10:17
User 58261928-Mar-07 10:17 
AnswerRe: C# / C++ interop - Functions returning pointers Pin
led mike28-Mar-07 11:12
led mike28-Mar-07 11:12 
AnswerRe: C# / C++ interop - Functions returning pointers Pin
Leslie Sanford28-Mar-07 11:40
Leslie Sanford28-Mar-07 11:40 
QuestionDataColumn Expressions [modified] Pin
Farm Developer28-Mar-07 10:05
Farm Developer28-Mar-07 10:05 
AnswerRe: DataColumn Expressions Pin
J$28-Mar-07 14:33
J$28-Mar-07 14:33 
QuestionXmlwiter anyone can help Pin
Tkml23628-Mar-07 8:53
Tkml23628-Mar-07 8:53 
AnswerRe: Xmlwiter anyone can help Pin
J$28-Mar-07 9:18
J$28-Mar-07 9:18 
GeneralUrgent Pin
Tkml23628-Mar-07 9:23
Tkml23628-Mar-07 9:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.