Re: Pocket PC - Pointer Crash

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




This could be the culprit... The <someaddress> pointer is pointing to bytes
inside of a structure that I generated from the Desktop PC. Which I believe
is not aligned.. Might explain why some look ups work, and others dont. Does
that mean that every member in the struct will have to be on a DWORD
boundary? This could get ugly!

Thanks for your reply!

"Chris Tacke, eMVP" wrote:

Is that <some address> DWORD aligned? The desktop allows unaligned access
(though deep down it excepts, catched is and does an aligned read, so it's
slow) but ARM-based devices don't.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Mike" <Mike@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0E18BF30-A14D-466E-8358-0B74777B49DC@xxxxxxxxxxxxxxxx
int FOO ( int attr, int objn, int occur )
{
int dbresult; // Database Result
PBYTE pWorkdata; // Pointer to our field
int nResult; // Resulting integer
PUSHORT pData;

pWorkData = <some address>

pData = (PUSHORT) pWorkdata;

<CRASH> --> nResult = *pData;

return ( nResult);
}


Hi All,

I'm relatively new developing on the Pocket PC, but have about 15 years
experience otherwise. The Pocket PC app I'm writing is written w/VS2005
using
MFC. The pocket pc is an HP IPAQ (ARM PROCESSOR). I''m creating bar-code
scanning software for our product - but I've hit a snag.

I find that if the Pocket PC application crashes or causes an exception,
nothing is displayed on the PPC screen, and when debugging, no break
window
appears, is this normal? The app I'm writing is crashing, and not crashing
like I expected, if foo() were to be called, the remainder of foo() after
the
crash point simply does not execute, but the application itself still
remains
running. Its really strange.

I've determined where the application is crashing, but I have no idea why.
I'm de-referencing a pointer who's contents/values I can view without any
problems in the memory watch window. I can de-reference the pointer in the
watch window without any problems. Everything looks okay... Anyone seen
anything like this before?

I've posted a screenshot here:

http://mikedoner.com/picture_library/screenshot019.jpg

Here's a slimmed back example of the code I'm running. Most of the
function
has been removed, but I've included this to show variable types etc:

int FOO ( int attr, int objn, int occur )
{
int dbresult; // Database Result
PBYTE pWorkdata; // Pointer to our field
int nResult; // Resulting integer
PUSHORT pData;

pWorkData = <some address>

pData = (PUSHORT) pWorkdata;

<CRASH> --> nResult = *pData;

return ( nResult);
}



This shows the value of *pData in the watch window, and the first bytes in
the memory view are the bytes that are pointed to by pData. Then second I
try
to programmatically dereference pData, all code after that point in the
current function is skipped.

Any suggestions?




.



Relevant Pages

  • Re: Pocket PC - Pointer Crash
    ... PUSHORT pData; ... I'm relatively new developing on the Pocket PC, ... problems in the memory watch window. ... int FOO ...
    (microsoft.public.pocketpc.developer)
  • Re: I dont understand the following..
    ... pointer to a pointer to a pointer? ... same thing for int*** pmask ... *pdata = NULL; ...
    (comp.lang.c)
  • I dont understand the following..
    ... What is the meaning of double*** pdata? ... pointer to a pointer to a pointer? ... same thing for int*** pmask ...
    (comp.lang.c)
  • Pass long* to VC++COM object from C#
    ... public void PutData(ref int pData, ... With the first function I pass a buffer to the component and the ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Pocket PC - Pointer Crash
    ... and a DWORD must be DWORD aligned. ... PUSHORT pData; ... int FOO ...
    (microsoft.public.pocketpc.developer)