Example #1
0
extern "C" HRESULT DAPI Iis7GetPropertyVariant(
    __in IAppHostElement *pElement,
    __in LPCWSTR wzPropName,
    __in VARIANT* vtGet
    )
{
    HRESULT hr = S_OK;
    IAppHostProperty *pProperty = NULL;
    BSTR bstrPropName = NULL;

    bstrPropName = ::SysAllocString(wzPropName);
    ExitOnNull(bstrPropName, hr, E_OUTOFMEMORY, "failed SysAllocString");

    hr = pElement->GetPropertyByName(bstrPropName, &pProperty);
    ExitOnFailure1(hr, "Failed to get property object for %ls", wzPropName);

    hr = pProperty->get_Value(vtGet);
    ExitOnFailure1(hr, "Failed to get property value for %ls", wzPropName);

LExit:
    ReleaseBSTR(bstrPropName);
    // caller responsible for cleaning up variant vtGet
    ReleaseObject(pProperty);

    return hr;
}
HRESULT CModuleConfiguration::GetDWORD(IAppHostElement* section, LPCWSTR propertyName, DWORD* value)
{
	HRESULT hr = S_OK;
    BSTR sysPropertyName = NULL;
    IAppHostProperty* prop = NULL;
	VARIANT var;

	CheckNull(value);
	*value = 0;
	VariantInit(&var);
	ErrorIf(NULL == (sysPropertyName = SysAllocString(propertyName)), ERROR_NOT_ENOUGH_MEMORY);
	CheckError(section->GetPropertyByName(sysPropertyName, &prop));
	CheckError(prop->get_Value(&var));
	CheckError(VariantChangeType(&var, &var, 0, VT_UI4));
	*value = var.ulVal;

Error:

	VariantClear(&var);

    if ( sysPropertyName )
    {
        SysFreeString(sysPropertyName);
        sysPropertyName = NULL;
    }

    if (prop)
    {
        prop->Release();
        prop = NULL;
    }

    return hr;
}
Example #3
0
HRESULT
GetElementStringProperty(
    IN          IAppHostElement *   pElement,
    IN          CONST WCHAR *       szPropName,
    OUT         STRU *              pstrPropValue
    )
{
    HRESULT hr = S_OK;
    BSTR bstrPropName = SysAllocString( szPropName );
    IAppHostProperty* pProperty = NULL;
    BSTR bstrPropValue = NULL;

    if (!bstrPropName)
    {
        hr = E_OUTOFMEMORY;
        DBGERROR_HR( hr );
        goto exit;
    }

    hr = pElement->GetPropertyByName( bstrPropName, &pProperty );
    if (FAILED(hr))
    {
        DBGERROR_HR( hr );
        goto exit;
    }

    hr = pProperty->get_StringValue( &bstrPropValue );
    if (FAILED(hr))
    {
        DBGERROR_HR( hr );
        goto exit;
    }

    hr = pstrPropValue->Copy(bstrPropValue);
    if (FAILED(hr))
    {
        DBGERROR_HR( hr );
        goto exit;
    }

exit:

    if (pProperty)
    {
        pProperty->Release();
    }

    if (bstrPropValue)
    {
        SysFreeString( bstrPropValue );
    }

    if (bstrPropName)
    {
        SysFreeString( bstrPropName );
    }

    return hr;
}
HRESULT CModuleConfiguration::GetString(IAppHostElement* section, LPCWSTR propertyName, LPWSTR* value)
{
	HRESULT hr = S_OK;
    BSTR sysPropertyName = NULL;
    BSTR sysPropertyValue = NULL;
    IAppHostProperty* prop = NULL;

	CheckNull(value);
	*value = NULL;
	ErrorIf(NULL == (sysPropertyName = SysAllocString(propertyName)), ERROR_NOT_ENOUGH_MEMORY);
	CheckError(section->GetPropertyByName(sysPropertyName, &prop));
	CheckError(prop->get_StringValue(&sysPropertyValue));
	ErrorIf(NULL == (*value = new WCHAR[wcslen(sysPropertyValue) + 1]), ERROR_NOT_ENOUGH_MEMORY);
	wcscpy(*value, sysPropertyValue);

Error:

    if ( sysPropertyName )
    {
        SysFreeString(sysPropertyName);
        sysPropertyName = NULL;
    }

    if ( sysPropertyValue )
    {
        SysFreeString(sysPropertyValue);
        sysPropertyValue = NULL;
    }

    if (prop)
    {
        prop->Release();
        prop = NULL;
    }

    return hr;
}
	void cleanup() 
	{
			if ( pElemProp != NULL )
			{
				pElemProp->Release();
				pElemProp = NULL;
			}
			if ( pElemProps != NULL )
			{
				pElemProps->Release(); 
				pElemProps = NULL;
			}
			if ( pElem != NULL )
			{
				pElem->Release();
				pElem = NULL;
			}
			if ( pElemColl != NULL )
			{
				pElemColl->Release(); 
				pElemColl = NULL;
			}
			if ( pParentElem != NULL )
			{
				pParentElem->Release(); 
				pParentElem = NULL;
			}
			if ( pMgr != NULL )
			{
				pMgr->Release(); 
				pMgr = NULL;
			}

			SysFreeString( bstrConfigCommitPath );
			SysFreeString( bstrSectionName );
			SysFreeString( bstrPropertyName );

			CoUninitialize();
	}
