Page Fault while loading DLLs in CE6.0!!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

I am having serious trouble working with DLLs under Windows CE 6.0. I wrote
a small EXE (exe6.exe) that loads a DLL (dll6.dll) and (tries to) call an
exported function in it to narrow down the problem.
The DLL is generated with VS2005 SP1 and with the File | New Project |
Visual C++ | Smart Device Wizard.
I use another VS2005 SP1 + PB plugin instance to debug my Windows CE 6.0
image. I tried using conmanclient2.exe (build 8.0.50727.762 12/2/2006 3:07)
to deploy and debug, but as conmanclient2.exe also loads the DLL in memory I
am suffering the same problem here.
So next I deploy my test exe+dll via the CE FTP server. If I now run the
test program, I get the following stack trace (similar as with conmanclient2)

Call stack

KERNEL!PageInModule(_PROCESS * 0x834b83f0, _MODULE * 0x835527e4, unsigned
long 0x419d5000, int 0x00000001) line 2123 + 66 bytes
KERNEL!PageFromLoader(_PROCESS * 0x834b83f0, unsigned long 0x419d5000, int
0x00000000) line 3859 + 21 bytes
KERNEL!VMProcessPageFault(_PROCESS * 0x834b83f0, unsigned long 0x419d5000,
int 0x00000000) line 1202 + 15 bytes
KERNEL!MDHandleHardwareException(_CALLSTACK * 0xd31afbfc, _EXCEPTION_RECORD
* 0xd31afbac, _CONTEXT * 0xd31afae0, unsigned long * 0xd31afab4) line 435 +
28 bytes
KERNEL!ExceptionDispatch(_EXCEPTION_RECORD * 0xd31afbac, _CONTEXT *
0xd31afae0) line 932 + 21 bytes
KERNEL!CaptureContext() line 542
COREDLL!DoImportAndCallDllMain(_USERMODULELIST * 0x3e0217b0) line 827 + 19
bytes
COREDLL!DoLoadLibrary(const unsigned short * 0x00013858, unsigned long
0x00000000) line 352 + 9 bytes
COREDLL!int_LoadLibraryExW(const unsigned short * 0x00013858, void *
0x00000000, unsigned long 0x00000000) line 1270 + 13 bytes
COREDLL!stub_LoadLibraryExW(const unsigned short * 0x00013858, void *
0x00000000, unsigned long 0x00000000) line 27 + 17 bytes
COREDLL!LoadLibraryExW(const unsigned short * 0x00013858, void * 0x00000000,
unsigned long 0x00000000) line 1245 + 17 bytes
COREDLL!LoadLibraryW(const unsigned short * 0x00013858) line 1286 + 13 bytes
Exe6!00011038()
Exe6!00011228()
Exe6!00011115()
COREDLL!MainThreadBaseFunc(void * 0x00011100, const unsigned short *
0x3e01fc5c, const unsigned short * 0x3e01fc70, HINSTANCE__ * 0x8f6fa630,
HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000) line 1068 + 60 bytes

The page fault actually occurs at
C:\WINCE600\PRIVATE\WINCEOS\COREOS\CORE\DLL\LOADER.CPP at line 718.
line 711: PCImpHdr blockstart = (PCImpHdr) (dwBaseAddr+pImpInfo->rva);
line 712: PCImpHdr blockptr;
line 718: for (blockptr = blockstart; !dwErr && blockptr->imp_lookup;
blockptr++) { --> crash, page fault

At that time the code tries to access some data from the DLL loaded in
memory, but the pImpInfo->rva (rel virt addr) doesn't point to a valid memory
address I think (or it was not loaded in memory)
This only happens with DLLs built with VS2005 SP1 as SmartDevice applications.
I tried this with COM Dlls and normal Dlls loaded manually with
LoadLibrary() and GetProcAddress(), both generated by the VS2005 smart device
Wizard.
DLLs built with VS2005 SP1 + PB as Windows CE DLLs part of NK.BIN don't have
this problem.

I also tried to built the DLLs with VS2005 without SP1, but still the same
problem.
If I write a small EXE that doesn't load any own built (smart device or user
-for that matter-) DLLs, I have no problem. (Except that NK.BIN image is
floated with "Calling xxx_SetProcPermissions" originated from
conmanclient2.exe, but doesn't seem to cause any damage)

Anyone (MS?) that might have an idea what is going wrong or anyone faced the
same problem?

Werner

.



Relevant Pages

  • Re: Page Fault while loading DLLs in CE6.0!!
    ... Can you send me your exe and dll binaries? ... I am having serious trouble working with DLLs under Windows CE 6.0. ... but as conmanclient2.exe also loads the DLL in memory ... This only happens with DLLs built with VS2005 SP1 as SmartDevice ...
    (microsoft.public.windowsce.platbuilder)
  • Re: CMemFile not working in VC++ 6.0 RELEASE mode
    ... > Yes all my DLLs and Exe are built in release mode when I get this problem. ... > When I build them all in debug, ... bytes of memory are initialized to 0xCD. ...
    (microsoft.public.vc.mfc)
  • Re: Memory limit reached with Windows Mobile
    ... I do understand what a test is, and I do understand how memory management ... ctacke: re-read Patrick's questions, ... 1- Load the same DLL over and over. ... Loading native DLLs takes at least 64k each. ...
    (microsoft.public.pocketpc.developer)
  • Re: Explicit loading does not work
    ... This utility just prints virtual memory layout for the application with XIP attributes if any. ... Application DLLs can not be loaded at the address where XIP dlls reside. ... when this space is out, HeapAlloc begins allocating virtual memory from the XIP ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Memory limit reached with Windows Mobile
    ... ctacke: re-read Patrick's questions, ... 1- Load the same DLL over and over. ... Loading native DLLs takes at least 64k each. ... good thing due to the 64k minimum virtual memory size each will take. ...
    (microsoft.public.pocketpc.developer)