Visual Studio 2010 C#

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
heopas
Posts: 28
Joined: Mon Jun 25, 2012 9:15 pm

Visual Studio 2010 C#

Post by heopas »

I have some problems with API. I can' t make it work (build).
I am newb in C# :D

Code:

Code: Select all

public Form1()
        {
            InitializeComponent();
            for (int i = 1; i <= 3; i++)
            {
                int len = Enigma_IDE.EP_ProtectedStringByID(i, null, 0);
                if (len > 0)
                {
                    StringBuilder str = new StringBuilder(len);
                    if (Enigma_IDE.EP_ProtectedStringByID(i, str, len) > 0)
                    {
                        if (i == 1)
                            encdecpass = str.ToString();
                        if (File.Exists(Directory.GetCurrentDirectory() + "\\users.ini") == false)
                        {
                            File.Create(Directory.GetCurrentDirectory() + "\\users.ini");
                            IniFile ini = new IniFile(Directory.GetCurrentDirectory() + "\\users.ini");
                            if (i == 2)
                                username = str.ToString();
                            else
                                password = str.ToString();
                        }
                    }
                }
            }
        }

        public class Enigma_IDE
        {
            [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
            public static extern Int32 EP_ProtectedStringByID(Int32 ID, StringBuilder Str, Int32 Len);
        }
Errors:

Code: Select all

Error	1	The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?)	C:\******\Visual Studio 2010\Projects\login\login\Form1.cs	47	14	login
Error	2	The type or namespace name 'DllImportAttribute' could not be found (are you missing a using directive or an assembly reference?)	C:\******\Visual Studio 2010\Projects\login\login\Form1.cs	47	14	login
perfectcode
Posts: 28
Joined: Tue Oct 30, 2012 8:15 am

Re: Visual Studio 2010 C#

Post by perfectcode »

text removed
Last edited by perfectcode on Sun Feb 22, 2015 8:49 am, edited 1 time in total.
heopas
Posts: 28
Joined: Mon Jun 25, 2012 9:15 pm

Re: Visual Studio 2010 C#

Post by heopas »

Nice !! That worked for me.
Now i have another problem, when i am getting the first protected string i am sending a messagebox to test it. The string contains only the first letter from the protected string. (e.x. Protected String: heopas MessageBox: h).
I have already tried to chagne ascii string to wide.

Edit1:
I changed the int to int32 and is fixed.
Now the problem is that it add a extra character at the end (using ascii) ( E.x. Protected String: heopas MessageBox: heopas} )
Same problem occur with Enigma Example too.
Post Reply