HRESULT CModuleConfiguration::CreateNodeEnvironment(IHttpContext* ctx, DWORD debugPort, PCH namedPipe, PCH* env)
{
	HRESULT hr;
	LPCH currentEnvironment = NULL;
	LPCH tmpStart, tmpIndex = NULL;
	DWORD tmpSize;
	DWORD environmentSize;
	IAppHostElement* section = NULL;
	IAppHostElementCollection* appSettings = NULL;
	IAppHostElement* entry = NULL;
	IAppHostPropertyCollection* properties = NULL;
	IAppHostProperty* prop = NULL;
	BSTR keyPropertyName = NULL;
	BSTR valuePropertyName = NULL;
	VARIANT vKeyPropertyName;
	VARIANT vValuePropertyName;
	DWORD count;
	BSTR propertyValue;
	int propertySize;

	CheckNull(env);
	*env = NULL;

	// this is a zero terminated list of zero terminated strings of the form <var>=<value>

	// calculate size of current environment

	ErrorIf(NULL == (currentEnvironment = GetEnvironmentStrings()), GetLastError());
	environmentSize = 0;
	do {
		while (*(currentEnvironment + environmentSize++) != 0);
	} while (*(currentEnvironment + environmentSize++) != 0);

	// allocate memory for new environment variables

	tmpSize = 32767 - environmentSize;
	ErrorIf(NULL == (tmpIndex = tmpStart = new char[tmpSize]), ERROR_NOT_ENOUGH_MEMORY);
	RtlZeroMemory(tmpIndex, tmpSize);

	// set PORT and IISNODE_VERSION variables

	ErrorIf(tmpSize < (strlen(namedPipe) + strlen(IISNODE_VERSION) + 6 + 17), ERROR_NOT_ENOUGH_MEMORY);
	sprintf(tmpIndex, "PORT=%s", namedPipe);
	tmpIndex += strlen(namedPipe) + 6;
	sprintf(tmpIndex, "IISNODE_VERSION=%s", IISNODE_VERSION);
	tmpIndex += strlen(IISNODE_VERSION) + 17;

	// set DEBUGPORT environment variable if requested (used by node-inspector)

	if (debugPort > 0)
	{
		char debugPortS[64];
		sprintf(debugPortS, "%d", debugPort);
		ErrorIf((tmpSize - (tmpIndex - tmpStart)) < (strlen(debugPortS) + 11), ERROR_NOT_ENOUGH_MEMORY);
		sprintf(tmpIndex, "DEBUGPORT=%s", debugPortS);
		tmpIndex += strlen(debugPortS) + 11;
	}
		
	// add environment variables from the appSettings section of config

	ErrorIf(NULL == (keyPropertyName = SysAllocString(L"key")), ERROR_NOT_ENOUGH_MEMORY);
	vKeyPropertyName.vt = VT_BSTR;
	vKeyPropertyName.bstrVal = keyPropertyName;
	ErrorIf(NULL == (valuePropertyName = SysAllocString(L"value")), ERROR_NOT_ENOUGH_MEMORY);
	vValuePropertyName.vt = VT_BSTR;
	vValuePropertyName.bstrVal = valuePropertyName;
	CheckError(GetConfigSection(ctx, &section, L"appSettings"));
	CheckError(section->get_Collection(&appSettings));
	CheckError(appSettings->get_Count(&count));

	for (USHORT i = 0; i < count; i++)
	{
		VARIANT index;
		index.vt = VT_I2;
		index.iVal = i;		

		CheckError(appSettings->get_Item(index, &entry));
		CheckError(entry->get_Properties(&properties));
		
		CheckError(properties->get_Item(vKeyPropertyName, &prop));
		CheckError(prop->get_StringValue(&propertyValue));
		ErrorIf(0 == (propertySize = WideCharToMultiByte(CP_ACP, 0, propertyValue, wcslen(propertyValue), NULL, 0, NULL, NULL)), E_FAIL);
		ErrorIf((propertySize + 2) > (tmpSize - (tmpStart - tmpIndex)), ERROR_NOT_ENOUGH_MEMORY);
		ErrorIf(propertySize != WideCharToMultiByte(CP_ACP, 0, propertyValue, wcslen(propertyValue), tmpIndex, propertySize, NULL, NULL), E_FAIL);
		tmpIndex[propertySize] = '=';
		tmpIndex += propertySize + 1;
		SysFreeString(propertyValue);
		propertyValue = NULL;
		prop->Release();
		prop = NULL;

		CheckError(properties->get_Item(vValuePropertyName, &prop));
		CheckError(prop->get_StringValue(&propertyValue));
		ErrorIf(0 == (propertySize = WideCharToMultiByte(CP_ACP, 0, propertyValue, wcslen(propertyValue), NULL, 0, NULL, NULL)), E_FAIL);
		ErrorIf((propertySize + 1) > (tmpSize - (tmpStart - tmpIndex)), ERROR_NOT_ENOUGH_MEMORY);
		ErrorIf(propertySize != WideCharToMultiByte(CP_ACP, 0, propertyValue, wcslen(propertyValue), tmpIndex, propertySize, NULL, NULL), E_FAIL);
		tmpIndex += propertySize + 1;
		SysFreeString(propertyValue);
		propertyValue = NULL;
		prop->Release();
		prop = NULL;

		properties->Release();
		properties = NULL;
		entry->Release();
		entry = NULL;
	}

	// concatenate new environment variables with the current environment block

	ErrorIf(NULL == (*env = (LPCH)new char[environmentSize + (tmpIndex - tmpStart)]), ERROR_NOT_ENOUGH_MEMORY);	
	memcpy(*env, tmpStart, (tmpIndex - tmpStart));
	memcpy(*env + (tmpIndex - tmpStart), currentEnvironment, environmentSize);

	// cleanup

	FreeEnvironmentStrings(currentEnvironment);
	section->Release();
	appSettings->Release();
	SysFreeString(keyPropertyName);
	SysFreeString(valuePropertyName);
	delete [] tmpStart;

	return S_OK;
Error:

	if (currentEnvironment)
	{
		FreeEnvironmentStrings(currentEnvironment);
		currentEnvironment = NULL;
	}

	if (section)
	{
		section->Release();
		section = NULL;
	}

	if (appSettings)
	{
		appSettings->Release();
		appSettings = NULL;
	}

	if (keyPropertyName)
	{
		SysFreeString(keyPropertyName);
		keyPropertyName = NULL;
	}

	if (valuePropertyName)
	{
		SysFreeString(valuePropertyName);
		valuePropertyName = NULL;
	}

	if (entry)
	{
		entry->Release();
		entry = NULL;
	}

	if (properties)
	{
		properties->Release();
		properties = NULL;
	}

	if (prop)
	{
		prop->Release();
		prop = NULL;
	}

	if (propertyValue)
	{
		SysFreeString(propertyValue);
		propertyValue = NULL;
	}

	if (tmpStart)
	{
		delete [] tmpStart;
		tmpStart = NULL;
	}

	return hr;
}
Example #7
0
HRESULT 
MODSECURITY_STORED_CONTEXT::GetStringPropertyValue( 
        IAppHostElement*            pElement,
        WCHAR*                      pszPropertyName,
        IAppHostPropertyException** pException,
        WCHAR**                     ppszValue )
{
    HRESULT                 hr              = S_OK;
    IAppHostProperty        *pProperty      = NULL;    
    DWORD                   dwLength;
    VARIANT                 vPropertyValue;

    if ( 
           ( pElement        == NULL ) || 
           ( pszPropertyName == NULL ) ||
           ( pException      == NULL ) ||
           ( ppszValue       == NULL )
       )
    {
        hr = E_INVALIDARG;
        goto Failure;
    }

    *ppszValue = NULL;

    // Get the property object for the string attribute:
    hr = pElement->GetPropertyByName( 
                        pszPropertyName,
                        &pProperty );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    if ( pProperty == NULL )
    {
        hr = E_UNEXPECTED;
        goto Failure;
    }

    // Get the attribute value:
    VariantInit( &vPropertyValue );

    hr = pProperty->get_Value( &vPropertyValue );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    // See it there is an exception that might be due to the actual value in the 
    // config not meeting validation criteria
    *pException = NULL;

    hr = pProperty->get_Exception( pException );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    // No need to continue if we got an exception...
    if ( ( *pException ) != NULL )
    {
        goto Failure;
    }

    // Finally, get the value:
    dwLength = SysStringLen( vPropertyValue.bstrVal );
    *ppszValue = new WCHAR[ dwLength + 1 ];

    if ( (*ppszValue) == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Failure;
    }

    wcsncpy(
        *ppszValue,
        vPropertyValue.bstrVal,
        dwLength );

    (*ppszValue)[ dwLength ] = L'\0';
    
Failure:
    VariantClear( &vPropertyValue );

    if ( pProperty != NULL )
    {
        pProperty->Release();
        pProperty = NULL;
    }

    return hr;
}
Example #8
0
HRESULT 
MODSECURITY_STORED_CONTEXT::GetTimeSpanPropertyValue( 
        IAppHostElement*            pElement,
        WCHAR*                      pszPropertyName,
        IAppHostPropertyException** pException,
        ULONGLONG*                 pnValue )
{
    HRESULT                 hr              = S_OK;
    IAppHostProperty        *pProperty      = NULL;    
    VARIANT                 vPropertyValue;

    if ( 
           ( pElement        == NULL ) || 
           ( pszPropertyName == NULL ) ||
           ( pException      == NULL ) ||
           ( pnValue         == NULL )
       )
    {
        hr = E_INVALIDARG;
        goto Failure;
    }

    // Get the property object for the INT attribute:
    hr = pElement->GetPropertyByName( 
                        pszPropertyName,
                        &pProperty );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    if ( pProperty == NULL )
    {
        hr = E_UNEXPECTED;
        goto Failure;
    }

    // Get the attribute value:
    VariantInit( &vPropertyValue );

    hr = pProperty->get_Value( &vPropertyValue );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    // See it there is an exception that might be due to the actual value in the 
    // config not meeting validation criteria
    *pException = NULL;

    hr = pProperty->get_Exception( pException );

    if ( FAILED( hr ) )
    {
        goto Failure;
    }

    // No need to continue if we got an exception...
    if ( ( *pException ) != NULL )
    {
        goto Failure;
    }

    // Finally, get the value:
    *pnValue =  vPropertyValue.ullVal;  

Failure:
    VariantClear( &vPropertyValue );

    if ( pProperty != NULL )
    {
        pProperty->Release();
        pProperty = NULL;
    }

    return hr;
}
	REQUEST_NOTIFICATION_STATUS OnSendResponse( IN IHttpContext * pHttpContext, IN ISendResponseProvider * pProvider )
	{
			UNREFERENCED_PARAMETER( pProvider );

			pMgr        = NULL;
			pParentElem = NULL;
			pElemColl   = NULL;
			pElem       = NULL;
			pElemProps  = NULL;
			pElemProp   = NULL;

			hr                   = S_OK;
			bstrConfigCommitPath = SysAllocString( L"MACHINE/WEBROOT/APPHOST" );
			bstrSectionName      = SysAllocString( L"system.webServer/stripHeaders" );
			bstrPropertyName     = SysAllocString( L"name" );
			dwElementCount       = 0;
			vtPropertyName.vt            = VT_BSTR;
			vtPropertyName.bstrVal       = bstrPropertyName;

			// Initialize
			hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
			if ( FAILED( hr ) )
			{
				// Set the error status.
				pProvider->SetErrorStatus( hr );
				// cleanup
				cleanup();
				// End additional processing.
				return RQ_NOTIFICATION_FINISH_REQUEST;
			}

			// Create
			hr = CoCreateInstance( __uuidof( AppHostAdminManager ), NULL, 
					CLSCTX_INPROC_SERVER,
					__uuidof( IAppHostAdminManager ), (void**) &pMgr );
			if( FAILED( hr ) )
			{
				pProvider->SetErrorStatus( hr );
				cleanup();
				return RQ_NOTIFICATION_FINISH_REQUEST;
			}

			// Get the admin section
			hr = pMgr->GetAdminSection( bstrSectionName, bstrConfigCommitPath, &pParentElem );
			if ( FAILED( hr ) || ( &pParentElem == NULL ) )
			{
				pProvider->SetErrorStatus( hr );
				cleanup();
				return RQ_NOTIFICATION_FINISH_REQUEST;
			}


			// Get the site collection
			hr = pParentElem->get_Collection( &pElemColl );
			if ( FAILED ( hr ) || ( &pElemColl == NULL ) )
			{
				pProvider->SetErrorStatus( hr );
				cleanup();
				return RQ_NOTIFICATION_FINISH_REQUEST;
			}

			// Get the elements
			hr = pElemColl->get_Count( &dwElementCount );
			for ( USHORT i = 0; i < dwElementCount; i++ )
			{
				VARIANT vtItemIndex;
				vtItemIndex.vt = VT_I2;
				vtItemIndex.iVal = i;

				// Add a new section group
				hr = pElemColl->get_Item( vtItemIndex, &pElem );
				if ( FAILED( hr ) || ( &pElem == NULL ) )
				{
					pProvider->SetErrorStatus( hr );
					cleanup();
					return RQ_NOTIFICATION_FINISH_REQUEST;
				}

				// Get the child elements
				hr = pElem->get_Properties( &pElemProps );
				if ( FAILED( hr ) || ( &pElemProps == NULL ) )
				{
					pProvider->SetErrorStatus( hr );
					cleanup();
					return RQ_NOTIFICATION_FINISH_REQUEST;
				}

				hr = pElemProps->get_Item( vtPropertyName, &pElemProp );
				if ( FAILED( hr ) || ( pElemProp == NULL ) )
				{
					pProvider->SetErrorStatus( hr );
					cleanup();
					return RQ_NOTIFICATION_FINISH_REQUEST;
				}

				hr = pElemProp->get_Value( &vtValue );
				if ( FAILED( hr ) )
				{
					pProvider->SetErrorStatus( hr );
					cleanup();
					return RQ_NOTIFICATION_FINISH_REQUEST;
				}

				// Retrieve a pointer to the response.
				IHttpResponse * pHttpResponse = pHttpContext->GetResponse();

				// Test for an error.
				if ( pHttpResponse != NULL )
				{
					// convert bstr to string in order to delete header
					_bstr_t header( vtValue.bstrVal );

					// delete header
					hr = pHttpResponse->DeleteHeader( (char *)header );

					// Test for an error.
					if ( FAILED( hr ) )
					{
						// Set the error status.
						pProvider->SetErrorStatus( hr );
						// cleanup
						cleanup();
						// End additional processing.
						return RQ_NOTIFICATION_FINISH_REQUEST;
					}
				}

				// loop_cleanup
				if ( pElem != NULL )
				{
					pElem->Release(); 
					pElem = NULL;
				}
			}

			cleanup();
			// Return processing to the pipeline.
			return RQ_NOTIFICATION_CONTINUE;
		}
