本文整理汇总了C++中CFile::GetFileToken方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::GetFileToken方法的具体用法?C++ CFile::GetFileToken怎么用?C++ CFile::GetFileToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetFileToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LinkResource
HRESULT CAsmLink::LinkResource(mdAssembly AssemblyID, LPCWSTR pszFileName, LPCWSTR pszNewLocation, LPCWSTR pszResourceName, DWORD dwFlags)
{
ASSERT(m_bInited && !m_bPreClosed);
ASSERT(AssemblyID == TokenFromRid(mdtAssembly, 1) || AssemblyID == AssemblyIsUBM);
if (wcslen(pszFileName) > MAX_PATH)
return FileNameTooLong(pszFileName); // File name too long
HRESULT hr = S_OK;
if (AssemblyID == AssemblyIsUBM) {
hr = E_INVALIDARG;
} else {
if (pszNewLocation == NULL || pszNewLocation[0] == 0)
pszNewLocation = pszFileName;
CFile *file = NULL;
file = new CFile( pszNewLocation, (IMetaDataEmit*)NULL, m_pError, this);
if (file != NULL && pszNewLocation != NULL && pszNewLocation[0] != 0 &&
wcscmp(pszFileName, pszNewLocation) != 0) {
if (FAILED(hr = file->SetSource(pszFileName))) {
delete file;
return hr;
}
}
hr = m_pAssem->AddFile( file, ffContainsNoMetaData, NULL);
if (SUCCEEDED(hr))
hr = m_pAssem->AddResource(file->GetFileToken(), pszResourceName, 0, dwFlags);
else
delete file;
}
return hr;
}
示例2: ExportType
HRESULT CAsmLink::ExportType(mdAssembly AssemblyID, mdToken FileToken, mdTypeDef TypeToken,
LPCWSTR pszTypename, DWORD dwFlags, mdExportedType* pType)
{
ASSERT(m_bInited && !m_bPreClosed);
ASSERT(AssemblyID == TokenFromRid(mdtAssembly, 1) || AssemblyID == AssemblyIsUBM);
ASSERT(AssemblyID == FileToken || (RidFromToken(FileToken) < m_pAssem->CountFiles() && TypeFromToken(FileToken) == mdtFile));
if (AssemblyID == AssemblyIsUBM || FileToken == AssemblyID)
return S_FALSE;
HRESULT hr;
CFile *file = NULL;
if (FAILED(hr = m_pAssem->GetFile(RidFromToken(FileToken), &file)))
return hr;
return m_pAssem->AddExportType( file->GetFileToken(), TypeToken, pszTypename, dwFlags, pType);
}
示例3: EmbedResource
HRESULT CAsmLink::EmbedResource(mdAssembly AssemblyID, mdToken FileToken, LPCWSTR pszResourceName, DWORD dwOffset, DWORD dwFlags)
{
ASSERT(m_bInited && !m_bPreClosed);
ASSERT(AssemblyID == TokenFromRid(mdtAssembly, 1) || AssemblyID == AssemblyIsUBM);
ASSERT((RidFromToken(FileToken) < m_pAssem->CountFiles() && TypeFromToken(FileToken) == mdtFile) ||
(FileToken == AssemblyID));
HRESULT hr = S_OK;
CFile *file = NULL;
if (AssemblyID == AssemblyIsUBM) {
if (SUCCEEDED(hr = m_pAssem->GetFile(FileToken, &file)))
hr = file->AddResource(mdTokenNil, pszResourceName, dwOffset, dwFlags);
} else if (FileToken == AssemblyID) {
hr = m_pAssem->AddResource(mdTokenNil, pszResourceName, dwOffset, dwFlags);
} else {
if (SUCCEEDED(hr = m_pAssem->GetFile(FileToken, &file)))
hr = m_pAssem->AddResource(file->GetFileToken(), pszResourceName, dwOffset, dwFlags);
}
return hr;
}