// @pymethod int|PyIQueryAssociations|GetKey|Searches for and retrieves a file association-related key from the registry.
PyObject *PyIQueryAssociations::GetKey(PyObject *self, PyObject *args)
{
	IQueryAssociations *pIQA = GetI(self);
	if ( pIQA == NULL )
		return NULL;
	// @pyparm int|flags||Used to control the search. 
	// @pyparm int|assocKey||Specifies the type of key that is to be returned.
    // @pyparm string||extra|Optional string with information about the location of the key.
    // It is normally set to a shell verb such as 'open'. Set this parameter to None if it is not used. 
    int flags, assoc;
    PyObject *obExtra = Py_None;
    HKEY ret = NULL;
    WCHAR *pszExtra= NULL;
	if (!PyArg_ParseTuple(args, "ii|O:GetKey", &flags, &assoc, &obExtra))
		return NULL;
	if (!PyWinObject_AsWCHAR(obExtra, &pszExtra, TRUE))
        return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIQA->GetKey( flags, (ASSOCKEY)assoc, pszExtra, &ret);
	PyWinObject_FreeWCHAR(pszExtra);
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIQA, IID_IQueryAssociations );
	// observation of the "open handles" count in task-manager indicates
	// this key needs to be closed!
	return PyWinObject_FromHKEY(ret);
}
// IEmptyVolumeCache2
// @object PyIEmptyVolumeCache2|See also <o PyIEmptyVolumeCache>
// @pymeth PyIEmptyVolumeCache|Deactivate
// @pymethod |PyIEmptyVolumeCache2|InitializeEx|
STDMETHODIMP PyGEmptyVolumeCache2::InitializeEx(
		/* [in] */ HKEY hkRegKey,
		/* [in] */ LPCWSTR pcwszVolume,
		/* [in] */ LPCWSTR pcwszKeyName,
		/* [out] */ LPWSTR * ppwszDisplayName,
		/* [out] */ LPWSTR * ppwszDescription,
		/* [out] */ LPWSTR * ppwszBtnText,
		/* [out] */ DWORD * pdwFlags)
{
	PY_GATEWAY_METHOD;
	BOOL bPythonIsHappy = TRUE;
	ULONG dwFlags;
	HRESULT hr;
	PyObject *result;
	PyObject *obppwszDisplayName; 
	PyObject *obppwszDescription;
	PyObject *obppwszBtnText; 
	PyObject *obpcwszVolume = NULL;
	PyObject *obpcwszKeyName = NULL;
	PyObject *obhkRegKey = PyWinObject_FromHKEY(hkRegKey);
	if (!obhkRegKey) goto args_failed;
	if (!(obpcwszVolume = MakeOLECHARToObj(pcwszVolume))) goto args_failed;
	if (!(obpcwszKeyName = MakeOLECHARToObj(pcwszKeyName))) goto args_failed;
	hr=InvokeViaPolicy("InitializeEx", &result, "NNNk", obhkRegKey, obpcwszVolume, obpcwszKeyName, *pdwFlags);
	// NOTE: From here, do *not* exit via args_failed - the args have been cleaned up
	if (FAILED(hr)) return hr;
	// Process the Python results, and convert back to the real params

	if (!PyTuple_Check(result)) {
		PyErr_Format(PyExc_TypeError, 
				"Initialize must return a tuple of (unicode, unicode, unicode, long) - got '%s'",
				result->ob_type->tp_name);
		bPythonIsHappy = FALSE;
	}
	if (bPythonIsHappy && !PyArg_ParseTuple(result, "OOOl" , &obppwszDisplayName, &obppwszDescription, &obppwszBtnText, &dwFlags))
		bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDisplayName, ppwszDisplayName)) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszDescription, ppwszDescription)) bPythonIsHappy = FALSE;
	if (bPythonIsHappy && !PyWinObject_AsWCHAR(obppwszBtnText, ppwszBtnText)) bPythonIsHappy = FALSE;
	if (!bPythonIsHappy) hr = PyCom_SetAndLogCOMErrorFromPyException("InitializeEx", IID_IEmptyVolumeCache);
	if (pdwFlags) *pdwFlags = dwFlags;

	Py_DECREF(result);
	return hr;
args_failed:
	// only hit on error convering input args, not normal exit.
	Py_XDECREF(obhkRegKey);
	Py_XDECREF(obpcwszVolume);
	Py_XDECREF(obpcwszKeyName);
	return MAKE_PYCOM_GATEWAY_FAILURE_CODE("InitializeEx");
}