Example #10
0
HRESULT
GetElementRawTimeSpanProperty(
    IN IAppHostElement * pElement,
    IN LPCWSTR           pszPropertyName,
    OUT ULONGLONG *      pulonglong
)
{
    HRESULT hr = S_OK;
    BSTR    bstrPropertyName = NULL;
    IAppHostProperty * pProperty = NULL;
    VARIANT            varValue;

    VariantInit( &varValue );

    bstrPropertyName = SysAllocString( pszPropertyName );
    if ( bstrPropertyName == NULL )
    {
        hr = HRESULT_FROM_WIN32( ERROR_NOT_ENOUGH_MEMORY );
        goto Finished;
    }

    // Now ask for the property and if it succeeds it is returned directly back
    hr = pElement->GetPropertyByName( bstrPropertyName, &pProperty );
    if ( FAILED ( hr ) )
    {
       goto Finished;
    }

    // Now let's get the property and then extract it from the Variant.
    hr = pProperty->get_Value( &varValue );
    if ( FAILED ( hr ) )
    {
         goto Finished;
    }

    hr = VariantChangeType( &varValue, &varValue, 0, VT_UI8 );
    if ( FAILED ( hr ) )
    {
         goto Finished;
    }

    // extract the value
    *pulonglong = varValue.ullVal;


Finished:

    VariantClear( &varValue );

    if ( bstrPropertyName != NULL )
    {
        SysFreeString( bstrPropertyName );
        bstrPropertyName = NULL;
    }

    if ( pProperty != NULL )
    {
        pProperty->Release();
        pProperty = NULL;
    }

    return hr;

} // end of Config_GetRawTimeSpanProperty
Example #11
0
HRESULT
GetElementLONGLONGProperty(
    IN  IAppHostElement * pSitesCollectionEntry,
    IN  LPCWSTR           pwszName,
    OUT LONGLONG *        pllValue
)
{
    HRESULT            hr = S_OK;
    IAppHostProperty * pProperty = NULL;
    BSTR               bstrName = NULL;
    VARIANT            varValue;

    VariantInit( &varValue );

    bstrName = SysAllocString( pwszName );
    if ( bstrName == NULL )
    {
        hr = E_OUTOFMEMORY;
        DBGERROR_HR(hr);
        goto error;
    }

    hr = pSitesCollectionEntry->GetPropertyByName( bstrName,
                                                   &pProperty );
    if ( FAILED ( hr ) )
    {
        goto error;
    }

    hr = pProperty->get_Value( &varValue );
    if ( FAILED ( hr ) )
    {
         goto error;
    }

    hr = VariantChangeType( &varValue, &varValue, 0, VT_I8 );
    if ( FAILED ( hr ) )
    {
         goto error;
    }

    // extract the value
    *pllValue = varValue.ulVal;

error:

    VariantClear( &varValue );

    if ( pProperty != NULL )
    {
        pProperty->Release();
        pProperty = NULL;
    }

    if ( bstrName != NULL )
    {
        SysFreeString( bstrName );
        bstrName = NULL;
    }

    return hr;
}
Example #12
0
HRESULT
GetElementBoolProperty(
    IN IAppHostElement * pElement,
    IN LPCWSTR           pszPropertyName,
    OUT BOOL *           pBool
)
{
    HRESULT hr = S_OK;
    BSTR    bstrPropertyName = NULL;
    IAppHostProperty * pProperty = NULL;
    VARIANT            varValue;

    VariantInit( &varValue );

    bstrPropertyName = SysAllocString( pszPropertyName );
    if ( bstrPropertyName == NULL )
    {
        hr = E_OUTOFMEMORY;
        DBGERROR_HR(hr);
        goto exit;
    }

    // Now ask for the property and if it succeeds it is returned directly back.
    hr = pElement->GetPropertyByName( bstrPropertyName, &pProperty );
    if ( FAILED ( hr ) )
    {
       goto exit;
    }

    // Now let's get the property and then extract it from the Variant.
    hr = pProperty->get_Value( &varValue );
    if ( FAILED ( hr ) )
    {
         goto exit;
    }

    hr = VariantChangeType( &varValue, &varValue, 0, VT_BOOL );
    if ( FAILED ( hr ) )
    {
         goto exit;
    }

    // extract the value
    *pBool = ( V_BOOL( &varValue ) == VARIANT_TRUE );

exit:

    VariantClear( &varValue );

    if ( bstrPropertyName != NULL )
    {
        SysFreeString( bstrPropertyName );
        bstrPropertyName = NULL;
    }

    if ( pProperty != NULL )
    {
        pProperty->Release();
        pProperty = NULL;
    }

    return hr;

}