Microsoft KB Archive/305794

= 0x000006ba error if you open an existing queue on a Virtual Server =

Article ID: 305794

Article Last Modified on 2/23/2007

-

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  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:  Create a custom resource DLL in Microsoft Visual Studio 6.0.  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( &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(, NULL, NULL, NULL, FALSE,               CREATE_UNICODE_ENVIRONMENT, Environment, pszExpandedDir, &StartupInfo,                &Process); 

Note The &quot; &quot; in the function call 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.
 * The code saves this information to the environment block for the process.
 * The code creates a new process that runs in the context of the virtual server.

Make your Message Queuing calls in this new process.



STATUS
This behavior is by design.

Keywords: kbprb KB305794

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.