Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,661 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,173 people online right now. Registration is fast and FREE... Join Now!




Attempted to read or write protected memory. This is often an indicati

 
Reply to this topicStart new topic

Attempted to read or write protected memory. This is often an indicati, while I am trying to deploy or publish my application I am getting thi

anjanabiswasroy
post 16 Sep, 2008 - 09:18 PM
Post #1


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 4

public class LockCheck
{
[DllImport("SentryDLL5.dll")]
extern static int win_xread_nt95(UInt16[] rbuff, byte[] pass);

public static int LOCKCHECKFLAG = 1; // set to 1 if hardware lock to be imposed else 0
public string DisplayMessage = "Unauthorized Usage. Please Contact PALADION. Email : info@paladion.net";
public string PreviousSession = "userlogin";

public LockCheck()
{
//
// TODO: Add constructor logic here
//
}

public int AuthenticateUser()
{
int i = 0;
int stat =0;
UInt16[] rbuff = new UInt16[12];
UInt16[] signature = new UInt16[12];
byte[] pasw = new byte[4];

pasw = (byte[])HttpContext.Current.Session["Pasw"];
rbuff = (UInt16[])HttpContext.Current.Session["Key"];
signature = (UInt16[])HttpContext.Current.Session["Signature"];

stat = win_xread_nt95(rbuff, pasw);
switch (stat)
{
case 0:
{
//check whether signature is correct one or not
for (i = 0; i <= 11; i++)
{
if (rbuff[i].CompareTo(signature[i]) != 0)
{
stat = -11;
break;
}
}
}
break;
}
return stat;
}

}

Error stack --

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Source Error:


Line 66: signature = (UInt16[])HttpContext.Current.Session["Signature"];
Line 67:
Line 68: stat = win_xread_nt95(rbuff, pasw);
Line 69: switch (stat)
Line 70: {


Source File: D:\Projects\vaod\trunk\code\BussinessLayer\LockCheck.cs Line: 68

Stack Trace:


[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
BussinessLayer.LockCheck.win_xread_nt95(UInt16[] rbuff, Byte[] pass) +0
BussinessLayer.LockCheck.AuthenticateUser() in D:\Projects\vaod\trunk\code\BussinessLayer\LockCheck.cs:68
_Default.Page_Load(Object sender, EventArgs e) +63
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061



User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 16 Sep, 2008 - 09:51 PM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


What is it that you're trying to accomplish? There could very well be a simpler, safer method for accomplishing the same task
User is offlineProfile CardPM

Go to the top of the page

anjanabiswasroy
post 16 Sep, 2008 - 10:46 PM
Post #3


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 4

I am trying to impose hardware lock for my application.
User is offlineProfile CardPM

Go to the top of the page

anjanabiswasroy
post 17 Sep, 2008 - 12:30 AM
Post #4


New D.I.C Head

*
Joined: 16 Sep, 2008
Posts: 4

Thanks ,Finaaly i figure out the problem it was permission problem.

smile.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:39AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month