Esempio n. 1
0
	STDMETHOD(SetSecurity) (THIS_ SECURITY_INFORMATION SecurityInformation,
		PSECURITY_DESCRIPTOR pSecurityDescriptor )
	{
		DWORD bufferLength = 0;
		MakeSelfRelativeSD(pSecurityDescriptor, NULL, &bufferLength);

		SAFEARRAY* sdArray = SafeArrayCreateVector(VT_UI1, 0, bufferLength);
		if (sdArray)
		{
			MakeSelfRelativeSD(pSecurityDescriptor, (sdArray)->pvData, &bufferLength);

			try
			{
				m_filesystem->SetPathSecurityDescriptor(m_pathName, sdArray);
			}
			catch (_com_error &e)
			{
				com_error_Message(e);
			}

			SafeArrayDestroy(sdArray);
		}

		return S_OK;
	}
void CXMiLFilesControl::PopulateFolder(DWORD parentItem, CSiteDir* pParentDir)
{
//	CWebSite* pWebSite = ((CWebSite*)m_document.p);

	pParentDir->m_bPopulated = VARIANT_TRUE;

//	ADODB::_ConnectionPtr conn = GetDBConnection();

	try
	{
		_bstr_t bstrxml = m_filesystem->GetFolderDirectoryList(pParentDir->GetFullPathName());

		CComPtr<ILDOMDocument> xmldocument;
		xmldocument.CoCreateInstance(CLSID_LDOMDocument);
		VARIANT_BOOL bsuccess;
		xmldocument->loadXML(bstrxml, &bsuccess);

		CComPtr<ILDOMElement> documentElement;
		xmldocument->get_documentElement(&documentElement);

		CComPtr<ILDOMNode> node;
		documentElement->get_firstChild(&node);
		while (node)
		{
			CComQIPtr<ILDOMElement> element = node;
			if (element)
			{
				CSiteItem* pItem = FromElement(pParentDir, element);

				if (pItem)
				{
					m_treeCtl->InsertItem((DWORD)pItem, parentItem, NULL, NULL, pItem->m_iIcon, pItem->m_cChildren, &pItem->m_treeItem);
				}
			}

			CComPtr<ILDOMNode> nextSibling;
			node->get_nextSibling(&nextSibling);
			node = nextSibling;
		}
	}
	catch (_com_error &e)
	{
		com_error_Message(e);
	}
}
HRESULT __stdcall CXMiLFilesControl::OnEndLabelEdit(long item, BSTR text)
{
//	CWebSite* pWebSite = ((CWebSite*)m_document.p);

	CSiteItem* pItem;
	m_treeCtl->GetItemInfo(item, (DWORD*)&pItem, NULL, NULL);

	if (wcscmp(_bstr_t(pItem->m_wfd.cFileName), text) != 0)
	{
		try
		{
#if 0
			pWebSite->m_webSite->RenameFile(pItem->m_dbid, text);
#endif
		}
		catch(_com_error e)
		{
			com_error_Message(e);
		}
	}

	return S_OK;
}
Esempio n. 4
0
	STDMETHOD(GetSecurity) (THIS_ SECURITY_INFORMATION RequestedInformation,
		PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
		BOOL fDefault )
	{
		try
		{
			_variant_t vsd = m_filesystem->GetPathSecurityDescriptor(m_pathName);

			SECURITY_DESCRIPTOR* self;
			SafeArrayAccessData(vsd.parray, (void**)&self);

			DWORD absSize = 0;
			DWORD daclSize = 0;
			DWORD saclSize = 0;
			DWORD ownerSize = 0;
			DWORD primGroupSize = 0;
			MakeAbsoluteSD(self, NULL, &absSize, NULL, &daclSize, NULL, &saclSize, NULL, &ownerSize, NULL, &primGroupSize);

			pSD = LocalAlloc(0, absSize);
			MakeAbsoluteSD(self,
				pSD, &absSize,
				/*pSD->Dacl =*/ (PACL)LocalAlloc(0, daclSize), &daclSize,
				/*pSD->Sacl =*/ (PACL)LocalAlloc(0, saclSize), &saclSize,
				/*pSD->Owner =*/ (PSID)LocalAlloc(0, ownerSize), &ownerSize,
				/*pSD->Group =*/ (PSID)LocalAlloc(0, primGroupSize), &primGroupSize);
			
			SafeArrayUnaccessData(vsd.parray);
		}
		catch (_com_error &e)
		{
			com_error_Message(e);
		}

		*ppSecurityDescriptor = pSD;

		return S_OK;
	}