www.Walzer.cn - Tech & Management Blog

Focus on mobile dev
本博客文章,未在标题中写明转载的, 均为原创.
所谓高手,也就是熟悉别人制定的游戏规则、并且能在规则内跳舞的人。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

"Out of Memory" and Required components for ActiveSync

Posted on 2006-02-05 11:49  Walzer  阅读(1497)  评论(0编辑  收藏  举报
Author: Walzer
Date:    2005.5.20

    At first I was so puzzled by this problem for several days. I connected my target to PC by usb and wana enable ActiveSync, the usb serial function seems work well and  repllog.exe is autoloaded. But on the target, there jumps out a  warning window with the title "Out of Memory", and the descriptions are "Cannot connect to PC. No program memory available. Stop some programs, and try again. If the problem persist, reset your device according to the owner's manual".
    This platform have 32MB flash  and 32MB SDRAM. I burn nk.nb0 (20M) into the flash and use XIP, so the memory must be enough for this application. But what's the problem?
    The debug messages are shown below.
 
0x83f21000: [NOTIFY] HandleSystemEvent 9 none
0x83f21000: [NOTIFY] HandleSystemEvent found repllog.exe for event 9
0x83f21000: [NOTIFY] HandleSystemEvent schedules immediate notify for repllog.exe AppRunAtRs232Detect
0x83f21000: [NOTIFY] SetUserNotification (or replacing 00000000)
0x83f21000: [NOTIFY] SetUserNotification::Setting event semaphore
0x83f21000: [NOTIFY] ProcessDatabase::started at local time 01/01/2003 12:00:42
0x83f24434: NOTIFICATION::NewPacket attempt to exec 0000073e:repllog.exe AppRunAtRs232Detect
0x83d14000: >>> Loading module coredll.dll at address 0x03F40000-0x03FF4000 (RW data at 0x01FFE000-0x01FFF145)
0x83d14000: >>> Loading module ws2.dll at address 0x03BB0000-0x03BC4000 (RW data at 0x01FCD000-0x01FCDB24)
0x83d14000: >>> Loading module winsock.dll at address 0x03BD0000-0x03BD6000 (RW data at 0x01FCF000-0x01FCF08C)
Loaded symbols for 'D:\SOURCE_CODE\WINCE500\PBWORKSPACES\WINDOWTV\RELDIR\WINDOWTV_ARMV4I_DEBUG\WINSOCK.DLL'
0x83d14000: >>> Loading module repllog.exe at address 0x0E010000-0x0E02E000
Loaded symbols for 'D:\SOURCE_CODE\WINCE500\PBWORKSPACES\WINDOWTV\RELDIR\WINDOWTV_ARMV4I_DEBUG\REPLLOG.EXE'
0x83d14000: RLOG: [0x43F24D0E] Started with cmdline: AppRunAtRs232Detect
0x83d14000: AddToProcessInputLocaleTable: Added process to ProcessInputLocale table, hProcess = 0x43D3A242
0x83d14000: RLOG: [0x43F24D0E] Using '`USB' connection
0x83d14000: RLOG: [0x43F24D0E] Welcome to repllog. Port in use: Dccman: 5679; RRA: 5678
0x83d14000: RLOG: [0x43F24D0E] WM_WINDOWREADY
0x83d14000: RLOG: [0x43F24D0E] About to run rapisrv.exe
0x83f24434: [NOTIFY] DeleteUserNotification 0000073e
0x83f24434: [NOTIFY] DeleteUserNotification: 0000073e deleted
0x83e84bb4: >>> Loading module coredll.dll at address 0x03F40000-0x03FF4000 (RW data at 0x01FFE000-0x01FFF145)
0x83e84bb4: >>> Loading module ws2.dll at address 0x03BB0000-0x03BC4000 (RW data at 0x01FCD000-0x01FCDB24)
0x83e84bb4: >>> Loading module winsock.dll at address 0x03BD0000-0x03BD6000 (RW data at 0x01FCF000-0x01FCF08C)
0x83e84bb4: >>> Loading module rapisrv.exe at address 0x10010000-0x10031000
Loaded symbols for 'D:\SOURCE_CODE\WINCE500\PBWORKSPACES\WINDOWTV\RELDIR\WINDOWTV_ARMV4I_DEBUG\RAPISRV.EXE'
0x83e84bb4: AddToProcessInputLocaleTable: Added process to ProcessInputLocale table, hProcess = 0xE3D4A1BE
RpcSrv: Rapi Server running on DeviceType: 2
0x83d14000: RLOG: [0x43F24D0E] Using '`USB' connection
0x83d14000: RLOG: [0x43F24D0E] About to run rnaapp.exe -n -m -e"`USB"
RpcSrv: Winsock Started version 1.1
0x83d01000: >>> Loading module wspm.dll at address 0x03B90000-0x03B97000 (RW data at 0x01FC9000-0x01FC9154)
Loaded symbols for 'D:\SOURCE_CODE\WINCE500\PBWORKSPACES\WINDOWTV\RELDIR\WINDOWTV_ARMV4I_DEBUG\WSPM.DLL'
RpcSrv: SocketBufSize=16384 bytes
0x83d01000: <RPC:RESLIST> 
0x83d01000: CResList::CResList()
0x83d01928: CreateNewProc failure on rnaapp.exe!
0x83d14000: RLOG: [0x43F24D0E] CreateProcess rnaapp.exe failed. GetLastError: 2

0x83d14000: Grow Gdi handle table from 448 to 512
0x83d14000: DlgMgr: FindDlgItem id 1 returning NULL.
 
BTW, the source code of rapllog.exe is at private\datasync\apps\conn31\rep\repllog\ . But Microsoft haven't publish these codes yet.
 
----------------------------------------------------------------------------------------------------------------
 
In fact, "out of memory" is a fake message. I asked it on the newsgroup and someone tell me they have seen a similar message when missing a required OS component. I am so sorry to say that, the dependency checks on ActiveSync in WinCE5.0 are not very good, so we have to add them into our OSDesign manually.
 
The required and relative components are:
  (1) Core OS->Applications - End User->ActiveSync->File Sync
  (2) Core OS->Communication Services and Networking->Networking - Wide Area Network (WAN)->Dial Up Networking (RAS/PPP) 
  (3) Core OS->Communication Services and Networking->Networking - Wide Area Network (WAN)->Telephony API (TAPI 2.0)->Unimodem Support
  (4) Core OS->Shell and User Interface->User Interface->Network User Interface
 
----------------------------------------------------------------------------------------------------------------
 
After the system completely booted, we need to creat a new connection in control pannel -> Dial Up Networking. Select USB direct connection then OK, for example use the default name "My Connection".  In the other hand, set PC connection to the newly created "My Connection". Now connect the USB cable, and the ActiveSync on desktop will sound a dulcet tune~~~
 
But these two steps we can wirte them into registry before. To take an easy way, I compare the registry on traget device before these settings and after it, and these are the changes:
 
[HKEY_CURRENT_USER\Comm\RasBook\USB Connection]
"Entry"=hex:\
      08,02,40,00,00,00,00,00,00,00,00,00,00,00,00,00,f4,db,04,12,d0,77,01,7c,01,\
      00,00,00,01,00,00,00,01,00,00,00,1c,e3,04,12,0a,00,00,00,74,dc,04,12,01,00,\
      00,00,18,dc,04,12,68,53,03,00,f0,4b,01,7c,18,dc,04,12,d8,55,03,00,20,dc,04,\
      12,ca,1b,05,12,00,00,00,00,00,00,00,00,00,00,00,00,f0,4b,01,7c,00,00,00,00,\
      0a,00,00,00,00,00,00,00,ec,3b,37,03,54,dc,04,12,f0,4b,01,7c,00,1c,1a,00,00,\
      00,00,00,07,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
      00,00,b8,dd,04,12,00,00,00,00,f0,aa,00,00,08,00,00,00,00,00,00,00,0a,00,00,\
      00,00,00,00,00,4c,f7,f6,03,00,00,00,00,6c,02,00,00,00,00,00,00,4a,c0,d7,83,\
      00,00,00,00,a4,dc,04,12,00,00,00,00,f0,4b,01,7c,01,00,00,00,04,6e,f6,03,b0,\
      dc,04,12,b8,c5,14,80,38,22,05,00,c0,71,01,7c,38,22,05,00,38,22,05,00,b0,dc,\
      04,12,c0,71,01,7c,f0,4b,01,7c,01,00,00,00,4a,c0,d7,83,74,dc,04,12,74,dc,04,\
      12,0a,00,00,00,01,00,00,00,eb,ff,ff,ff,4a,cf,d7,83,00,00,00,00,00,00,00,00,\
      00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,64,00,69,00,72,\
      00,65,00,63,00,74,00,00,00,04,12,00,00,00,00,00,00,00,00,0a,00,00,00,f0,4b,\
      01,7c,f0,4b,55,00,53,00,42,00,20,00,43,00,61,00,62,00,6c,00,65,00,3a,00,00,\
      00,00,00,00,00,a0,6f,fe,80,00,00,00,00,01,00,00,00,0a,00,00,00,02,00,00,00,\
      00,00,00,00,78,dd,04,12,b4,df,0f,00,d0,77,01,7c,89,01,00,00,00,00,00,00,ca,\
      1b,05,12,0a,00,00,00,7c,09,f6,03,00,00,00,00,0a,00,00,00,00,00,00,00,0a,00,\
      00,00,0a,00,00,00,ca,1b,05,12,b0,dd,04,12,b8,af,0f,00,00,ca,2a,0a,81,00,00,\
      00,ca,1b,05,12,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,ca,2a,0a,\
      ca,1b,05,12,50,18,00,00,03,00,00,00,05,00,00,00,74,66,2a,0a,df,fd,ff,ff,00,\
      00,00,00,4a,c0,d7,83,ca,1b,05,12,88,01,00,00,7c,fd,ff,ff,84,02,00,00,94,66,\
      2a,0a,00,de,04,12,00,00,00,00,0c,de,04,12,0c,de,04,12,04,6e,f6,03,0c,de,04,\
      12,9c,66,2a,0a,80,12,05,00,a0,5f,01,7c,80,12,05,00,80,12,05,00,0c,de,04,12,\
      a0,5f,01,7c,80,22,05,00,80,22,05,00,00,00,00,00,44,e0,04,12,18,08,e3,03,00,\
      00,00,00,d4,e1,e2,03,08,00,00,00,0a,00,00,00,01,00,00,00,01,00,00,00,38,22,\
      05,00,00,ca,2a,0a,4a,c0,d7,83,ca,1b,05,12,ca,1b,05,00,ca,1b,05,00,0c,00,00,\
      00,7c,09,f6,03,00,00,00,00,0a,00,00,00,88,de,04,12,cc,f3,f6,03,88,de,04,12,\
      4c,f7,f6,03,4a,c0,d7,83,4a,c0,d7,83,e4,b9,14,80,4a,c0,d7,83,a8,de,04,12,fc,\
      5c,08,00,ca,1b,05,12,ac,de,04,12,4a,c0,d7,83,4a,c0,d7,83,00,00,00,00,4a,c0,\
      d7,83,d6,9a,f9,e3,01,00,00,00,4a,c0,d7,83,00,ff,04,12,f0,4b,01,7c,f0,4b,01,\
      7c,64,aa,0f,00,4a,cf,d7,83,01,00,00,00,01,00,00,00,00,00,00,00,f4,de,04,12,\
      58,bf,02,00,00,00,00,00,f0,4b,01,7c,04,df,04,12,b4,5b,08,00,18,df,04,12,28,\
      df,04,12,10,df,04,12,01,00,00,00,00,00,00,00,ca,1b,05,12,00,00,00,00,00,87,\
      03,00,d6,9a,f9,e3,0a,00,00,00,00,00,00,00,d0,76,01,7c,00,4b,01,7c,64,aa,0f,\
      00,ca,1b,05,12,01,00,00,00,0a,00,00,00,00,00,00,00,d0,76,01,7c,01,00,00,00,\
      01,4b,01,7c,38,df,04,12,01,df,04,12,60,c1,02,00,d0,76,01,7c,01,00,00,00,01,\
      00,00,00,01,00,00,00,1c,e3,04,12,0a,00,00,00,f4,df,04,12,01,00,00,00,98,df,\
      04,12,68,53,03,00,f0,4b,01,7c,98,df,04,12,d8,55,03,00,a0,df,04,12,ca,1b,05,\
      12,00,00,00,00,00,00,00,00,00,00,00,12,00,00,00,00,00,00,00,00,01,00,00,00,\
      fc,82,cb,03,20,8f,d4,83,a0,6f,fe,80,a0,6f,fe,80,02,00,00,00,00,00,00,12,dc,\
      df,04,12,bc,0a,12,80,e4,fc,d3,83,01,00,00,00,20,8f,d4,83,a0,6f,fe,80,a0,6f,\
      fe,80,02,00,00,00,e4,fc,d3,83,a0,e0,04,12,00,00,00,00,20,8f,d4,83,d0,1f,f7,\
      83,00,00,00,00,00,00,00,00,fc,82,cb,03,00,00,00,00,0f,00,00,00,f0,6a,fe,80,\
      fc,82,cb,03,20,8f,d4,83,00,00,00,00,00,00,00,00,ec,df,04,12,01,d2,06,00,01,\
      00,00,00,23,00,00,00,00,00,00,00
 
[HKEY_CURRENT_USER\ControlPanel\Comm]
    "Cnct"="USB Connection"
 
I can't understand what does the table of hexes mean, but it did work well in the registry. So, after the system booted, we can conntect usb cable and enable ActiveSync automatically without any manual settings.