📄 query.cpp
字号:
IfNullFail(rgPropertyRestriction[iProp].prval.puuid =
new CLSID(*pguidServiceType));
uPr = PrOfVar(prelServiceType);
rgPropertyRestriction[iProp].rel =
uPr == UINT_MAX ? PREQ : uPr;
rgPropertyRestriction[iProp].prop = PROPID_Q_TYPE;
rgPropertyRestriction[iProp].prval.vt = VT_CLSID;
iProp++;
}
}
if (pstrLabel->vt != VT_ERROR) {
rgPropertyRestriction[iProp].prval.vt = VT_ERROR;
if (IsValidRel(prelLabel)) {
if ((bstrTemp = GetBstr(pstrLabel)) == NULL) {
// NULL label interpreted as empty string
// so don't do anything here... we'll convert
// it to an explicit empty string below...
//
}
UINT cch;
// SysFreeString(m_bstrLabel);
// IfNullFail(m_bstrLabel = SYSALLOCSTRING(bstrTemp));
IfNullFail(rgPropertyRestriction[iProp].prval.pwszVal =
new WCHAR[(cch = SysStringLen(bstrTemp)) + 1]);
wcsncpy(rgPropertyRestriction[iProp].prval.pwszVal,
bstrTemp,
cch);
// null terminate
rgPropertyRestriction[iProp].prval.pwszVal[cch] = 0;
uPr = PrOfVar(prelLabel);
rgPropertyRestriction[iProp].prop = PROPID_Q_LABEL;
rgPropertyRestriction[iProp].prval.vt = VT_LPWSTR;
rgPropertyRestriction[iProp].rel =
uPr == UINT_MAX ? PREQ : uPr;
iProp++;
}
}
if (pdateCreateTime->vt != VT_ERROR) {
rgPropertyRestriction[iProp].prval.vt = VT_ERROR;
if (IsValidRel(prelCreateTime)) {
if (!VariantTimeToTime(pdateCreateTime, &ulTime)) {
IfFailGo(hresult = E_INVALIDARG);
}
rgPropertyRestriction[iProp].prop = PROPID_Q_CREATE_TIME;
rgPropertyRestriction[iProp].prval.vt = VT_UI4;
rgPropertyRestriction[iProp].prval.lVal = (long)ulTime;
uPr = PrOfVar(prelCreateTime);
rgPropertyRestriction[iProp].rel =
uPr == UINT_MAX ? PREQ : uPr;
iProp++;
}
}
if (pdateModifyTime->vt != VT_ERROR) {
rgPropertyRestriction[iProp].prval.vt = VT_ERROR;
if (IsValidRel(prelModifyTime)) {
if (!VariantTimeToTime(pdateModifyTime, &ulTime)) {
IfFailGo(hresult = E_INVALIDARG);
}
rgPropertyRestriction[iProp].prop = PROPID_Q_MODIFY_TIME;
rgPropertyRestriction[iProp].prval.vt = VT_UI4;
rgPropertyRestriction[iProp].prval.lVal = (long)ulTime;
uPr = PrOfVar(prelModifyTime);
rgPropertyRestriction[iProp].rel =
uPr == UINT_MAX ? PREQ : uPr;
iProp++;
}
}
//
// Column set
// For now we just return in the following order:
// pathname
// CONSIDER: optimization: return instance guid instead of pathname
//
cCol = 1;
pcolumnset->aCol = new PROPID[cCol];
pcolumnset->cCol = cCol;
pcolumnset->aCol[0] = PROPID_Q_PATHNAME;
// fall through...
Error:
delete [] pguidQueue;
delete [] pguidServiceType;
return hresult;
#endif // 0
}
//=--------------------------------------------------------------------------=
// CMSMQQuery::LookupQueue
//=--------------------------------------------------------------------------=
//
// Parameters:
// [IN] strGuidQueue
// [IN] strGuidServiceType
// [IN] strLabel
// [IN] dateCreateTime
// [IN] dateModifyTime
// [IN] relServiceType
// [IN] relLabel
// [IN] relCreateTime
// [IN] relModifyTime
// [OUT] ppqinfos
//
// Output:
// HRESULT - S_OK, E_NOINTERFACE
//
// Notes:
//
HRESULT CMSMQQuery::LookupQueue(
VARIANT *strGuidQueue,
VARIANT *strGuidServiceType,
VARIANT *strLabel,
VARIANT *dateCreateTime,
VARIANT *dateModifyTime,
VARIANT *relServiceType,
VARIANT *relLabel,
VARIANT *relCreateTime,
VARIANT *relModifyTime,
IMSMQQueueInfos **ppqinfos)
{
return E_NOTIMPL;
#if 0 // not implemented on CE
MQRESTRICTION *prestriction;
MQCOLUMNSET *pcolumnset;
CMSMQQueueInfos *pqinfos = NULL;
HRESULT hresult = NOERROR;
*ppqinfos = NULL;
IfNullRet(prestriction = new MQRESTRICTION);
IfNullFail(pcolumnset = new MQCOLUMNSET);
IfNullFail(pqinfos = new CMSMQQueueInfos(NULL));
//
// important for cleanup to work
//
pcolumnset->aCol = NULL;
prestriction->paPropRes = NULL;
prestriction->cRes = 0;
IfFailGoTo(CreateRestriction(strGuidQueue,
strGuidServiceType,
strLabel,
dateCreateTime,
dateModifyTime,
relServiceType,
relLabel,
relCreateTime,
relModifyTime,
prestriction,
pcolumnset),
Error2);
//
// prestriction, pcolumnset ownership transfers
//
IfFailGoTo(pqinfos->Init(NULL, // context
prestriction,
pcolumnset,
NULL), // sort
Error2);
*ppqinfos = pqinfos;
//
// fall through...
//
Error2:
if (FAILED(hresult)) {
FreeRestriction(prestriction);
FreeColumnSet(pcolumnset);
}
//
// fall through...
//
Error:
if (FAILED(hresult)) {
RELEASE(pqinfos);
delete prestriction;
delete pcolumnset;
}
return CreateErrorHelper(hresult, m_ObjectType);
#endif // 0
}
#if 0
//
// UNDONE: post-beta2
//
//=--------------------------------------------------------------------------=
// CMSMQQuery::LookupSite
//=--------------------------------------------------------------------------=
//
// Parameters:
// [IN] strName
// [IN] strGuidSite
// [OUT] ppsites
//
// Output:
// HRESULT - S_OK, E_NOINTERFACE
//
// Notes:
//
HRESULT CMSMQQuery::LookupSite(
VARIANT FAR* strName,
VARIANT FAR* strGuidSite,
IMSMQSites FAR* FAR* ppsites)
{
return E_NOTIMPL;
// return ::LookupSite(strName, strGuidSite, ppsites);
}
//=--------------------------------------------------------------------------=
// CMSMQQuery::LookupMachine
//=--------------------------------------------------------------------------=
//
// Parameters:
//
// Output:
// HRESULT - S_OK, E_NOINTERFACE
//
// Notes:
//
HRESULT CMSMQQuery::LookupMachine(
VARIANT FAR* strPathname,
VARIANT FAR* strSitename,
VARIANT FAR* strGuidSite,
VARIANT FAR* strGuidmachine,
VARIANT FAR* lService,
IMSMQMachines FAR* FAR* ppmachines)
{
return E_NOTIMPL;
#if 0
return ::LookupMachine(
strPathname,
strSitename,
strGuidSite,
strGuidmachine,
lService,
ppmachines);
#endif // 0
}
//=--------------------------------------------------------------------------=
// CMSMQQuery::LookupCN
//=--------------------------------------------------------------------------=
//
// Parameters:
//
// Output:
// HRESULT - S_OK, E_NOINTERFACE
//
// Notes:
//
HRESULT CMSMQQuery::LookupCN(
VARIANT FAR* strName,
VARIANT FAR* lProtocol,
VARIANT FAR* strGuidCN,
IMSMQCNs FAR* FAR* ppcns)
{
return E_NOTIMPL;
// return ::LookupCN(strName, lProtocol, strGuidCN, ppcns);
}
#endif // 0
//=--------------------------------------------------------------------------=
// static CMSMQQuery::FreeRestriction
//=--------------------------------------------------------------------------=
// Frees dynamic memory allocated on behalf of an
// MQRESTRICTION struct.
//
// Parameters:
// prestriction
//
// Output:
//
// Notes:
//
void CMSMQQuery::FreeRestriction(MQRESTRICTION *prestriction)
{
MQPROPERTYRESTRICTION *rgPropertyRestriction;
UINT cRestriction, iProp;
PROPID prop;
if (prestriction) {
cRestriction = prestriction->cRes;
rgPropertyRestriction = prestriction->paPropRes;
for (iProp = 0; iProp < cRestriction; iProp++) {
prop = rgPropertyRestriction[iProp].prop;
switch (prop) {
case PROPID_Q_INSTANCE:
case PROPID_Q_TYPE:
delete [] rgPropertyRestriction[iProp].prval.puuid;
break;
case PROPID_Q_LABEL:
delete [] rgPropertyRestriction[iProp].prval.pwszVal;
break;
} // switch
} // for
delete [] rgPropertyRestriction;
prestriction->paPropRes = NULL;
}
}
//=--------------------------------------------------------------------------=
// static CMSMQQuery::FreeColumnSet
//=--------------------------------------------------------------------------=
// Frees dynamic memory allocated on behalf of an
// MQCOLUMNSET struct.
//
// Parameters:
// pcolumnset
//
// Output:
//
// Notes:
//
void CMSMQQuery::FreeColumnSet(MQCOLUMNSET *pcolumnset)
{
if (pcolumnset) {
delete [] pcolumnset->aCol;
pcolumnset->aCol = NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -