I have a web application that uses a DLL using DLLImport.
Twice I have put the application live on the net and it has been used
hundreds or thousands of time before it has been strangely brought
down.
System.AccessVi olationExceptio n: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt. at
ProjApi.Proj.pj _init_plus(Stri ng pjstr) at coordinate.LLto UTM(Int32
datumIn, Int32 datumOut, Double p_lat, Double p_lon, Double&
UTMNorthing, Double& UTMEasting, Int32& UTMZone) at
coordinate.LLto UTMZone(Double lat, Double lon, Int32 datumIn, Int32
datumOut, Int32& z, Double& n, Double& e) at
getfactory.Page _Load(Object sender, EventArgs e) at
System.Web.Util .CalliHelper.Ev entArgFunctionC aller(IntPtr fp, Object o,
Object t, EventArgs e) at
System.Web.Util .CalliEventHand lerDelegateProx y.Callback(Obje ct sender,
EventArgs e) at System.Web.UI.C ontrol.OnLoad(E ventArgs e) at
System.Web.UI.C ontrol.LoadRecu rsive() at
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
Here is my code that calls the extern method
public static int LLtoUTM(int datumIn, int datumOut, double p_lat,
double p_lon,ref double UTMNorthing,ref double UTMEasting,ref int
UTMZone)
{
int errno = 0;
//This is the formula for calculating which Zone a point is in at a
particular lat/long
int ZoneNumber = Convert.ToInt32 (Math.Floor((p_ lon + 180) / 6)) + 1;
double[] x = new double[1];
double[] y = new double[1];
double[] z = new double[1];
y[0] = p_lat * ProjApi.Proj.DE G_TO_RAD;
x[0] = p_lon * ProjApi.Proj.DE G_TO_RAD;
z[0] = 0.0;
IntPtr src0 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD27");
IntPtr src1 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD83");
IntPtr dst0 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD27");
IntPtr dst1 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD83");
//This nice little bit of code below is designed to execute
pj_transfrom (the proj lib all around function)
//with the correct parameters so that a datumshift to the correct
datum is included.
try
{
if (datumIn == 0)
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src0 , dst0,
1, 1, x, y, z);//NAD27-NAD83
}
else
{
errno = ProjApi.Proj.pj _transform(src0 , dst1,
1, 1, x, y, z);//NAD27-NAD27
}
}
else
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src1 , dst0,
1, 1, x, y, z);//NAD83-NAD27
}
else
{
errno = ProjApi.Proj.pj _transform(src1 , dst1,
1, 1, x, y, z);//NAD83-NAD83
}
}
}
catch { }
ProjApi.Proj.pj _free(dst1);
ProjApi.Proj.pj _free(src1);
ProjApi.Proj.pj _free(dst0);
ProjApi.Proj.pj _free(src0);
UTMNorthing = y[0];
UTMEasting = x[0];
UTMZone = ZoneNumber;
return errno;
}
Here is the definition and DLL import.
[DllImport("proj .dll", CharSet = CharSet.Ansi,
CallingConventi on = CallingConventi on.Cdecl)]
public static extern unsafe int pj_transform(In tPtr src, IntPtr
dst,
int point_count, int point_offset,
[InAttribute, OutAttribute] double[] x,
[InAttribute, OutAttribute] double[] y,
[InAttribute, OutAttribute] double[] z);
Any help at all would be useful. I am not able to trigger this error
myself so I can't even do trial and error. 2 2021
Did you develop unmanaged proj.dll? Do you source for that DLL?
That code seems to be causing some meory overwrite.
"humbleaptience " <hu************ @gmail.comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
>I have a web application that uses a DLL using DLLImport.
Twice I have put the application live on the net and it has been used
hundreds or thousands of time before it has been strangely brought
down.
System.AccessVi olationExceptio n: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt. at
ProjApi.Proj.pj _init_plus(Stri ng pjstr) at coordinate.LLto UTM(Int32
datumIn, Int32 datumOut, Double p_lat, Double p_lon, Double&
UTMNorthing, Double& UTMEasting, Int32& UTMZone) at
coordinate.LLto UTMZone(Double lat, Double lon, Int32 datumIn, Int32
datumOut, Int32& z, Double& n, Double& e) at
getfactory.Page _Load(Object sender, EventArgs e) at
System.Web.Util .CalliHelper.Ev entArgFunctionC aller(IntPtr fp, Object o,
Object t, EventArgs e) at
System.Web.Util .CalliEventHand lerDelegateProx y.Callback(Obje ct sender,
EventArgs e) at System.Web.UI.C ontrol.OnLoad(E ventArgs e) at
System.Web.UI.C ontrol.LoadRecu rsive() at
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
Here is my code that calls the extern method
public static int LLtoUTM(int datumIn, int datumOut, double p_lat,
double p_lon,ref double UTMNorthing,ref double UTMEasting,ref int
UTMZone)
{
int errno = 0;
//This is the formula for calculating which Zone a point is in at a
particular lat/long
int ZoneNumber = Convert.ToInt32 (Math.Floor((p_ lon + 180) / 6)) + 1;
double[] x = new double[1];
double[] y = new double[1];
double[] z = new double[1];
y[0] = p_lat * ProjApi.Proj.DE G_TO_RAD;
x[0] = p_lon * ProjApi.Proj.DE G_TO_RAD;
z[0] = 0.0;
IntPtr src0 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD27");
IntPtr src1 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD83");
IntPtr dst0 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD27");
IntPtr dst1 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD83");
//This nice little bit of code below is designed to execute
pj_transfrom (the proj lib all around function)
//with the correct parameters so that a datumshift to the correct
datum is included.
try
{
if (datumIn == 0)
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src0 , dst0,
1, 1, x, y, z);//NAD27-NAD83
}
else
{
errno = ProjApi.Proj.pj _transform(src0 , dst1,
1, 1, x, y, z);//NAD27-NAD27
}
}
else
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src1 , dst0,
1, 1, x, y, z);//NAD83-NAD27
}
else
{
errno = ProjApi.Proj.pj _transform(src1 , dst1,
1, 1, x, y, z);//NAD83-NAD83
}
}
}
catch { }
ProjApi.Proj.pj _free(dst1);
ProjApi.Proj.pj _free(src1);
ProjApi.Proj.pj _free(dst0);
ProjApi.Proj.pj _free(src0);
UTMNorthing = y[0];
UTMEasting = x[0];
UTMZone = ZoneNumber;
return errno;
}
Here is the definition and DLL import.
[DllImport("proj .dll", CharSet = CharSet.Ansi,
CallingConventi on = CallingConventi on.Cdecl)]
public static extern unsafe int pj_transform(In tPtr src, IntPtr
dst,
int point_count, int point_offset,
[InAttribute, OutAttribute] double[] x,
[InAttribute, OutAttribute] double[] y,
[InAttribute, OutAttribute] double[] z);
Any help at all would be useful. I am not able to trigger this error
myself so I can't even do trial and error.
No however the DLL is used to do these same operations thousands of
time and has been around for years and there has been no mention of any
problem like this on their mailing list. We have been using this
EXACT same dll on our web site to do reprojections (classic ASP) for
years hundreds of thousands of times a day.
Winista wrote:
Did you develop unmanaged proj.dll? Do you source for that DLL?
That code seems to be causing some meory overwrite.
"humbleaptience " <hu************ @gmail.comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
I have a web application that uses a DLL using DLLImport.
Twice I have put the application live on the net and it has been used
hundreds or thousands of time before it has been strangely brought
down.
System.AccessVi olationExceptio n: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt. at
ProjApi.Proj.pj _init_plus(Stri ng pjstr) at coordinate.LLto UTM(Int32
datumIn, Int32 datumOut, Double p_lat, Double p_lon, Double&
UTMNorthing, Double& UTMEasting, Int32& UTMZone) at
coordinate.LLto UTMZone(Double lat, Double lon, Int32 datumIn, Int32
datumOut, Int32& z, Double& n, Double& e) at
getfactory.Page _Load(Object sender, EventArgs e) at
System.Web.Util .CalliHelper.Ev entArgFunctionC aller(IntPtr fp, Object o,
Object t, EventArgs e) at
System.Web.Util .CalliEventHand lerDelegateProx y.Callback(Obje ct sender,
EventArgs e) at System.Web.UI.C ontrol.OnLoad(E ventArgs e) at
System.Web.UI.C ontrol.LoadRecu rsive() at
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
Here is my code that calls the extern method
public static int LLtoUTM(int datumIn, int datumOut, double p_lat,
double p_lon,ref double UTMNorthing,ref double UTMEasting,ref int
UTMZone)
{
int errno = 0;
//This is the formula for calculating which Zone a point is in at a
particular lat/long
int ZoneNumber = Convert.ToInt32 (Math.Floor((p_ lon + 180) / 6)) + 1;
double[] x = new double[1];
double[] y = new double[1];
double[] z = new double[1];
y[0] = p_lat * ProjApi.Proj.DE G_TO_RAD;
x[0] = p_lon * ProjApi.Proj.DE G_TO_RAD;
z[0] = 0.0;
IntPtr src0 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD27");
IntPtr src1 = ProjApi.Proj.pj _init_plus("+pr oj=latlong
+datum=NAD83");
IntPtr dst0 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD27");
IntPtr dst1 = ProjApi.Proj.pj _init_plus("+pr oj=utm +zone="
+ ZoneNumber + " +datum=NAD83");
//This nice little bit of code below is designed to execute
pj_transfrom (the proj lib all around function)
//with the correct parameters so that a datumshift to the correct
datum is included.
try
{
if (datumIn == 0)
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src0 , dst0,
1, 1, x, y, z);//NAD27-NAD83
}
else
{
errno = ProjApi.Proj.pj _transform(src0 , dst1,
1, 1, x, y, z);//NAD27-NAD27
}
}
else
{
if (datumOut == 0)
{
errno = ProjApi.Proj.pj _transform(src1 , dst0,
1, 1, x, y, z);//NAD83-NAD27
}
else
{
errno = ProjApi.Proj.pj _transform(src1 , dst1,
1, 1, x, y, z);//NAD83-NAD83
}
}
}
catch { }
ProjApi.Proj.pj _free(dst1);
ProjApi.Proj.pj _free(src1);
ProjApi.Proj.pj _free(dst0);
ProjApi.Proj.pj _free(src0);
UTMNorthing = y[0];
UTMEasting = x[0];
UTMZone = ZoneNumber;
return errno;
}
Here is the definition and DLL import.
[DllImport("proj .dll", CharSet = CharSet.Ansi,
CallingConventi on = CallingConventi on.Cdecl)]
public static extern unsafe int pj_transform(In tPtr src, IntPtr
dst,
int point_count, int point_offset,
[InAttribute, OutAttribute] double[] x,
[InAttribute, OutAttribute] double[] y,
[InAttribute, OutAttribute] double[] z);
Any help at all would be useful. I am not able to trigger this error
myself so I can't even do trial and error.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Askari |
last post by:
Yesterday, ALL code in python work and nothing when I close(finish) a code.
Today, when I close, some raise this windows error :
Instruction at "0x00FC3D70" use memory address "0x00000000". Can't be
"read".
Click on "OK" to exit program.
Why this error, today and not before today?
|
by: ZafT |
last post by:
Thanks in advance for any tips that might get me going in the right
direction.
I am working on a simple exercise for school that is supposed to use read to
read a file (about 10 MB). I am supposed to change the buffer size and see
how this affects the read time. In other words, the buffer is supposed to
limit how much of the file gets read per call, and cause some change in
speed. I am supposed to do the same with fread as well, but...
|
by: Alf P. Steinbach |
last post by:
So, I got the itch to write something more...
I apologize for not doing more on the attempted "Correct C++ Tutorial"
earlier, but there were reasons.
This is an UNFINISHED and RAW document, and at the end there is even pure
mindstorming text left in, but already I think it can be very useful.
<url: http://home.no.net/dubjai/win32cpptut/special/pointers/preview/pointers_01__alpha.doc.pdf>.
|
by: Ryan Linneman via .NET 247 |
last post by:
Any help appreciated...
I am using a third party DLL file to access an HMI using ethernet. The function is declared in a VB module as:
'Read internal word address
Public Declare Function HKEtn_ReadInternalMemory Lib "HKEserv.dll" _
(ByRef dp As Int16, _
ByVal Wordcnt As Int16, _
ByVal DeviceType As Int32, _
ByVal addr As Int32, _
|
by: Tina |
last post by:
This is an issue regarding what exactly is accomplished by using "Protected"
when defining a variable. It seems it does much more than just applying
Protected status to a variable.
I have an ascx control named HeadingBar. I have dragged it onto an aspx
page.
If I use the following statement.....
Dim HeadingBar1 as HeadingBar
| |
by: Pieter |
last post by:
Hi,
Since 10 days (the first time was the 10th of november) I have some weird
exception happening in an application here:
All (except 1 of the total of 5) users had this error now 1 of 2 times
during the last 10 days. It happens mostly during startup or closing of the
application, but sometimes just in the middle of nowhere. It doesn't point
to anyting special. I don't get a clue...
It's a Windows Forms VB.NET 2005 application. I roll...
|
by: nieve |
last post by:
Hello all,
I'm working on a c# application using smart cards.
I've been using vs2008 on an XP machine and everything was ok till I tried installing and running a demo on a vista machine. What happens is that when I get to call this method:
public static extern int SCardListReaderGroups(int hContext, ref string cGroups, ref int nStringSize);
I get the "Attempted to read or write protected memory" exception.
I've tried editbin.exe...
|
by: Scott Gravenhorst |
last post by:
Windows XP SP3
My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.
The exception text is:
"Attempted to read or write protected memory. This is often an
|
by: kamcap |
last post by:
I have referenced a COM dll (unmanagged code) in a C# console application and this DLL is referenced in C# program using Interop facility in .NET. This dll actually a dataset/table which is written in Borland Delphi.
static int Main(string args)
{
ClientVarDataSet vds = new ClientVarDataSet();
vds.XML = "";
vds.AddField("x", 3); //"x" field name and 3 field type
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |