15,894,107 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by maheshbisht (Top 14 by date)
maheshbisht
24-Sep-14 16:57pm
View
Hi Sergey Alexandrovich
can u help me on this.I have to use following function (In C language) from a dll-
int encrypt(unsigned char *key, unsigned char *dataToEncrypt,
unsigned int in_data_len, unsigned char *out_data,
unsigned int *out_data_len)
and i am using following c# code to access the function but its give me
error= "A call to PInvoke function 'ConsoleApplication1!ConsoleApplication1.abc::encrypt' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."
Used C# code:
<pre lang="cs">using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
abc.crypto();
}
}
public static class abc
{
const string _dllLocation = @"E:\ConsoleApplication1\ConsoleApplication1\bin\Debug\ck.dll";
[DllImport(_dllLocation)]
public static extern int encrypt([In, Out] byte[] key, [In, Out] byte[] dataToEncrypt, uint in_data_len, [Out] byte[] out_data, ref uint out_data_len);
//int encrypt(unsigned char *key, unsigned char *dataToEncrypt, unsigned int in_data_len, unsigned char *out_data, unsigned int *out_data_len)
public static void crypto()
{
var key = new byte[Int16.MaxValue];
key = Encoding.ASCII.GetBytes("123456789012");
var dataToEncrypt = new byte[Int16.MaxValue];
dataToEncrypt = Encoding.ASCII.GetBytes("1232345456789012");
uint in_data_len = 64;
var out_data = new byte[Int16.MaxValue];
uint out_data_len = 0;
int i = encrypt(key, dataToEncrypt, in_data_len, out_data, ref out_data_len);
}
}
}</pre>
maheshbisht
24-Sep-14 13:55pm
View
Thanks
maheshbisht
20-Sep-14 15:33pm
View
sir i know that when there is any third party dll the we add have to register it with our system but want to know how?
maheshbisht
20-Sep-14 14:30pm
View
My project platform is Visual Studio 2012
maheshbisht
25-May-13 7:22am
View
no yara not from ajax control can we do it from asp.net and jquery ? welcome your suggestion on this.
maheshbisht
15-May-13 15:49pm
View
at groupby line(At last) it gives conversion error into a list
maheshbisht
12-May-13 15:21pm
View
actually i was working on report viewer and at run time i need a path of my report file .It's on solution explorer directly attached to winFormappliction1.
maheshbisht
12-May-13 15:20pm
View
Deleted
actually i was working on report viewer and at run time i need a path of my report file .It's on solution explorer directly attached to winFormappliction1.
maheshbisht
12-May-13 15:11pm
View
like this => Application.StartupPath+"winform.cs"
maheshbisht
2-Jan-13 6:57am
View
Hello Sir did u ever try this on adding attribute, it's useless.
maheshbisht
30-Dec-12 12:50pm
View
Thanks for your afford.
maheshbisht
16-Oct-12 23:45pm
View
no Sergey Alexandrovich u r wrong.
maheshbisht
1-Oct-12 2:37am
View
Thanks for your time and consideration but on this link there is a asynchronous communication with server but my Question is so simple: Is via jquery i can bind Page life cycle eg: if i have to bind items on dropdownlist at page_load event through "Jquery"
maheshbisht
28-Apr-12 15:08pm
View
Reason for my vote of 1
for out keyword function should be static "plz mind it"
Show More