Error 998 when running from remote server

Discussion in 'Microsoft VC .NET' started by Grumpy Old Coder, Feb 25, 2009.

  1. [Apologies for all the posts. Still trying to get the right 'no-spam alias'
    to trigger an official response]

    I've got several applications which fail to run from a remote server. That
    is, if I browse to C:\.... and double-click the app starts right up, but if I
    browse to \\anotherMachine\c$\... and double-click, I get a dialog box titled
    "MyApp.exe - MSCOREE.DLL", stating:

    Failed to delay load library urlmon.dll (Win32 error: 998).
    This program can no longer run and will now terminate.

    The application is written in C++,but uses a library using managed code
    (.NET 1.1). I've tried loosening up all the security settings I could find,
    but still haven't had any luck. Other applicaitons in the same project work
    fine.

    All have been developed using Visual Studio 2003.

    Has anyone else run into (and, even better, solved) this problem?

    Thanks!
     
    Grumpy Old Coder, Feb 25, 2009
    #1
    1. Advertisements

  2. Good morning Grumpy Old Coder. Welcome to Microsoft Newsgroup Support
    service. My name is Jialiang Ge [MSFT]. It's my pleasure to work with you
    on this thread.

    The question is about the error "Failed to delay load library urlmon.dll
    (Win32 error: 998)" when you start a C++ app (am I right that this is a
    native C++ app, not a managed C++ one?) from a remote computer through the
    network shared folder "\\machine\C$\...". The C++ application hosts CLR
    (http://support.microsoft.com/kb/953836) to use a .NET 1.1 assembly.

    Although I do not have a direct answer for the question because the problem
    may be related to some app/env specific factors, I do have several valuable
    suggestions to narrow down the problem and figure out the solution
    gradually.

    Let's start with the analysis of the error message:
    "Failed to delay load library urlmon.dll (Win32 error: 998)"

    "delay load library urlmon.dll" should result from the fact that, CLR
    hoster implicitly links mscoree.dll (either 1.1 version or 2.0 version
    depending on whether the machine is installed with .NET 2.0) that
    delay-loads URLMON.dll. You can view this using the tool Dependency Walker
    http://www.dependencywalker.com/. URLMON.dll, the OLE32 Extension for
    Win32, is a part of Windows located in the folder C:\Windows\System32.
    URLMON.dll is not loaded in the load time, and it's loaded only when the
    app runs from a remote machine (e.g. from \\machine\C$\...) so as to
    perform the internet security checking
    (URLMON.dll!CoInternetCreateSecurityManager). This can be the reason for
    the symptom that the error is not thrown when the app runs locally.

    I'm also reminded about a very similar case that I once handled. In that
    case, the customer had an application written in native C++ (CLR support is
    off), which calls a WinForm code (written in C#) through a C++ wrapper DLL
    that supports CLR. The native C++ application is using implicit linking to
    load the C++ wrapper DLL. In some of the deployment machines the
    application fails to launch. I analyzed the memory dump from the customer
    with the loader snaps, and find that the loader is failing to load modules,
    so the process exits without any information. I found that the winmm.dll is
    statically linked with the application. After I removed the static linking
    to winmm.dll, and used the LoadLibrary API (explicit linking) to call the
    winmm.dll function, the issue was resolved. It appears that loading
    winmm.dll sometime interferes with delayload. A similar report is here:
    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
    kID=329819. Grumpy Old Coder, please check whether your app has winmm.dll
    linked. The tool Dependency Walker can help.

    A very effective and easy trouble-shooting skill for module-loading
    problems is to use the function "Profile" in Dependency Walker
    (http://www.dependencywalker.com/). It records the load of the modules and
    the function calls when an app runs. Please refer to this article for the
    steps to use Depends to get the profiling log
    http://support.microsoft.com/kb/256872. You can then either analyze the log
    by yourself, or send the log to my mailbox: .

    The Win32 error 998 means ERROR_NOACCESS (Invalid access to memory
    location.), which is the Win32 error code of the Windows status code
    STATUS_ACCESS_VIOLATION. In other words, the operating system loader
    encounters an access violation while mapping the specified DLL file image
    (urlmon.dll in this case) or executing the startup code. To trouble-shoot
    this failure, it is also necessary to run the application under a debugger
    and enable first chance exception handling for the C0000005 Access
    Violation exception. If an access violation occurs when the LoadLibrary()
    function is called, the application will break into the debugger. The
    debugger's call stack can then be used to trace where the exception
    occurred. The stack trace should help you narrow down the actual problem
    related to the exception being encountered. Here is an KB article that
    provide more info of this: http://support.microsoft.com/kb/196069. Grumpy
    Old Coder, if you are fine with debugging, you may consider setting up
    windbg to debug the problem. Otherwise, please capture a memory dump
    http://support.microsoft.com/kb/286350 when the error occurs and send the
    dump to me. Please note that my previous suggestions (checking winmm.dll,
    capturing dependent logs) are easier to do than debugging. I suggest trying
    those skills first.

    Last but not least, I notice that you have tried a lot of times setting the
    no-spam account of our service since Jan. The account is configured
    rightly. In future, you may consider contacting this email address:
    or reading this article
    http://blogs.msdn.com/msdnts/pages/postingAlias.aspx. My managers take
    immediate action to guide you to configure the account as soon as they see
    the email.

    Best Regards,
    Jialiang Ge (, remove 'online.')
    Microsoft Online Community Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    MSDN Managed Newsgroup support offering is for non-urgent issues where an
    initial response from the community or a Microsoft Support Engineer within
    2 business day is acceptable. Please note that each follow up response may
    take approximately 2 business days as the support professional working with
    you may need further investigation to reach the most efficient resolution.
    The offering is not appropriate for situations that require urgent,
    real-time or phone-based interactions. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Jialiang Ge [MSFT], Feb 26, 2009
    #2
    1. Advertisements

  3. Hello Grumpy Old Coder,

    It has been a couple of days since my last reply. I am writing to check the
    status of the issue on your side. Would you mind letting me know the result
    of the suggestions? If you need further assistance, feel free to let me
    know. I will be more than happy to be of assistance.

    Have a great day!

    Regards,
    Jialiang Ge (, remove 'online.')
    Microsoft Online Community Support

    =================================================
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    This posting is provided "AS IS" with no warranties, and confers no rights.
    =================================================
     
    Jialiang Ge [MSFT], Mar 2, 2009
    #3
  4. Thanks for checking up. We're shifting offices, so I haven't been able to
    look too deeply into it yet, but I confirmed that the application is loading
    winmm.dll. Another post you referenced suggests delay loading could solve
    the problem. How do I know what to delay-load?

    Thanks,
    Mike
     
    Grumpy Old Coder, Mar 5, 2009
    #4
  5. Hello Mike

    You need to dynamically load (aka explicitly link) or try delay-loading
    winmm.dll so that the module is not loaded until one of its symbols needs
    to be called. I have the successful experience of using dynamically loading
    winmm.dll to solve the error 998, but I did not have a chance to try
    delay-loading winmm.dll. It deserves your test.

    If you are not acquainted with the use of dynamic loading or dalay-loading,
    I think that some simple examples can help you quickly ramp up the
    knowledge. Our team recently created a project on CodePlex named
    All-In-One Code Framework (CodeFx).

    http://cfx.codeplex.com/

    In the "Examples for Library", you can find the examples of dynamic-loading
    and delay-loading in CppLoadLibrary, and CppDelayloadDll. Each example has
    a ReadMe.txt file that documents the example in detail.

    If you have any additional questions or concerns, please feel free to tell
    me.

    Regards,
    Jialiang Ge (, remove 'online.')
    Microsoft Online Community Support

    =================================================
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    This posting is provided "AS IS" with no warranties, and confers no rights.
    =================================================
     
    Jialiang Ge [MSFT], Mar 6, 2009
    #5
  6. Supplement my last reply:

    "Delay load the modules dependent on WINMM.dll"

    To find out the module that depends on winmm.dll, you can use Dependency
    Walker, the tool that I mentioned in the first reply. It can dump the
    dependency tree for you.

    Regards,
    Jialiang Ge (, remove 'online.')
    Microsoft Online Community Support

    =================================================
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    This posting is provided "AS IS" with no warranties, and confers no rights.
    =================================================
     
    Jialiang Ge [MSFT], Mar 6, 2009
    #6
  7. Hello Mike

    How are you? Are you going along well with my suggestion? If you need
    further assistance, feel free to let me know. I will be more than happy to
    be of assistance.

    Have a great day!

    Regards,
    Jialiang Ge (, remove 'online.')
    Microsoft Online Community Support

    =================================================
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    This posting is provided "AS IS" with no warranties, and confers no rights.
    =================================================
     
    Jialiang Ge [MSFT], Mar 10, 2009
    #7
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    205
    Darren Kennedy
    Mar 19, 2004
  2. Grumpy Old Coder

    Error 998 when running from remote server

    Grumpy Old Coder, Jan 8, 2009, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    311
    Grumpy Old Coder
    Jan 8, 2009
  3. Grumpy Old Coder

    Error 998 when running from remote server

    Grumpy Old Coder, Jan 20, 2009, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    329
    Grumpy Old Coder
    Jan 20, 2009
  4. Grumpy Old Coder

    Error 998 when running from remote server

    Grumpy Old Coder, Jan 21, 2009, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    278
    Grumpy Old Coder
    Jan 21, 2009
  5. Grumpy Old Coder

    Error 998 when running from remote server

    Grumpy Old Coder, Feb 25, 2009, in forum: Microsoft VC .NET
    Replies:
    0
    Views:
    294
    Grumpy Old Coder
    Feb 25, 2009
Loading...

Share This Page