none
ATL COM application causes exception in rpcrt4.dll for WEC2013 RRS feed

  • Question

  • Hi,

    We are new to WEC2013 development, but have been using WinCE 6.0 for many years. Our application heavily uses COM (in-process and out-of-process). While testing out porting some of our applications to WEC2013, I got a strange exception from rpcrt4.dll:

    PID:04710006 TID:04730006 Exception 'Raised Exception' (0x6e6): Thread-Id=04730006(pth=c04703bc), Proc-Id=04710006(pprc=c04701e0) 'TestCOMClient.EXE', VM-active=04710006(pprc=c04701e0) 'TestCOMClient.EXE'
    PID:04710006 TID:04730006 PC=4148362d(rpcrt4.dll+0x0001362d) RA=414947fb(rpcrt4.dll+0x000247fb) SP=0011f894, BVA=00000000

    The exception, 0x000006E6 has an error message of "An internal error occurred in a remote procedure call (RPC)." when using the Visual Studio > Tools > Error Lookup tool. Was unable to find any additional information on this exception on the internet.

    We're using Visual Studio 2015 with Update 3 and WEC2013 with the latest updates through June 2018 (although I did get this error when using WEC2013 updated through Feb 2017) and are building on a 32-bit x86 platform.

    I ended up using a very simple ATL COM application (created from scratch) to try to isolate this issue. The test app consists of a COM Server exe and a proxy-stub DLL for the server and a COM Client exe. The client will CoCreate the server (which derives from IUnknown) and then make a simple call to the server via a method that takes a LONG parameter (but doesn't do anything with that parameter other than printing it out). The CoCreate succeeds, but calling into the method does not as that's when the exception occurs (there are RETAILMSG's through out the running of the application, including right before the out-of-proc COM call to the server).

    I have registered the Server and proxy-stub prior to starting the client exe. In our OSDesign, I have the COM and DCOM (No Remoting) enabled from the catalog, below are all of the SYSGEN variables from the SysgenSettings.out file:

    SYSGEN_APPDEBUG=1
    SYSGEN_ATAPI_PCIO=1
    SYSGEN_ATL=1
    SYSGEN_AUDIO=1
    SYSGEN_AUTH=1
    SYSGEN_CERTS=1
    SYSGEN_CMD=1
    SYSGEN_CNG_CORE=1
    SYSGEN_COMMCTRL=1
    SYSGEN_COMMDLG=1
    SYSGEN_CONSOLE=1
    SYSGEN_CREDMAN=1
    SYSGEN_CRYPTO=1
    SYSGEN_CURSOR=1
    SYSGEN_DCOM=1
    SYSGEN_DSTSVC=1
    SYSGEN_FATFS=1
    SYSGEN_FIREWALL=1
    SYSGEN_FONTS_TAHOMA=1
    SYSGEN_FSDBASE=1
    SYSGEN_FSPASSWORD=1
    SYSGEN_FSRAMROM=1
    SYSGEN_FSREGRAM=1
    SYSGEN_MINGDI=1
    SYSGEN_MINGWES=1
    SYSGEN_MININPUT=1
    SYSGEN_MINNOTIFY=1
    SYSGEN_MINSHELL=1
    SYSGEN_MINWMGR=1
    SYSGEN_MSVCP=1
    SYSGEN_MSVCR=1
    SYSGEN_NETWORKING=1
    SYSGEN_NET_WFP=1
    SYSGEN_OLE=1
    SYSGEN_REDIR=1
    SYSGEN_RELFSD=1
    SYSGEN_REMOTETOOLS=1
    SYSGEN_SERVICES=1
    SYSGEN_SHELL=1
    SYSGEN_SHELLAPI=1
    SYSGEN_SNTPSVC=1
    SYSGEN_TOOLHELP=1
    SYSGEN_UIPROXY=1
    SYSGEN_USB=1
    SYSGEN_USBFN=1
    SYSGEN_USBFN_NET2280=1
    SYSGEN_USBFN_STORAGE=1
    SYSGEN_USB_HID=1
    SYSGEN_USB_HID_CLIENTS=1
    SYSGEN_USB_HID_KEYBOARD=1
    SYSGEN_USB_HID_MOUSE=1
    SYSGEN_USB_STORAGE=1
    SYSGEN_WGI_WIC=1
    SYSGEN_XPSKIN=1


    I'm not certain how to proceed in troubleshooting this issue. I feel like it must be a setting/configuration issue since originally I had this error with WEC2013 Update 39 (Feb 2017) before updating to the latest, so it would be hard pressed that no one else had this issue in all that time. Anyone seen anything like this or have any suggestions?

    Monday, July 30, 2018 8:39 PM

All replies

  • From your FLATRELEASDIR, open rpcrt4.map and locate the function that spans over 0x0001462d (notice the bold 4 not 3).

    Maybe the function name will shed some light on why or what goes wrong. If it doesn't; use a JTAGger to set a breakpoint on the function name you found, and step through the code to determine what goes wrong.

    It'll be a bit of assembly stepping, but x86 assembly is not so hard to understand so hopefully you'll be able to make out what goes wrong where.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Tuesday, July 31, 2018 11:00 AM
    Moderator
  • Hi, thanks for responding!

    I was able to obtain a call stack when the exception occurs:

        rpcrt4.dll!RpcRaiseException  @threads.cxx:270
        rpcrt4.dll!NdrpMemoryIncrement @misc.c:230
        rpcrt4.dll!NdrClientZeroOut @cltcall.c:772
        rpcrt4.dll!NdrClientCall2 @cltcall.c:1202
        rpcrt4.dll!ObjectStublessClient @stblsclt.c:2422

    However, there's not much I can do with those function names, the only one I can find information on is NdrClientCall2, but there's not much to go on. Also, unfortunately the hardware I have does not support JTAG debugging.

    The name, NdrpMemoryIncrement, suggests some type of memory access or allocation. The OS image I am running has minimal applications on it and we have plenty of RAM available (over 700 MB free according to a call to GlobalMemoryStatus). I even tweaked the FSRAMPERCENT setting in the BIB file to decrease the amount for the RAM File System so that there is even more RAM available for the OS and applications, just in case, but that did not have any effect.

    I did do a debug build on my OSDesign and received the following DEBUGCHK failure/warning when the call to the interface method in the COM server was made:

        Unknown: DEBUGCHK failed in file d:\bt\2707\private\dcom\rpc\ndr20\misc.c at line 335 

    Naturally I don't have access to the OS private code, so I don't know what else I can do with that.

    Any other thoughts or suggestions would be greatly appreciated.

    Thanks, Tim


    • Edited by TimKnor Tuesday, July 31, 2018 9:35 PM formatting
    Tuesday, July 31, 2018 9:32 PM
  • If you have very simple code to reproduce and you are sure this is a bug in MS code, you'd need to open a support ticket with MS. You won't have to pay if it turns out to be a bug.

    Go here, type "Compact 2013" and click on "Windows Embedded Compact 2013", then follow the on-screen prompts to get to file your support request. You'll have to provide your credit card number but should not be charged if it turns out to be a bug.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Wednesday, August 1, 2018 9:37 AM
    Moderator