Click here to Skip to main content
16,005,236 members
Home / Discussions / C#
   

C#

 
AnswerRe: String concadination Pin
Megidolaon2-Apr-09 1:02
Megidolaon2-Apr-09 1:02 
JokeRe: String concadination Pin
Henry Minute2-Apr-09 2:01
Henry Minute2-Apr-09 2:01 
GeneralRe: String concadination Pin
Megidolaon2-Apr-09 20:25
Megidolaon2-Apr-09 20:25 
AnswerRe: String concadination Pin
Henry Minute2-Apr-09 2:07
Henry Minute2-Apr-09 2:07 
GeneralRe: String concadination Pin
Luc Pattyn2-Apr-09 4:17
sitebuilderLuc Pattyn2-Apr-09 4:17 
GeneralRe: String concadination Pin
Henry Minute2-Apr-09 4:23
Henry Minute2-Apr-09 4:23 
GeneralRe: String concadination Pin
Luc Pattyn2-Apr-09 4:42
sitebuilderLuc Pattyn2-Apr-09 4:42 
QuestionUnmanaged code with C# Pin
kalivos1-Apr-09 18:15
kalivos1-Apr-09 18:15 
I would like to start off by saying that I have never done this before, so please excuse if this is a silly mistake.

I have a function within a DLL that I need to call. The C# project will fail on occasion with an exception, "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I have been looking around, and my best guess is using strings in my project will cause errors.

Any help from the experts? Smile | :)

Here's the code I'm using in C#
public class Encryption
{
    [DllImport("Encryption.dll", EntryPoint = "encrypt")]
    public unsafe static extern IntPtr encrypt(char [] data, char [] key);

    static public string Encrypt(string data, string key)
    {
        if (data.Length > 0)
        {
            return Marshal.PtrToStringAnsi(encrypt(data.ToCharArray(), key.ToCharArray()));
        }
        else
            return "";
    }

}


And the function in the DLL (C++)
extern "C"
{
	__declspec(dllexport) string encrypt(char* data, char* key)
	{
           ...

	}
}



Thanks,
-Kalivos
AnswerRe: Unmanaged code with C# Pin
Fernando A. Gomez F.1-Apr-09 21:14
Fernando A. Gomez F.1-Apr-09 21:14 
Questionattachment encoding base64 Pin
anilaabc1-Apr-09 18:13
anilaabc1-Apr-09 18:13 
Questionint[] sort Pin
yesu prakash1-Apr-09 17:49
yesu prakash1-Apr-09 17:49 
AnswerRe: int[] sort Pin
Judah Gabriel Himango1-Apr-09 17:54
sponsorJudah Gabriel Himango1-Apr-09 17:54 
AnswerRe: int[] sort Pin
N a v a n e e t h1-Apr-09 18:02
N a v a n e e t h1-Apr-09 18:02 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 4:01
sponsorJudah Gabriel Himango2-Apr-09 4:01 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 4:24
sitebuilderLuc Pattyn2-Apr-09 4:24 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 5:13
sponsorJudah Gabriel Himango2-Apr-09 5:13 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 5:22
sitebuilderLuc Pattyn2-Apr-09 5:22 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 5:34
sponsorJudah Gabriel Himango2-Apr-09 5:34 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 6:02
sitebuilderLuc Pattyn2-Apr-09 6:02 
GeneralRe: int[] sort Pin
Judah Gabriel Himango2-Apr-09 6:07
sponsorJudah Gabriel Himango2-Apr-09 6:07 
GeneralRe: int[] sort Pin
Luc Pattyn2-Apr-09 6:13
sitebuilderLuc Pattyn2-Apr-09 6:13 
GeneralRe: int[] sort Pin
Henry Minute2-Apr-09 4:27
Henry Minute2-Apr-09 4:27 
GeneralRe: int[] sort [modified] Pin
Judah Gabriel Himango2-Apr-09 5:16
sponsorJudah Gabriel Himango2-Apr-09 5:16 
GeneralRe: int[] sort Pin
Henry Minute2-Apr-09 6:25
Henry Minute2-Apr-09 6:25 
QuestionCreate table with DrawRectangle..?? Pin
iman_ridwan1-Apr-09 17:39
iman_ridwan1-Apr-09 17:39 

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.