BUG: MSMQQueue.Receive Fails with MQ_ERROR_INVALID_PARAMETER (0xC00E0006) (236151)



The information in this article applies to:

  • Microsoft Message Queue Server (MSMQ) 1.0

This article was previously published under Q236151

SYMPTOMS

With Microsoft Message Queue Server (MSMQ), there is an intermittent failure of MSMQQueue.Receive where eventually Receive fails with MQ_ERROR_INVALID_PARAMETER (0xC00E0006). The error message would look like the following:
An invalid parameter passed to a function.

CAUSE

Microsoft Message Queue Server prematurely unloads Mtxdm.dll.

RESOLUTION

Explicitly call the LoadLibrary API function for Mtxdm.dll when your program begins execution. Keep a reference to this library in your code and free this reference with FreeLibrary API function when your program ends. This will keep the DLL loaded in memory. To do this, complete the following steps:

  • Using Microsoft Visual C++:

    Add the following code to your function:
    HMODULE hModuleMTXDM;
    
    // Program execution begins 
    hModuleMTXDM = LoadLibrary(_T("mtxdm.dll"));<BR/>
       .
       .
       .
    // Program execution ends
    FreeLibrary(hModuleMTXDM);
    						
  • Using Microsoft Visual Basic:

    1. Add the following API declarations to a module in your project:
      Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
      Public Declare Function FreeLibrary Lib "kernel32" Alias "FreeLibrary" (ByVal hLibModule As Long) As Long
      								
    2. Add a variable to hold the handle of the library to your project:
      Dim hModuleMTXDM as Long
      								
    3. When your program begins execution, explicitly load the library:
      hModuleMTXDM = LoadLibary("mtxdm.dll")
      								
    4. When your program is ending, free the reference to the library:
      FreeLibrary(hModuleMTXDM)
      								
Also, you can keep the reference to the DLL and just exit from your application. This will unload any libraries that were loaded in your process space.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbDSupport KB236151