这篇教程C++ CoTaskMemFree函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CoTaskMemFree函数的典型用法代码示例。如果您正苦于以下问题:C++ CoTaskMemFree函数的具体用法?C++ CoTaskMemFree怎么用?C++ CoTaskMemFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CoTaskMemFree函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SHFree/************************************************************************* * SHFree [SHELL32.195] * * Equivalent to CoTaskMemFree. Under Windows 9x this function could use * the shell32 built-in "mini-COM" without the need to load ole32.dll - * see SHLoadOLE for details. * * NOTES * exported by ordinal * * SEE ALSO * CoTaskMemFree, SHLoadOLE */void WINAPI SHFree(LPVOID pv){ TRACE("%p/n",pv); CoTaskMemFree(pv);}
开发者ID:YokoZar,项目名称:wine,代码行数:18,
示例2: DEVENUM_ReadPinTypesstatic void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS *rgPin){ HKEY hkeyTypes = NULL; DWORD dwMajorTypes, i; REGPINTYPES *lpMediaType = NULL; DWORD dwMediaTypeSize = 0; if (RegOpenKeyExW(hkeyPinKey, wszTypes, 0, KEY_READ, &hkeyTypes) != ERROR_SUCCESS) return ; if (RegQueryInfoKeyW(hkeyTypes, NULL, NULL, NULL, &dwMajorTypes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { RegCloseKey(hkeyTypes); return ; } for (i = 0; i < dwMajorTypes; i++) { HKEY hkeyMajorType = NULL; WCHAR wszMajorTypeName[64]; DWORD cName = sizeof(wszMajorTypeName) / sizeof(WCHAR); DWORD dwMinorTypes, i1; if (RegEnumKeyExW(hkeyTypes, i, wszMajorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue; if (RegOpenKeyExW(hkeyTypes, wszMajorTypeName, 0, KEY_READ, &hkeyMajorType) != ERROR_SUCCESS) continue; if (RegQueryInfoKeyW(hkeyMajorType, NULL, NULL, NULL, &dwMinorTypes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { RegCloseKey(hkeyMajorType); continue; } for (i1 = 0; i1 < dwMinorTypes; i1++) { WCHAR wszMinorTypeName[64]; CLSID *clsMajorType = NULL, *clsMinorType = NULL; HRESULT hr; cName = sizeof(wszMinorTypeName) / sizeof(WCHAR); if (RegEnumKeyExW(hkeyMajorType, i1, wszMinorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue; clsMinorType = CoTaskMemAlloc(sizeof(CLSID)); if (!clsMinorType) continue; clsMajorType = CoTaskMemAlloc(sizeof(CLSID)); if (!clsMajorType) goto error_cleanup_types; hr = CLSIDFromString(wszMinorTypeName, clsMinorType); if (FAILED(hr)) goto error_cleanup_types; hr = CLSIDFromString(wszMajorTypeName, clsMajorType); if (FAILED(hr)) goto error_cleanup_types; if (rgPin->nMediaTypes == dwMediaTypeSize) { DWORD dwNewSize = dwMediaTypeSize + (dwMediaTypeSize < 2 ? 1 : dwMediaTypeSize / 2); REGPINTYPES *lpNewMediaType; lpNewMediaType = CoTaskMemRealloc(lpMediaType, sizeof(REGPINTYPES) * dwNewSize); if (!lpNewMediaType) goto error_cleanup_types; lpMediaType = lpNewMediaType; dwMediaTypeSize = dwNewSize; } lpMediaType[rgPin->nMediaTypes].clsMajorType = clsMajorType; lpMediaType[rgPin->nMediaTypes].clsMinorType = clsMinorType; rgPin->nMediaTypes++; continue; error_cleanup_types: if (clsMajorType) CoTaskMemFree(clsMajorType); if (clsMinorType) CoTaskMemFree(clsMinorType); } RegCloseKey(hkeyMajorType); } RegCloseKey(hkeyTypes); if (lpMediaType && !rgPin->nMediaTypes) { CoTaskMemFree(lpMediaType); lpMediaType = NULL; } rgPin->lpMediaType = lpMediaType;}
开发者ID:GYGit,项目名称:reactos,代码行数:92,
示例3: DEVENUM_RegisterLegacyAmFilters//.........这里部分代码省略......... HKEY hkeyInstance = NULL; if (RegEnumKeyExW(hkeyFilter, i, wszFilterSubkeyName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue; hr = DEVENUM_GetCategoryKey(&CLSID_LegacyAmFilterCategory, &hkeyCategoryBaseKey, wszRegKey, MAX_PATH); if (FAILED(hr)) continue; strcatW(wszRegKey, wszRegSeparator); strcatW(wszRegKey, wszFilterSubkeyName); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszRegKey, 0, KEY_READ, &hkeyInstance) == ERROR_SUCCESS) { RegCloseKey(hkeyInstance); } else { /* Filter is registered the IFilterMapper(1)-way in HKCR/Filter. Needs to be added to * legacy am filter category. */ HKEY hkeyFilterClass = NULL; REGFILTER2 rgf2; CLSID clsidFilter; WCHAR wszFilterName[MAX_PATH]; DWORD Type; DWORD cbData; HRESULT res; IMoniker *pMoniker = NULL; TRACE("Registering %s/n", debugstr_w(wszFilterSubkeyName)); strcpyW(wszRegKey, clsid_keyname); strcatW(wszRegKey, wszRegSeparator); strcatW(wszRegKey, wszFilterSubkeyName); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszRegKey, 0, KEY_READ, &hkeyFilterClass) != ERROR_SUCCESS) continue; rgf2.dwVersion = 1; rgf2.dwMerit = 0; rgf2.u.s1.cPins = 0; rgf2.u.s1.rgPins = NULL; cbData = sizeof(wszFilterName); if (RegQueryValueExW(hkeyFilterClass, NULL, NULL, &Type, (LPBYTE)wszFilterName, &cbData) != ERROR_SUCCESS || Type != REG_SZ) goto cleanup; cbData = sizeof(rgf2.dwMerit); if (RegQueryValueExW(hkeyFilterClass, wszMeritName, NULL, &Type, (LPBYTE)&rgf2.dwMerit, &cbData) != ERROR_SUCCESS || Type != REG_DWORD) goto cleanup; DEVENUM_ReadPins(hkeyFilterClass, &rgf2); res = CLSIDFromString(wszFilterSubkeyName, &clsidFilter); if (FAILED(res)) goto cleanup; IFilterMapper2_RegisterFilter(pMapper, &clsidFilter, wszFilterName, &pMoniker, NULL, NULL, &rgf2); if (pMoniker) IMoniker_Release(pMoniker); cleanup: if (hkeyFilterClass) RegCloseKey(hkeyFilterClass); if (rgf2.u.s1.rgPins) { UINT iPin; for (iPin = 0; iPin < rgf2.u.s1.cPins; iPin++) { CoTaskMemFree(rgf2.u.s1.rgPins[iPin].strName); if (rgf2.u.s1.rgPins[iPin].lpMediaType) { UINT iType; for (iType = 0; iType < rgf2.u.s1.rgPins[iPin].nMediaTypes; iType++) { CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType[iType].clsMajorType); CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType[iType].clsMinorType); } CoTaskMemFree((void*)rgf2.u.s1.rgPins[iPin].lpMediaType); } } CoTaskMemFree((void*)rgf2.u.s1.rgPins); } } } } if (hkeyFilter) RegCloseKey(hkeyFilter); if (pMapper) IFilterMapper2_Release(pMapper); return S_OK;}
开发者ID:GYGit,项目名称:reactos,代码行数:101,
示例4: user_freestatic void WINAPI user_free(void *p){ CoTaskMemFree(p);}
开发者ID:pstrealer,项目名称:wine,代码行数:4,
示例5: AllocateCapability//.........这里部分代码省略......... WIA_DEV_CAP_DRV *pWIADeviceCapability = NULL; hr = AllocateCapability(&pWIADeviceCapability); if((SUCCEEDED(hr)&& (pWIADeviceCapability))) { pWIADeviceCapability->ulFlags = ulFlags; *pWIADeviceCapability->guid = guidCapability; CBasicStringWide cswCapabilityString; // // Load capability name from resource // if(cswCapabilityString.LoadString(uiNameResourceID,m_hInstance)) { hr = StringCbCopyW(pWIADeviceCapability->wszName, MAX_CAPABILITY_STRING_SIZE_BYTES, cswCapabilityString.String()); if(FAILED(hr)) { WIAS_ERROR((g_hInst, "Failed to copy source string (%ws) to destination string, hr = 0x%lx",cswCapabilityString.String(),hr)); } } else { hr = E_FAIL; WIAS_ERROR((g_hInst, "Failed to load the device capability name string from DLL resource, hr = 0x%lx",hr)); } // // Load capability description from resource // if(cswCapabilityString.LoadString(uiDescriptionResourceID,m_hInstance)) { hr = StringCbCopyW(pWIADeviceCapability->wszDescription, MAX_CAPABILITY_STRING_SIZE_BYTES, cswCapabilityString.String()); if(FAILED(hr)) { WIAS_ERROR((g_hInst, "Failed to copy source string (%ws) to destination string, hr = 0x%lx",cswCapabilityString.String(),hr)); } } else { hr = E_FAIL; WIAS_ERROR((g_hInst, "Failed to load the device capability description string from DLL resource, hr = 0x%lx",hr)); } // // Copy icon location string // cswCapabilityString = wszIcon; if(cswCapabilityString.Length()) { hr = StringCbCopyW(pWIADeviceCapability->wszIcon, MAX_CAPABILITY_STRING_SIZE_BYTES, cswCapabilityString.String()); if(FAILED(hr)) { WIAS_ERROR((g_hInst, "Failed to copy source string (%ws) to destination string, hr = 0x%lx",cswCapabilityString.String(),hr)); } } else { hr = E_FAIL; WIAS_ERROR((g_hInst, "Failed to load the device capability icon location string from DLL resource, hr = 0x%lx",hr)); } if(SUCCEEDED(hr)) { if((pWIADeviceCapability->ulFlags == WIA_NOTIFICATION_EVENT) || (pWIADeviceCapability->ulFlags == WIA_ACTION_EVENT)) { // // The capability being added is an event, so always add it to the beginning of the array // m_CapabilityArray.Insert(*pWIADeviceCapability,0); } else { // // The capability being added is a command, so always add it to the end of the array // m_CapabilityArray.Append(*pWIADeviceCapability); } } if(pWIADeviceCapability) { CoTaskMemFree(pWIADeviceCapability); pWIADeviceCapability = NULL; } } return hr;}
开发者ID:CM44,项目名称:Windows-driver-samples,代码行数:101,
示例6: VbglR3CredentialsQueryAvailability/** * Checks and retrieves credentials provided by the host + does account lookup on eventually * renamed user accounts. * * @return IPRT status code. */int VBoxCredProvCredential::RetrieveCredentials(void){ PRTUTF16 pwszUser = NULL; PRTUTF16 pwszPassword = NULL; PRTUTF16 pwszDomain = NULL; int rc = VbglR3CredentialsQueryAvailability(); if (RT_SUCCESS(rc)) { /* * Set status to "terminating" to let the host know this module now * tries to receive and use passed credentials so that credentials from * the host won't be sent twice. */ VBoxCredProvReportStatus(VBoxGuestFacilityStatus_Terminating); rc = VbglR3CredentialsRetrieveUtf16(&pwszUser, &pwszPassword, &pwszDomain); VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Retrieved credentials with rc=%Rrc/n", rc); } if (RT_SUCCESS(rc)) { VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Received credentials for user '%ls'/n", pwszUser); /* * In case we got a "display name" (e.g. "John Doe") * instead of the real user name (e.g. "jdoe") we have * to translate the data first ... */ PWSTR pwszExtractedName = NULL; if ( TranslateAccountName(pwszUser, &pwszExtractedName) && pwszExtractedName) { VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Translated account name '%ls' -> '%ls'/n", pwszUser, pwszExtractedName); RTMemWipeThoroughly(pwszUser, (RTUtf16Len(pwszUser) + 1) * sizeof(RTUTF16), 3 /* Passes */); RTUtf16Free(pwszUser); pwszUser = RTUtf16Dup(pwszExtractedName); CoTaskMemFree(pwszExtractedName); pwszExtractedName = NULL; } else { /* * Okay, no display name, but maybe it's a * principal name from which we have to extract the domain from? * ([email C++ CoUninitialize函数代码示例 C++ CoInitializeEx函数代码示例
|