I don't think it's related to VB and pages. That seems to be a very common
bug in your native code called "buffer overflow".
Here's an example:
UCHAR buffer[10];
...
bufferr[100] = 0; // Oops.
memcpy (buffer, NULL, 100); // Oops and... oops.
Most likely memcpy() in ReceiveData_GetLast() copies more than 120000 bytes
for some reason or uses invalid pointer(s).
Add some verification code to ReceiveData_GetLast() to verify array
boundaries/pointers and pop up an assert in case of a problem.
That would help you figure out what's wrong. Also, it's a good idea to add
some check and return an error if data appears to be incorrect.
You should pass buffer size to ReceiveData_GetLast() so it won't copy too
much:
UCHAR buffer[120000];
...
long sizeBuf=sizeof(buffer);
...
In ReceiveData_GetLast():
size = ... ; // Where it's coming from? Can it be wrong?
source = ... ; // Where it's coming from? Can it be wrong?
ASSERT (buffer != NULL);
ASSERT (source != NULL);
ASSERT (sizeBuf > size);
// consider adding check and return an error instead of crashing…
….
memcpy (buffer, source, size);
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
[quoted text, click to view] > Reply-To: "Rick" <rickou@rickou.net>
> From: "Rick" <rickou@rickou.net>
> Newsgroups:
microsoft.public.windowsce.embedded.vc,microsoft.public.dotnet.framework.com
pactframework,microsoft.public.dotnet.languages.vb,microsoft.public.windowsc
e.embedded.vb
[quoted text, click to view] > Followup-To: microsoft.public.windowsce.embedded.vc
> Subject: HELP !! pb calling eVC++ DLL from VB.NET on compact framework
> Date: Tue, 30 Nov 2004 11:18:06 +0100
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
> X-RFC2646: Format=Flowed; Original
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> Lines: 65
> Message-ID: <41ac48e2$0$2209$626a14ce@news.free.fr>
> Organization: Guest of ProXad - France
> NNTP-Posting-Date: 30 Nov 2004 11:18:10 MET
> NNTP-Posting-Host: 82.225.255.72
> X-Trace: 1101809890 news10-e.free.fr 2209 82.225.255.72:1305
> X-Complaints-To: abuse@proxad.net
> Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.zanker.org!npeer.de.kpn-eurorings.net!proxad
.net!infeed-1.proxad.net!news10-e.free.fr!not-for-mail
[quoted text, click to view] > Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.compactframework:66026
microsoft.public.dotnet.languages.vb:245829
microsoft.public.windowsce.embedded.vb:21461
microsoft.public.windowsce.embedded.vc:36880
[quoted text, click to view] > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> hi all !
>
> i need your HELP ! (it's long to explain but it's needed)
>
> i have a big problem (for me) with my APP/DLL
>
> i have made an Application with VB.NET for Compact framework that call an
> DLL written in eVC++ 4.
>
> the pb is i get a "First-chance exception ... Access violation"
sometimes...
>
> before my VB app are small (and i haven't the pb) but now is bigger (and i
> have the pb all the time).
>
> when i debug the DLL, at the exception if i continu, i often get a "stack
> overflow"..
>
> i have read many things on the net but i haven't found a solution for the
> pb. it seem its a limit of 4k(or 64k) boundary page pb with the stack..
> here the start of my DLL function :
>
> char __declspec(dllexport) f_com_ReadAcq(char voie,double * pValeurs, int
> *nbValeur)
> {
> UCHAR buffer[120000];
> long sizeBuf=0;
>
> ReceiveData_GetLast(&tdReceiveMemory, buffer,500, RECEIVE_DATA_ACQ, voie
> ,&sizeBuf);
> ..
> ..
> }
>
> in ReceiveData_GetLast i do some memcpy to "buffer" and it's these memcpy
> that do exception...i have try to replace the memcpy by a soft loop then
it
> crash at same time..
>
> the DLL function is called from many place on the vb.net app then in one
> case (always the same) it work...
>
> when it work, the &buffer = 0x2207F2CC
> when it crash the &buffer = 0x22011f8c
> when it crash the pointer to buffer = 0x22012000
>
> i mean it's the 1FFF to 2000 boudary that cause crash...(4k page ??)
>
> i mean i can use malloc to allocate my 120k buffer, but i'm afraid for the
> rest of development...if i have only 116 bytes of local memory available
> (0x22012000 - 0x22011f8c)...then this problem can appairs later in
> development even if i make all array with malloc............
>
> can it be VB.NET that fill the stack ?and how i can do to "free" some
bytes
> of the stack before calling DLL...?
>
> thank a lot for all people that can help me....(i'm on this pb since 3
days
> now and my app is not finished.....)
>
> Eric BOUXIROT
> (sorry for my bad english)
>
> you can answer me at bouxirot@lgm.fr
>
>
>
>
>