0x000006ba error if you open an existing queue on a Virtual Server (305794)



The information in this article applies to:

  • Microsoft Message Queuing 2.0

This article was previously published under Q305794

SYMPTOMS

If you open an existing queue on a virtual server, you receive a 0x000006ba error.

CAUSE

A cluster resource DLL runs in the context of the local node. However, if you spawn a new process from the resource DLL, the new process runs in the context of the cluster. Message Queuing (also known as MSMQ) calls are made from the new process.

WORKAROUND

To work around this issue, follow these steps:
  1. Create a custom resource DLL in Microsoft Visual Studio 6.0.
  2. Add the following code to the do...while() loop in the xxxOnlineThread() call (error detection is removed from the code sample):
    RESOURCE_STATUS      resourceStatus;
    DWORD                nStatus;
    STARTUPINFO         StartupInfo;
    PROCESS_INFORMATION Process;
    LPWSTR              pszNameOfPropInError;
    LPWSTR              pszExpandedDir = NULL;
    LPWSTR              pszExpandedCommand = NULL;
    
    // Create Process parameters
    LPVOID   Environment = NULL;
    HANDLE processToken;
    HANDLE currentProcess;
    HANDLE hEventLog;
    DWORD nStatus = ResUtilGetPropertiesToParameterBlock(
                   pResourceEntry->hkeyParameters,
                   GenAppResourcePrivateProperties,
                   reinterpret_cast<LPBYTE>( &pResourceEntry->props ),
                   TRUE, // CheckForRequiredProperties
                   &pszNameOfPropInError
                   );
    // Perform resource-specific initialization before starting the app.
    if ( pResourceEntry->props.nUseNetworkName ) {
    // Create the new environment with the simulated net name.
    
    LPVOID   Environment = NULL;
    Environment = ResUtilGetEnvironmentWithNetName(pResourceEntry->hResource);
    } 
    else {
    
    // get the current process token. If it fails, revert to using just the
    // system environment area
    currentProcess = GetCurrentProcess();
    OpenProcessToken(currentProcess, MAXIMUM_ALLOWED, &processToken);
    // Clone the current environment, picking up any changes that might have
    // been made after resmon started
    CreateEnvironmentBlock(&Environment, processToken, FALSE);
    // Expand the current directory parameter
    if (pResourceEntry->props.pszCurrentDirectory) {
    pszExpandedDir = xxxExpandEnvironmentStrings(pResourceEntry->props.pszCurrentDirectory);
    } 
    // Try to start the new process
    				CreateProcess(<Enter Executable Name Here>,
     NULL, NULL, NULL, FALSE,
    				CREATE_UNICODE_ENVIRONMENT,
     Environment, pszExpandedDir, &StartupInfo,
    				&Process);
Note The "xxx" in the function call (pszExpandedDir = xxxExpandEnvironmentStrings(pResourceEntry->props.pszCurrentDirectory) corresponds to the name of the resource DLL.

This code does the following things:
  • The code sets up the environment block with the UseNetnameAsComputerName property (ResUtilGetEnvironmentWithNetName(...)).
  • The code saves this information to the environment block for the process (CreateEnvironmentBlock(...)).
  • The code creates a new process that runs in the context of the virtual server (CreateProcess(...)).

Make your Message Queuing calls in this new process.

STATUS

This behavior is by design.

Modification Type:MajorLast Reviewed:4/20/2005
Keywords:kbprb KB305794