这篇教程C++ IsEqualGUID函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IsEqualGUID函数的典型用法代码示例。如果您正苦于以下问题:C++ IsEqualGUID函数的具体用法?C++ IsEqualGUID怎么用?C++ IsEqualGUID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IsEqualGUID函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: enumeration_callbackstatic BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, LPVOID pvRef){ HRESULT hr; DIPROPDWORD dp; DIPROPRANGE dpr; DIPROPSTRING dps; WCHAR usernameW[MAX_PATH]; DWORD username_size = MAX_PATH; struct enum_data *data = pvRef; DWORD cnt; DIDEVICEOBJECTDATA buffer[5]; if (!data) return DIENUM_CONTINUE; data->ndevices++; /* Convert username to WCHAR */ if (data->username != NULL) { username_size = MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, 0); MultiByteToWideChar(CP_ACP, 0, data->username, -1, usernameW, username_size); } else GetUserNameW(usernameW, &username_size); /* collect the mouse and keyboard */ if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysKeyboard)) { IDirectInputDevice_AddRef(lpdid); data->keyboard = lpdid; ok (dwFlags & DIEDBS_MAPPEDPRI1, "Keyboard should be mapped as pri1 dwFlags=%08x/n", dwFlags); } if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysMouse)) { IDirectInputDevice_AddRef(lpdid); data->mouse = lpdid; ok (dwFlags & DIEDBS_MAPPEDPRI1, "Mouse should be mapped as pri1 dwFlags=%08x/n", dwFlags); } /* Building and setting an action map */ /* It should not use any pre-stored mappings so we use DIDBAM_HWDEFAULTS */ hr = IDirectInputDevice8_BuildActionMap(lpdid, data->lpdiaf, NULL, DIDBAM_HWDEFAULTS); ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x/n", hr); /* Device has no data format and thus can't be acquired */ hr = IDirectInputDevice8_Acquire(lpdid); ok (hr == DIERR_INVALIDPARAM, "Device was acquired before SetActionMap hr=%08x/n", hr); hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, data->username, 0); ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x/n", hr); /* Some joysticks may have no suitable actions and thus should not be tested */ if (hr == DI_NOEFFECT) return DIENUM_CONTINUE; /* Test username after SetActionMap */ dps.diph.dwSize = sizeof(dps); dps.diph.dwHeaderSize = sizeof(DIPROPHEADER); dps.diph.dwObj = 0; dps.diph.dwHow = DIPH_DEVICE; dps.wsz[0] = '/0'; hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph); ok (SUCCEEDED(hr), "GetProperty failed hr=%08x/n", hr); ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s/n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz)); /* Test buffer size */ memset(&dp, 0, sizeof(dp)); dp.diph.dwSize = sizeof(dp); dp.diph.dwHeaderSize = sizeof(DIPROPHEADER); dp.diph.dwHow = DIPH_DEVICE; hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_BUFFERSIZE, &dp.diph); ok (SUCCEEDED(hr), "GetProperty failed hr=%08x/n", hr); ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d/n", dp.dwData); cnt = 1; hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0); ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() failed hr=%08x/n", hr); /* Test axis range */ memset(&dpr, 0, sizeof(dpr)); dpr.diph.dwSize = sizeof(dpr); dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER); dpr.diph.dwHow = DIPH_DEVICE; hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_RANGE, &dpr.diph); /* Only test if device supports the range property */ if (SUCCEEDED(hr)) { ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%d got=%d/n", data->lpdiaf->lAxisMin, dpr.lMin); ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%d got=%d/n", data->lpdiaf->lAxisMax, dpr.lMax); } /* SetActionMap has set the data format so now it should work */ hr = IDirectInputDevice8_Acquire(lpdid); ok (SUCCEEDED(hr), "Acquire failed hr=%08x/n", hr);//.........这里部分代码省略.........
开发者ID:kholia,项目名称:wine,代码行数:101,
示例2: CHECK_HRHRESULT WpdServiceMethods::DispatchMethod( _In_ LPCWSTR pwszContext, _In_ IPortableDeviceValues* pStartParams, _COM_Outptr_ IPortableDeviceValues** ppResults){ HRESULT hr = S_OK; HRESULT hrStatus = S_OK; GUID Method = GUID_NULL; CComPtr<IPortableDeviceValues> pMethodParams; CComPtr<IPortableDeviceValues> pMethodResults; *ppResults = NULL; // Get the method GUID hr = pStartParams->GetGuidValue(WPD_PROPERTY_SERVICE_METHOD, &Method); CHECK_HR(hr, "Failed to get WPD_PROPERTY_SERVICE_METHOD"); // Get the method parameters. These can be optional if the methods don't require parameters if (SUCCEEDED(hr)) { HRESULT hrTemp = pStartParams->GetIPortableDeviceValuesValue(WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES, &pMethodParams); CHECK_HR(hrTemp, "Failed to get WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES (ok if method does not require parameters)"); } // Prepare the results collection if (SUCCEEDED(hr)) { hr = CoCreateInstance(CLSID_PortableDeviceValues, NULL, CLSCTX_INPROC_SERVER, IID_IPortableDeviceValues, (VOID**)&pMethodResults); CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceValues"); } if (SUCCEEDED(hr)) { // Invoke the method if (IsEqualGUID(METHOD_FullEnumSyncSvc_BeginSync, Method)) { hrStatus = m_pContactsService->OnBeginSync(pMethodParams, *ppResults); CHECK_HR(hrStatus, "BeginSync method failed"); } else if (IsEqualGUID(METHOD_FullEnumSyncSvc_EndSync, Method)) { hrStatus = m_pContactsService->OnEndSync(pMethodParams, *ppResults); CHECK_HR(hrStatus, "EndSync method failed"); } else if (IsEqualGUID(MyCustomMethod, Method)) { CComPtr<IPortableDeviceValues> pCustomEventParams; hr = CoCreateInstance(CLSID_PortableDeviceValues, NULL, CLSCTX_INPROC_SERVER, IID_IPortableDeviceValues, (VOID**)&pCustomEventParams); CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceValues"); if (SUCCEEDED(hr)) { hrStatus = m_pContactsService->OnMyCustomMethod(pMethodParams, pMethodResults, pCustomEventParams); CHECK_HR(hrStatus, "MyCustomMethod method failed"); } if (SUCCEEDED(hr)) { // In addition to a method complete event, we can also send a custom event, // for example, to indicate progress of the method hr = PostWpdEvent(pStartParams, pCustomEventParams); CHECK_HR(hr, "Failed to post custom event"); } } else { hrStatus = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); CHECK_HR(hr, "Unknown method %ws received",CComBSTR(Method)); } } // We always want to post a method completion event // Even if the method has failed { CComPtr<IPortableDeviceValues> pEventParams; hr = CoCreateInstance(CLSID_PortableDeviceValues, NULL, CLSCTX_INPROC_SERVER, IID_IPortableDeviceValues, (VOID**)&pEventParams); CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceValues"); if (SUCCEEDED(hr)) { hr = pEventParams->SetGuidValue(WPD_EVENT_PARAMETER_EVENT_ID, WPD_EVENT_SERVICE_METHOD_COMPLETE); CHECK_HR(hr, "Failed to set the event id to WPD_EVENT_SERVICE_METHOD_COMPLETE"); } if (SUCCEEDED(hr)) { hr = pEventParams->SetStringValue(WPD_EVENT_PARAMETER_SERVICE_METHOD_CONTEXT, pwszContext);//.........这里部分代码省略.........
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:101,
示例3: PnpEventThreadstatic ULONG NTAPIPnpEventThread(IN PVOID Parameter){ NTSTATUS Status; PPLUGPLAY_EVENT_BLOCK PnpEvent, NewPnpEvent; ULONG PnpEventSize; UNREFERENCED_PARAMETER(Parameter); PnpEventSize = 0x1000; PnpEvent = RtlAllocateHeap(ProcessHeap, 0, PnpEventSize); if (PnpEvent == NULL) { Status = STATUS_NO_MEMORY; goto Quit; } for (;;) { DPRINT("Calling NtGetPlugPlayEvent()/n"); /* Wait for the next PnP event */ Status = NtGetPlugPlayEvent(0, 0, PnpEvent, PnpEventSize); /* Resize the buffer for the PnP event if it's too small */ if (Status == STATUS_BUFFER_TOO_SMALL) { PnpEventSize += 0x400; NewPnpEvent = RtlReAllocateHeap(ProcessHeap, 0, PnpEvent, PnpEventSize); if (NewPnpEvent == NULL) { Status = STATUS_NO_MEMORY; goto Quit; } PnpEvent = NewPnpEvent; continue; } if (!NT_SUCCESS(Status)) { DPRINT1("NtGetPlugPlayEvent() failed (Status 0x%08lx)/n", Status); goto Quit; } /* Process the PnP event */ DPRINT("Received PnP Event/n"); if (IsEqualGUID(&PnpEvent->EventGuid, &GUID_DEVICE_ENUMERATED)) { DeviceInstallParams* Params; ULONG len; ULONG DeviceIdLength; DPRINT("Device enumerated event: %S/n", PnpEvent->TargetDevice.DeviceIds); DeviceIdLength = wcslen(PnpEvent->TargetDevice.DeviceIds); if (DeviceIdLength) { /* Queue device install (will be dequeued by DeviceInstallThread) */ len = FIELD_OFFSET(DeviceInstallParams, DeviceIds) + (DeviceIdLength + 1) * sizeof(WCHAR); Params = RtlAllocateHeap(ProcessHeap, 0, len); if (Params) { wcscpy(Params->DeviceIds, PnpEvent->TargetDevice.DeviceIds); RtlInterlockedPushEntrySList(&DeviceInstallListHead, &Params->ListEntry); NtSetEvent(hDeviceInstallListNotEmpty, NULL); } else { DPRINT1("Not enough memory (size %lu)/n", len); } } } else { DPRINT("Unknown event, GUID {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}/n", PnpEvent->EventGuid.Data1, PnpEvent->EventGuid.Data2, PnpEvent->EventGuid.Data3, PnpEvent->EventGuid.Data4[0], PnpEvent->EventGuid.Data4[1], PnpEvent->EventGuid.Data4[2], PnpEvent->EventGuid.Data4[3], PnpEvent->EventGuid.Data4[4], PnpEvent->EventGuid.Data4[5], PnpEvent->EventGuid.Data4[6], PnpEvent->EventGuid.Data4[7]); } /* Dequeue the current PnP event and signal the next one */ NtPlugPlayControl(PlugPlayControlUserResponse, NULL, 0); } Status = STATUS_SUCCESS;Quit: if (PnpEvent) RtlFreeHeap(ProcessHeap, 0, PnpEvent); NtTerminateThread(NtCurrentThread(), Status); return Status;}
开发者ID:Moteesh,项目名称:reactos,代码行数:94,
示例4: GetDeviceIDHRESULTWINAPIGetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest){ ULONG DeviceID = ULONG_MAX, Flags; MMRESULT Result; LPFILTERINFO Filter; if (!pGuidSrc || !pGuidDest) { /* invalid param */ return DSERR_INVALIDPARAM; } /* sanity check */ ASSERT(!IsEqualGUID(pGuidSrc, &GUID_NULL)); if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuidSrc) || IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuidSrc)) { Result = waveOutMessage(UlongToHandle(WAVE_MAPPER), DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&DeviceID, (DWORD_PTR)&Flags); if (Result != MMSYSERR_NOERROR || DeviceID == ULONG_MAX) { /* hack */ DPRINT1("Failed to get DRVM_MAPPER_PREFERRED_GET, using device 0/n"); DeviceID = 0; } if (!FindDeviceByMappedId(DeviceID, &Filter, TRUE)) { /* device not found */ return DSERR_INVALIDPARAM; } /* copy device guid */ RtlMoveMemory(pGuidDest, &Filter->DeviceGuid[1], sizeof(GUID)); return DS_OK; } else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuidSrc) || IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuidSrc)) { Result = waveInMessage(UlongToHandle(WAVE_MAPPER), DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&DeviceID, (DWORD_PTR)&Flags); if (Result != MMSYSERR_NOERROR || DeviceID == ULONG_MAX) { /* hack */ DPRINT1("Failed to get DRVM_MAPPER_PREFERRED_GET, for record using device 0/n"); DeviceID = 0; } if (!FindDeviceByMappedId(DeviceID, &Filter, FALSE)) { /* device not found */ return DSERR_INVALIDPARAM; } /* copy device guid */ RtlMoveMemory(pGuidDest, &Filter->DeviceGuid[0], sizeof(GUID)); return DS_OK; } if (!FindDeviceByGuid(pGuidSrc, &Filter)) { /* unknown guid */ return DSERR_INVALIDPARAM; } /* done */ return DS_OK;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:69,
示例5: DxCreateVideoDecoder//.........这里部分代码省略......... sys->surface_count = 0; return VLC_EGENERIC; } for (unsigned i = 0; i < sys->surface_count; i++) { vlc_va_surface_t *surface = &sys->surface[i]; surface->d3d = sys->hw_surface[i]; surface->refcount = 0; surface->order = 0; } msg_Dbg(va, "IDirectXVideoAccelerationService_CreateSurface succeed with %d surfaces (%dx%d)", sys->surface_count, fmt->i_width, fmt->i_height); /* */ DXVA2_VideoDesc dsc; ZeroMemory(&dsc, sizeof(dsc)); dsc.SampleWidth = fmt->i_width; dsc.SampleHeight = fmt->i_height; dsc.Format = sys->render; if (fmt->i_frame_rate > 0 && fmt->i_frame_rate_base > 0) { dsc.InputSampleFreq.Numerator = fmt->i_frame_rate; dsc.InputSampleFreq.Denominator = fmt->i_frame_rate_base; } else { dsc.InputSampleFreq.Numerator = 0; dsc.InputSampleFreq.Denominator = 0; } dsc.OutputFrameFreq = dsc.InputSampleFreq; dsc.UABProtectionLevel = FALSE; dsc.Reserved = 0; /* FIXME I am unsure we can let unknown everywhere */ DXVA2_ExtendedFormat *ext = &dsc.SampleFormat; ext->SampleFormat = 0;//DXVA2_SampleUnknown; ext->VideoChromaSubsampling = 0;//DXVA2_VideoChromaSubsampling_Unknown; ext->NominalRange = 0;//DXVA2_NominalRange_Unknown; ext->VideoTransferMatrix = 0;//DXVA2_VideoTransferMatrix_Unknown; ext->VideoLighting = 0;//DXVA2_VideoLighting_Unknown; ext->VideoPrimaries = 0;//DXVA2_VideoPrimaries_Unknown; ext->VideoTransferFunction = 0;//DXVA2_VideoTransFunc_Unknown; /* List all configurations available for the decoder */ UINT cfg_count = 0; DXVA2_ConfigPictureDecode *cfg_list = NULL; if (FAILED(IDirectXVideoDecoderService_GetDecoderConfigurations(sys->vs, &sys->input, &dsc, NULL, &cfg_count, &cfg_list))) { msg_Err(va, "IDirectXVideoDecoderService_GetDecoderConfigurations failed"); return VLC_EGENERIC; } msg_Dbg(va, "we got %d decoder configurations", cfg_count); /* Select the best decoder configuration */ int cfg_score = 0; for (unsigned i = 0; i < cfg_count; i++) { const DXVA2_ConfigPictureDecode *cfg = &cfg_list[i]; /* */ msg_Dbg(va, "configuration[%d] ConfigBitstreamRaw %d", i, cfg->ConfigBitstreamRaw); /* */ int score; if (cfg->ConfigBitstreamRaw == 1) score = 1; else if (codec_id == AV_CODEC_ID_H264 && cfg->ConfigBitstreamRaw == 2) score = 2; else continue; if (IsEqualGUID(&cfg->guidConfigBitstreamEncryption, &DXVA_NoEncrypt)) score += 16; if (cfg_score < score) { sys->cfg = *cfg; cfg_score = score; } } CoTaskMemFree(cfg_list); if (cfg_score <= 0) { msg_Err(va, "Failed to find a supported decoder configuration"); return VLC_EGENERIC; } /* Create the decoder */ IDirectXVideoDecoder *decoder; if (FAILED(IDirectXVideoDecoderService_CreateVideoDecoder(sys->vs, &sys->input, &dsc, &sys->cfg, sys->hw_surface, sys->surface_count, &decoder))) { msg_Err(va, "IDirectXVideoDecoderService_CreateVideoDecoder failed"); return VLC_EGENERIC; } sys->decoder = decoder; msg_Dbg(va, "IDirectXVideoDecoderService_CreateVideoDecoder succeed"); return VLC_SUCCESS;}
开发者ID:leasange,项目名称:winvlc,代码行数:101,
示例6: CoInitializebool Video::GetFrame(CString fileName, CDIB *dib, double delta){ IMediaDet *mediaDet; HRESULT hRes; hRes = CoInitialize(NULL); if(FAILED(hRes)) { return false; } hRes = CoCreateInstance(CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**)&mediaDet); if(FAILED(hRes)) { CoUninitialize(); return false; } hRes = mediaDet->put_Filename(fileName.GetBuffer()); if(FAILED(hRes)) { mediaDet->Release(); CoUninitialize(); return false; } AM_MEDIA_TYPE mediaType; hRes = mediaDet->get_StreamMediaType(&mediaType); if(FAILED(hRes)) { mediaDet->Release(); CoUninitialize(); return false; } if(!IsEqualGUID(mediaType.majortype, MEDIATYPE_Video)) { mediaDet->Release(); CoUninitialize(); return false; } if(!IsEqualGUID(mediaType.formattype, FORMAT_VideoInfo)) { mediaDet->Release(); CoUninitialize(); return false; } double position; hRes = mediaDet->get_StreamLength(&position); if(FAILED(hRes)) { mediaDet->Release(); CoUninitialize(); return false; } position *= delta; BITMAPINFOHEADER *bmpInfo = &((VIDEOINFOHEADER*)mediaType.pbFormat)->bmiHeader; long size; hRes = mediaDet->GetBitmapBits(position, &size, NULL, bmpInfo->biWidth, bmpInfo->biHeight); if(FAILED(hRes)) { mediaDet->Release(); CoUninitialize(); return false; } void *buf = malloc(size); hRes = mediaDet->GetBitmapBits(position, &size, (char*)buf, bmpInfo->biWidth, bmpInfo->biHeight); if(FAILED(hRes)) { free(buf); mediaDet->Release(); CoUninitialize(); return false; } dib->Resize(bmpInfo->biWidth, bmpInfo->biHeight); DIB_AARGB *pd = (DIB_AARGB*)dib->scan0; RGBTRIPLE *ps = (RGBTRIPLE*)buf; ps = &ps[(bmpInfo->biHeight - 1) * bmpInfo->biWidth]; for(int y = 0; y < bmpInfo->biHeight; y++) { for(int x = 0; x < bmpInfo->biWidth; x++) { pd[x]->a = 255; pd[x]->r = ps[x].rgbtBlue; pd[x]->g = ps[x].rgbtRed; pd[x]->b = ps[x].rgbtGreen; } pd = &pd[bmpInfo->biWidth]; ps = &ps[-bmpInfo->biWidth];//.........这里部分代码省略.........
开发者ID:VladimirLichonos,项目名称:XWindows-Dock-2.0,代码行数:101,
示例7: ImpHashHashData// =========================================================================// Hash functionNTSTATUSImpHashHashData( IN GUID* HashGUID, IN unsigned int DataLength, // In bits IN FREEOTFEBYTE* Data, IN OUT unsigned int* HashLength, // In bits OUT FREEOTFEBYTE* Hash){ NTSTATUS status = STATUS_SUCCESS; hash_state md; WCHAR* tmpGUIDStr; DEBUGOUTHASHIMPL(DEBUGLEV_ENTER, (TEXT("ImpHashHashData/n"))); if (IsEqualGUID(&HASH_GUID_SHA512, HashGUID)) { if (*HashLength < (sha512_desc.hashsize * 8)) { DEBUGOUTHASHIMPL(DEBUGLEV_ERROR, (TEXT("output hash length buffer too small (got: %d; need: %d)/n"), *HashLength, (sha512_desc.hashsize * 8) )); status = STATUS_BUFFER_TOO_SMALL; } else { sha512_desc.init(&md); sha512_desc.process(&md, Data, (DataLength / 8)); sha512_desc.done(&md, Hash); *HashLength = (sha512_desc.hashsize * 8); } } else if (IsEqualGUID(&HASH_GUID_SHA384, HashGUID)) { if (*HashLength < (sha384_desc.hashsize * 8)) { DEBUGOUTHASHIMPL(DEBUGLEV_ERROR, (TEXT("output hash length buffer too small (got: %d; need: %d)/n"), *HashLength, (sha384_desc.hashsize * 8) )); status = STATUS_BUFFER_TOO_SMALL; } else { sha384_desc.init(&md); sha384_desc.process(&md, Data, (DataLength / 8)); sha384_desc.done(&md, Hash); *HashLength = (sha384_desc.hashsize * 8); } } else if (IsEqualGUID(&HASH_GUID_SHA256, HashGUID)) { if (*HashLength < (sha256_desc.hashsize * 8)) { DEBUGOUTHASHIMPL(DEBUGLEV_ERROR, (TEXT("output hash length buffer too small (got: %d; need: %d)/n"), *HashLength, (sha256_desc.hashsize * 8) )); status = STATUS_BUFFER_TOO_SMALL; } else { sha256_desc.init(&md); sha256_desc.process(&md, Data, (DataLength / 8)); sha256_desc.done(&md, Hash); *HashLength = (sha256_desc.hashsize * 8); } } else if (IsEqualGUID(&HASH_GUID_SHA224, HashGUID)) { if (*HashLength < (sha224_desc.hashsize * 8)) { DEBUGOUTHASHIMPL(DEBUGLEV_ERROR, (TEXT("output hash length buffer too small (got: %d; need: %d)/n"), *HashLength, (sha224_desc.hashsize * 8) )); status = STATUS_BUFFER_TOO_SMALL; } else { sha224_desc.init(&md); sha224_desc.process(&md, Data, (DataLength / 8)); sha224_desc.done(&md, Hash); *HashLength = (sha224_desc.hashsize * 8); } } else if (IsEqualGUID(&HASH_GUID_SHA1, HashGUID)) { if (*HashLength < (sha1_desc.hashsize * 8)) {//.........这里部分代码省略.........
开发者ID:compvid30,项目名称:strongcrypt,代码行数:101,
示例8: HrFindInstanceHRESULT HrFindInstance (INetCfg *pnc, GUID &guidInstance, INetCfgComponent **ppnccMiniport){ IEnumNetCfgComponent *pencc; INetCfgComponent *pncc; GUID guid; WCHAR szGuid[MAX_PATH+1]; ULONG ulCount; BOOL found; HRESULT hr; TraceMsg( L"-->HrFindInstance./n" ); hr = pnc->EnumComponents( &GUID_DEVCLASS_NET, &pencc ); if ( hr == S_OK ) { StringFromGUID2( guidInstance, szGuid, MAX_PATH+1 ); TraceMsg( L" Looking for component with InstanceGuid %s/n", szGuid ); hr = pencc->Next( 1, &pncc, &ulCount ); for ( found=FALSE; (hr == S_OK) && (found == FALSE); ) { hr = pncc->GetInstanceGuid( &guid ); if ( hr == S_OK ) { StringFromGUID2( guid, szGuid, MAX_PATH+1 ); TraceMsg( L" Found component with InstanceGuid %s/n", szGuid ); found = IsEqualGUID( guid, guidInstance ); if ( found == FALSE ) { ReleaseObj( pncc ); hr = pencc->Next( 1, &pncc, &ulCount ); } else { *ppnccMiniport = pncc; } } } ReleaseObj( pencc ); } else { TraceMsg( L" EnumComponents failed(HRESULT = %x)./n", hr ); } TraceMsg( L"<--HrFindInstance(HRESULT = %x)./n", hr ); return hr;}
开发者ID:Realhram,项目名称:wdk81,代码行数:73,
示例9: PHClientSite_QueryInterfacestatic HRESULT WINAPI PHClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv){ PluginHost *This = impl_from_IOleClientSite(iface); if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)/n", This, ppv); *ppv = &This->IOleClientSite_iface; }else if(IsEqualGUID(&IID_IOleClientSite, riid)) { TRACE("(%p)->(IID_IOleClientSite %p)/n", This, ppv); *ppv = &This->IOleClientSite_iface; }else if(IsEqualGUID(&IID_IAdviseSink, riid)) { TRACE("(%p)->(IID_IAdviseSink %p)/n", This, ppv); *ppv = &This->IAdviseSinkEx_iface; }else if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) { TRACE("(%p)->(IID_IAdviseSinkEx %p)/n", This, ppv); *ppv = &This->IAdviseSinkEx_iface; }else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) { TRACE("(%p)->(IID_IPropertyNotifySink %p)/n", This, ppv); *ppv = &This->IPropertyNotifySink_iface; }else if(IsEqualGUID(&IID_IDispatch, riid)) { TRACE("(%p)->(IID_IDispatch %p)/n", This, ppv); *ppv = &This->IDispatch_iface; }else if(IsEqualGUID(&IID_IOleWindow, riid)) { TRACE("(%p)->(IID_IOleWindow %p)/n", This, ppv); *ppv = &This->IOleInPlaceSiteEx_iface; }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) { TRACE("(%p)->(IID_IOleInPlaceSite %p)/n", This, ppv); *ppv = &This->IOleInPlaceSiteEx_iface; }else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid)) { TRACE("(%p)->(IID_IOleInPlaceSiteEx %p)/n", This, ppv); *ppv = &This->IOleInPlaceSiteEx_iface; }else if(IsEqualGUID(&IID_IOleControlSite, riid)) { TRACE("(%p)->(IID_IOleControlSite %p)/n", This, ppv); *ppv = &This->IOleControlSite_iface; }else if(IsEqualGUID(&IID_IBindHost, riid)) { TRACE("(%p)->(IID_IBindHost %p)/n", This, ppv); *ppv = &This->IBindHost_iface; }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)/n", This, ppv); *ppv = &This->IServiceProvider_iface; }else { WARN("Unsupported interface %s/n", debugstr_guid(riid)); *ppv = NULL; return E_NOINTERFACE; } IUnknown_AddRef((IUnknown*)*ppv); return S_OK;}
开发者ID:miurahr,项目名称:wine,代码行数:49,
示例10: __uuidof//HRESULT LoopbackCapture(// IMMDevice *pMMDevice,// bool bInt16,// HANDLE hStartedEvent,// HANDLE hStopEvent,// PUINT32 pnFrames,// HMMIO hFile,// AudioBuffer *pBuffer//)HRESULT LoopbackCapture::Process(){ HRESULT hr; // activate an IAudioClient IAudioClient *pAudioClient; hr = pMMDevice->Activate( __uuidof(IAudioClient), CLSCTX_ALL, NULL, (void**)&pAudioClient ); if (FAILED(hr)) { printf("IMMDevice::Activate(IAudioClient) failed: hr = 0x%08x", hr); return hr; } // get the default device periodicity REFERENCE_TIME hnsDefaultDevicePeriod; hr = pAudioClient->GetDevicePeriod(&hnsDefaultDevicePeriod, NULL); if (FAILED(hr)) { printf("IAudioClient::GetDevicePeriod failed: hr = 0x%08x/n", hr); pAudioClient->Release(); return hr; } // get the default device format WAVEFORMATEX *pwfx; hr = pAudioClient->GetMixFormat(&pwfx); if (FAILED(hr)) { printf("IAudioClient::GetMixFormat failed: hr = 0x%08x/n", hr); CoTaskMemFree(pwfx); pAudioClient->Release(); return hr; } if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { PWAVEFORMATEXTENSIBLE pEx = reinterpret_cast<PWAVEFORMATEXTENSIBLE>(pwfx); //pEx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; printf("WAVE_FORMAT_EXTENSIBLE/n"); if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, pEx->SubFormat)) { printf("float/n"); }// else if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_PCM, pEx->SubFormat)) { printf("PCM/n"); }//KSDATAFORMAT_SUBTYPE_WAVEFORMATEX else if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_WAVEFORMATEX, pEx->SubFormat)) { printf("WAVEFORMATEX/n"); } } if (bInt16) { // coerce int-16 wave format // can do this in-place since we're not changing the size of the format // also, the engine will auto-convert from float to int for us switch (pwfx->wFormatTag) { case WAVE_FORMAT_IEEE_FLOAT: pwfx->wFormatTag = WAVE_FORMAT_PCM; pwfx->wBitsPerSample = 16; pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8; pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; break; case WAVE_FORMAT_EXTENSIBLE: { // naked scope for case-local variable PWAVEFORMATEXTENSIBLE pEx = reinterpret_cast<PWAVEFORMATEXTENSIBLE>(pwfx); if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, pEx->SubFormat)) { pEx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; pEx->Samples.wValidBitsPerSample = 16; pwfx->wBitsPerSample = 16; pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8; pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; } else { printf("Don't know how to coerce mix format to int-16/n"); CoTaskMemFree(pwfx); pAudioClient->Release(); return E_UNEXPECTED; } } break; default: printf("Don't know how to coerce WAVEFORMATEX with wFormatTag = 0x%08x to int-16/n", pwfx->wFormatTag); CoTaskMemFree(pwfx); pAudioClient->Release(); return E_UNEXPECTED; }//.........这里部分代码省略.........
开发者ID:Harpseal,项目名称:sysAudioSpectrogram,代码行数:101,
示例11: test_wmpstatic void test_wmp(void){ IProvideClassInfo2 *class_info; IOleClientSite *client_site; IOleInPlaceObject *ipobj; IPersistStreamInit *psi; IOleObject *oleobj; IWMPCore *wmpcore; DWORD misc_status; RECT pos = {0,0,100,100}; HWND hwnd; GUID guid; LONG ref; HRESULT hres; BSTR str; hres = CoCreateInstance(&CLSID_WindowsMediaPlayer, NULL, CLSCTX_INPROC_SERVER, &IID_IOleObject, (void**)&oleobj); if(hres == REGDB_E_CLASSNOTREG) { win_skip("CLSID_WindowsMediaPlayer not registered/n"); return; } ok(hres == S_OK, "Could not create CLSID_WindowsMediaPlayer instance: %08x/n", hres); hres = IOleObject_QueryInterface(oleobj, &IID_IWMPCore, (void**)&wmpcore); ok(hres == S_OK, "got 0x%08x/n", hres); hres = IWMPCore_get_versionInfo(wmpcore, NULL); ok(hres == E_POINTER, "got 0x%08x/n", hres); hres = IWMPCore_get_versionInfo(wmpcore, &str); ok(hres == S_OK, "got 0x%08x/n", hres); SysFreeString(str); IWMPCore_Release(wmpcore); hres = IOleObject_QueryInterface(oleobj, &IID_IProvideClassInfo2, (void**)&class_info); ok(hres == S_OK, "Could not get IProvideClassInfo2 iface: %08x/n", hres); hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid); ok(hres == S_OK, "GetGUID failed: %08x/n", hres); ok(IsEqualGUID(&guid, &IID__WMPOCXEvents), "guid = %s/n", wine_dbgstr_guid(&guid)); IProvideClassInfo2_Release(class_info); test_QI((IUnknown*)oleobj); hres = IOleObject_GetMiscStatus(oleobj, DVASPECT_CONTENT, &misc_status); ok(hres == S_OK, "GetMiscStatus failed: %08x/n", hres); ok(misc_status == (OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE), "misc_status = %x/n", misc_status); hres = IOleObject_QueryInterface(oleobj, &IID_IPersistStreamInit, (void**)&psi); ok(hres == S_OK, "Could not get IPersistStreamInit iface: %08x/n", hres); hres = IOleObject_QueryInterface(oleobj, &IID_IOleInPlaceObject, (void**)&ipobj); ok(hres == S_OK, "Could not get IOleInPlaceObject iface: %08x/n", hres); hres = IPersistStreamInit_InitNew(psi); ok(hres == E_FAIL || broken(hres == S_OK /* Old WMP */), "InitNew failed: %08x/n", hres); SET_EXPECT(GetContainer); SET_EXPECT(GetExtendedControl); SET_EXPECT(GetWindow); SET_EXPECT(Invoke_USERMODE); hres = IOleObject_SetClientSite(oleobj, &ClientSite); ok(hres == S_OK, "SetClientSite failed: %08x/n", hres); todo_wine CHECK_CALLED(GetContainer); CHECK_CALLED(GetExtendedControl); todo_wine CHECK_CALLED(GetWindow); todo_wine CHECK_CALLED(Invoke_USERMODE); client_site = NULL; hres = IOleObject_GetClientSite(oleobj, &client_site); ok(hres == S_OK, "GetClientSite failed: %08x/n", hres); ok(client_site == &ClientSite, "client_site != ClientSite/n"); SET_EXPECT(GetWindow); hres = IPersistStreamInit_InitNew(psi); ok(hres == S_OK, "InitNew failed: %08x/n", hres); CHECK_CALLED(GetWindow); hwnd = (HWND)0xdeadbeef; hres = IOleInPlaceObject_GetWindow(ipobj, &hwnd); ok(hres == E_UNEXPECTED, "GetWindow failed: %08x/n", hres); ok(!hwnd, "hwnd = %p/n", hwnd); SET_EXPECT(GetWindow); SET_EXPECT(CanWindowlessActivate); SET_EXPECT(OnInPlaceActivateEx); SET_EXPECT(GetWindowContext); SET_EXPECT(ShowObject); hres = IOleObject_DoVerb(oleobj, OLEIVERB_INPLACEACTIVATE, NULL, &ClientSite, 0, container_hwnd, &pos); ok(hres == S_OK, "DoVerb failed: %08x/n", hres); CHECK_CALLED(GetWindow); CHECK_CALLED(CanWindowlessActivate); CHECK_CALLED(OnInPlaceActivateEx); CHECK_CALLED(GetWindowContext); CHECK_CALLED(ShowObject); hwnd = NULL;//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:wine,代码行数:101,
示例12: test_save_settingsstatic void test_save_settings(void){ HRESULT hr; HINSTANCE hinst = GetModuleHandleA(NULL); IDirectInput8A *pDI = NULL; DIACTIONFORMATA af; IDirectInputDevice8A *pKey; static const GUID mapping_guid = { 0xcafecafe, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; static const GUID other_guid = { 0xcafe, 0xcafe, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } }; static DIACTIONA actions[] = { { 0, DIKEYBOARD_A , 0, { "Blam" } }, { 1, DIKEYBOARD_B , 0, { "Kapow"} } }; static const DWORD results[] = { DIDFT_MAKEINSTANCE(DIK_A) | DIDFT_PSHBUTTON, DIDFT_MAKEINSTANCE(DIK_B) | DIDFT_PSHBUTTON }; static const DWORD other_results[] = { DIDFT_MAKEINSTANCE(DIK_C) | DIDFT_PSHBUTTON, DIDFT_MAKEINSTANCE(DIK_D) | DIDFT_PSHBUTTON }; hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI); if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION || hr == REGDB_E_CLASSNOTREG) { win_skip("ActionMapping requires dinput8/n"); return; } ok (SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x/n", hr); if (FAILED(hr)) return; hr = IDirectInput8_Initialize(pDI,hinst, DIRECTINPUT_VERSION); if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION) { win_skip("ActionMapping requires dinput8/n"); return; } ok (SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x/n", hr); if (FAILED(hr)) return; hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKey, NULL); ok (SUCCEEDED(hr), "IDirectInput_Create device failed hr: 0x%08x/n", hr); if (FAILED(hr)) return; memset (&af, 0, sizeof(af)); af.dwSize = sizeof(af); af.dwActionSize = sizeof(DIACTIONA); af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]); af.dwNumActions = sizeof(actions) / sizeof(actions[0]); af.rgoAction = actions; af.guidActionMap = mapping_guid; af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */ af.dwBufferSize = 32; /* Easy case. Ask for default mapping, save, ask for previous map and read it back */ hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, DIDBAM_HWDEFAULTS); ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x/n", hr); ok (results[0] == af.rgoAction[0].dwObjID, "Mapped incorrectly expected: 0x%08x got: 0x%08x/n", results[0], af.rgoAction[0].dwObjID); ok (results[1] == af.rgoAction[1].dwObjID, "Mapped incorrectly expected: 0x%08x got: 0x%08x/n", results[1], af.rgoAction[1].dwObjID); hr = IDirectInputDevice8_SetActionMap(pKey, &af, NULL, DIDSAM_FORCESAVE); ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x/n", hr); if (hr == DI_SETTINGSNOTSAVED) { skip ("Can't test saving settings if SetActionMap returns DI_SETTINGSNOTSAVED/n"); return; } af.rgoAction[0].dwObjID = 0; af.rgoAction[1].dwObjID = 0; memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID)); memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID)); hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0); ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x/n", hr); ok (results[0] == af.rgoAction[0].dwObjID, "Mapped incorrectly expected: 0x%08x got: 0x%08x/n", results[0], af.rgoAction[0].dwObjID); ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard/n"); ok (results[1] == af.rgoAction[1].dwObjID, "Mapped incorrectly expected: 0x%08x got: 0x%08x/n", results[1], af.rgoAction[1].dwObjID); ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard/n"); /* Test that a different action map with no pre-stored settings, in spite of the flags, does not try to load mappings and instead applies the default mapping */ af.guidActionMap = other_guid; af.rgoAction[0].dwObjID = 0; af.rgoAction[1].dwObjID = 0; memset(&af.rgoAction[0].guidInstance, 0, sizeof(GUID));//.........这里部分代码省略.........
开发者ID:kholia,项目名称:wine,代码行数:101,
示例13: DirectSoundCaptureDevice_Initializestatic HRESULT DirectSoundCaptureDevice_Initialize( DirectSoundCaptureDevice ** ppDevice, LPCGUID lpcGUID){ HRESULT hr; GUID devGUID; IMMDevice *mmdevice; struct _TestFormat *fmt; DirectSoundCaptureDevice *device; IAudioClient *client; TRACE("(%p, %s)/n", ppDevice, debugstr_guid(lpcGUID)); /* Default device? */ if ( !lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL) ) lpcGUID = &DSDEVID_DefaultCapture; if(IsEqualGUID(lpcGUID, &DSDEVID_DefaultPlayback) || IsEqualGUID(lpcGUID, &DSDEVID_DefaultVoicePlayback)) return DSERR_NODRIVER; if (GetDeviceID(lpcGUID, &devGUID) != DS_OK) { WARN("invalid parameter: lpcGUID/n"); return DSERR_INVALIDPARAM; } hr = get_mmdevice(eCapture, &devGUID, &mmdevice); if(FAILED(hr)) return hr; EnterCriticalSection(&DSOUND_capturers_lock); hr = DirectSoundCaptureDevice_Create(&device); if (hr != DS_OK) { WARN("DirectSoundCaptureDevice_Create failed/n"); LeaveCriticalSection(&DSOUND_capturers_lock); return hr; } device->guid = devGUID; device->mmdevice = mmdevice; device->drvcaps.dwFlags = 0; device->drvcaps.dwFormats = 0; device->drvcaps.dwChannels = 0; hr = IMMDevice_Activate(mmdevice, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&client); if(FAILED(hr)){ device->lock.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&device->lock); HeapFree(GetProcessHeap(), 0, device); LeaveCriticalSection(&DSOUND_capturers_lock); return DSERR_NODRIVER; } for(fmt = formats_to_test; fmt->flag; ++fmt){ if(DSOUND_check_supported(client, fmt->rate, fmt->depth, fmt->channels)){ device->drvcaps.dwFormats |= fmt->flag; if(fmt->channels > device->drvcaps.dwChannels) device->drvcaps.dwChannels = fmt->channels; } } IAudioClient_Release(client); device->timerID = DSOUND_create_timer(DSOUND_capture_timer, (DWORD_PTR)device); list_add_tail(&DSOUND_capturers, &device->entry); *ppDevice = device; LeaveCriticalSection(&DSOUND_capturers_lock); return S_OK;}
开发者ID:GeonHun,项目名称:wine,代码行数:76,
示例14: test_color_formatsstatic void test_color_formats(void){ static const struct { char bit_depth, color_type; const GUID *format; const GUID *format_PLTE; const GUID *format_PLTE_tRNS; BOOL todo; BOOL todo_load; } td[] = { /* 2 - PNG_COLOR_TYPE_RGB */ { 1, 2, NULL, NULL, NULL }, { 2, 2, NULL, NULL, NULL }, { 4, 2, NULL, NULL, NULL }, { 8, 2, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat24bppBGR }, /* libpng refuses to load our test image complaining about extra compressed data, * but libpng is still able to load the image with other combination of type/depth * making RGB 16 bpp case special for some reason. Therefore todo = TRUE. */ { 16, 2, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat48bppRGB, TRUE, TRUE }, { 24, 2, NULL, NULL, NULL }, { 32, 2, NULL, NULL, NULL }, /* 0 - PNG_COLOR_TYPE_GRAY */ { 1, 0, &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormat1bppIndexed, TRUE }, { 2, 0, &GUID_WICPixelFormat2bppGray, &GUID_WICPixelFormat2bppGray, &GUID_WICPixelFormat2bppIndexed, TRUE }, { 4, 0, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat4bppIndexed, TRUE }, { 8, 0, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat8bppIndexed, TRUE }, { 16, 0, &GUID_WICPixelFormat16bppGray, &GUID_WICPixelFormat16bppGray, &GUID_WICPixelFormat64bppRGBA, TRUE }, { 24, 0, NULL, NULL, NULL }, { 32, 0, NULL, NULL, NULL }, /* 3 - PNG_COLOR_TYPE_PALETTE */ { 1, 3, &GUID_WICPixelFormat1bppIndexed, &GUID_WICPixelFormat1bppIndexed, &GUID_WICPixelFormat1bppIndexed }, { 2, 3, &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat2bppIndexed }, { 4, 3, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat4bppIndexed }, { 8, 3, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat8bppIndexed }, { 16, 3, NULL, NULL, NULL }, { 24, 3, NULL, NULL, NULL }, { 32, 3, NULL, NULL, NULL }, }; char buf[sizeof(png_1x1_data)]; HRESULT hr; IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *frame; GUID format; int i, PLTE_off = 0, tRNS_off = 0; memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); for (i = 0; i < sizeof(png_1x1_data) - 4; i++) { if (!memcmp(buf + i, "tRNS", 4)) tRNS_off = i; else if (!memcmp(buf + i, "PLTE", 4)) PLTE_off = i; } ok(PLTE_off && tRNS_off, "PLTE offset %d, tRNS offset %d/n", PLTE_off, tRNS_off); if (!PLTE_off || !tRNS_off) return; /* In order to test the image data with and without PLTE and tRNS chunks * it's been decided to simply sero out the chunk id for testing puposes, * and under Windows such images get loaded just fine. But unfortunately * libpng refuses to load such images complaining about unknown chunk type. * A workaround for this libpng limitation is to mark the "disabled" chunks * with tEXt id. */ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) { /* with the tRNS and PLTE chunks */ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); buf[24] = td[i].bit_depth; buf[25] = td[i].color_type; hr = create_decoder(buf, sizeof(buf), &decoder); if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, TRUE)) ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x/n", i, hr); else todo_wine_if(td[i].todo_load) ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x/n", i, td[i].color_type, td[i].bit_depth, hr); if (hr != S_OK) goto next_1; hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ok(hr == S_OK, "GetFrame error %#x/n", hr); hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); ok(hr == S_OK, "GetPixelFormat error %#x/n", hr); todo_wine_if(td[i].todo) ok(IsEqualGUID(&format, td[i].format_PLTE_tRNS), "PLTE+tRNS: expected %s, got %s (type %d, bpp %d)/n", wine_dbgstr_guid(td[i].format_PLTE_tRNS), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth); IWICBitmapFrameDecode_Release(frame); IWICBitmapDecoder_Release(decoder);next_1: /* without the tRNS chunk */ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); buf[24] = td[i].bit_depth;//.........这里部分代码省略.........
开发者ID:reactos,项目名称:reactos,代码行数:101,
示例15: DoReset//.........这里部分代码省略......... if(wfx != NULL) { if(!MakeExtensible(&OutputType, wfx)) { CoTaskMemFree(wfx); return E_FAIL; } CoTaskMemFree(wfx); wfx = NULL; device->Frequency = OutputType.Format.nSamplesPerSec; if(OutputType.Format.nChannels == 1 && OutputType.dwChannelMask == MONO) device->FmtChans = DevFmtMono; else if(OutputType.Format.nChannels == 2 && OutputType.dwChannelMask == STEREO) device->FmtChans = DevFmtStereo; else if(OutputType.Format.nChannels == 4 && OutputType.dwChannelMask == QUAD) device->FmtChans = DevFmtQuad; else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1) device->FmtChans = DevFmtX51; else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE) device->FmtChans = DevFmtX51Side; else if(OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1) device->FmtChans = DevFmtX61; else if(OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1) device->FmtChans = DevFmtX71; else { ERR("Unhandled extensible channels: %d -- 0x%08lx/n", OutputType.Format.nChannels, OutputType.dwChannelMask); device->FmtChans = DevFmtStereo; OutputType.Format.nChannels = 2; OutputType.dwChannelMask = STEREO; } if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) { if(OutputType.Format.wBitsPerSample == 8) device->FmtType = DevFmtUByte; else if(OutputType.Format.wBitsPerSample == 16) device->FmtType = DevFmtShort; else if(OutputType.Format.wBitsPerSample == 32) device->FmtType = DevFmtInt; else { device->FmtType = DevFmtShort; OutputType.Format.wBitsPerSample = 16; } } else if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)) { device->FmtType = DevFmtFloat; OutputType.Format.wBitsPerSample = 32; } else { ERR("Unhandled format sub-type/n"); device->FmtType = DevFmtShort; OutputType.Format.wBitsPerSample = 16; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; } OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample; } SetDefaultWFXChannelOrder(device); hr = IAudioClient_Initialize(data->client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, buf_time, 0, &OutputType.Format, NULL); if(FAILED(hr)) { ERR("Failed to initialize audio client: 0x%08lx/n", hr); return hr; } hr = IAudioClient_GetDevicePeriod(data->client, &min_per, NULL); if(SUCCEEDED(hr)) { min_len = (UINT32)((min_per*device->Frequency + 10000000-1) / 10000000); /* Find the nearest multiple of the period size to the update size */ if(min_len < device->UpdateSize) min_len *= (device->UpdateSize + min_len/2)/min_len; hr = IAudioClient_GetBufferSize(data->client, &buffer_len); } if(FAILED(hr)) { ERR("Failed to get audio buffer info: 0x%08lx/n", hr); return hr; } device->UpdateSize = min_len; device->NumUpdates = buffer_len / device->UpdateSize; if(device->NumUpdates <= 1) { ERR("Audio client returned buffer_len < period*2; expect break up/n"); device->NumUpdates = 2; device->UpdateSize = buffer_len / device->NumUpdates; } return hr;}
开发者ID:jims,项目名称:openal-soft,代码行数:101,
示例16: CGuidItemExtractIcon_CreateInstanceHRESULT CGuidItemExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID iid, LPVOID * ppvOut){ CComPtr<IDefaultExtractIconInit> initIcon; HRESULT hr; GUID const * riid; int icon_idx; WCHAR wTemp[MAX_PATH]; hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon)); if (FAILED(hr)) return hr; if (_ILIsDesktop(pidl)) { initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DESKTOP); return initIcon->QueryInterface(iid, ppvOut); } riid = _ILGetGUIDPointer(pidl); if (!riid) return E_FAIL; /* my computer and other shell extensions */ static const WCHAR fmt[] = { 'C', 'L', 'S', 'I', 'D', '//', '{', '%', '0', '8', 'l', 'x', '-', '%', '0', '4', 'x', '-', '%', '0', '4', 'x', '-', '%', '0', '2', 'x', '%', '0', '2', 'x', '-', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '}', 0 }; WCHAR xriid[50]; swprintf(xriid, fmt, riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); const WCHAR* iconname = NULL; if (_ILIsBitBucket(pidl)) { static const WCHAR szFull[] = {'F','u','l','l',0}; static const WCHAR szEmpty[] = {'E','m','p','t','y',0}; CComPtr<IEnumIDList> EnumIDList; CoInitialize(NULL); CComPtr<IShellFolder2> psfRecycleBin; CComPtr<IShellFolder> psfDesktop; hr = SHGetDesktopFolder(&psfDesktop); if (SUCCEEDED(hr)) hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder2, &psfRecycleBin)); if (SUCCEEDED(hr)) hr = psfRecycleBin->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &EnumIDList); ULONG itemcount; LPITEMIDLIST pidl = NULL; if (SUCCEEDED(hr) && (hr = EnumIDList->Next(1, &pidl, &itemcount)) == S_OK) { CoTaskMemFree(pidl); iconname = szFull; } else { iconname = szEmpty; } } if (HCR_GetIconW(xriid, wTemp, iconname, MAX_PATH, &icon_idx)) { initIcon->SetNormalIcon(wTemp, icon_idx); } else { if (IsEqualGUID(*riid, CLSID_MyComputer)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_COMPUTER); else if (IsEqualGUID(*riid, CLSID_MyDocuments)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_DOCUMENTS); else if (IsEqualGUID(*riid, CLSID_NetworkPlaces)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_NETWORK_PLACES); else initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_FOLDER); } return initIcon->QueryInterface(iid, ppvOut);}
开发者ID:reactos,项目名称:reactos,代码行数:81,
示例17: DxFindVideoServiceConversion/** * Find the best suited decoder mode GUID and render format. */static int DxFindVideoServiceConversion(vlc_va_t *va, GUID *input, D3DFORMAT *output){ vlc_va_sys_t *sys = va->sys; /* Retreive supported modes from the decoder service */ UINT input_count = 0; GUID *input_list = NULL; if (FAILED(IDirectXVideoDecoderService_GetDecoderDeviceGuids(sys->vs, &input_count, &input_list))) { msg_Err(va, "IDirectXVideoDecoderService_GetDecoderDeviceGuids failed"); return VLC_EGENERIC; } for (unsigned i = 0; i < input_count; i++) { const GUID *g = &input_list[i]; const dxva2_mode_t *mode = Dxva2FindMode(g); if (mode) { msg_Dbg(va, "- '%s' is supported by hardware", mode->name); } else { msg_Warn(va, "- Unknown GUID = " GUID_FMT, GUID_PRINT( *g ) ); } } /* Try all supported mode by our priority */ for (unsigned i = 0; dxva2_modes[i].name; i++) { const dxva2_mode_t *mode = &dxva2_modes[i]; if (!mode->codec || mode->codec != sys->codec_id) continue; /* */ bool is_supported = false; for (const GUID *g = &input_list[0]; !is_supported && g < &input_list[input_count]; g++) { is_supported = IsEqualGUID(mode->guid, g); } if (!is_supported) continue; /* */ msg_Dbg(va, "Trying to use '%s' as input", mode->name); UINT output_count = 0; D3DFORMAT *output_list = NULL; if (FAILED(IDirectXVideoDecoderService_GetDecoderRenderTargets(sys->vs, mode->guid, &output_count, &output_list))) { msg_Err(va, "IDirectXVideoDecoderService_GetDecoderRenderTargets failed"); continue; } for (unsigned j = 0; j < output_count; j++) { const D3DFORMAT f = output_list[j]; const d3d_format_t *format = D3dFindFormat(f); if (format) { msg_Dbg(va, "%s is supported for output", format->name); } else { msg_Dbg(va, "%d is supported for output (%4.4s)", f, (const char*)&f); } } /* */ for (unsigned j = 0; d3d_formats[j].name; j++) { const d3d_format_t *format = &d3d_formats[j]; /* */ bool is_supported = false; for (unsigned k = 0; !is_supported && k < output_count; k++) { is_supported = format->format == output_list[k]; } if (!is_supported) continue; /* We have our solution */ msg_Dbg(va, "Using '%s' to decode to '%s'", mode->name, format->name); *input = *mode->guid; *output = format->format; CoTaskMemFree(output_list); CoTaskMemFree(input_list); return VLC_SUCCESS; } CoTaskMemFree(output_list); } CoTaskMemFree(input_list); return VLC_EGENERIC;}
开发者ID:leasange,项目名称:winvlc,代码行数:85,
示例18: IsUsingTimeFormatHRESULT CAudioRawFileRenderer::IsUsingTimeFormat(const struct _GUID *fmt){ if (IsEqualGUID(*fmt,m_TimeFormat)) return(S_OK); return(S_FALSE); }
开发者ID:ChakaZulu,项目名称:tuxbox_hostapps,代码行数:6,
示例19: switch//.........这里部分代码省略......... return false; } HRESULT hr = S_OK; //Create Windows Imaging Component ImagingFactory. SkTScopedComPtr<IWICImagingFactory> piImagingFactory; if (SUCCEEDED(hr)) { hr = CoCreateInstance( CLSID_WICImagingFactory , nullptr , CLSCTX_INPROC_SERVER , IID_PPV_ARGS(&piImagingFactory) ); } //Convert the SkWStream to an IStream. SkTScopedComPtr<IStream> piStream; if (SUCCEEDED(hr)) { hr = SkWIStream::CreateFromSkWStream(stream, &piStream); } //Create an encode of the appropriate type. SkTScopedComPtr<IWICBitmapEncoder> piEncoder; if (SUCCEEDED(hr)) { hr = piImagingFactory->CreateEncoder(type, nullptr, &piEncoder); } if (SUCCEEDED(hr)) { hr = piEncoder->Initialize(piStream.get(), WICBitmapEncoderNoCache); } //Create a the frame. SkTScopedComPtr<IWICBitmapFrameEncode> piBitmapFrameEncode; SkTScopedComPtr<IPropertyBag2> piPropertybag; if (SUCCEEDED(hr)) { hr = piEncoder->CreateNewFrame(&piBitmapFrameEncode, &piPropertybag); } if (SUCCEEDED(hr)) { PROPBAG2 name = { 0 }; name.dwType = PROPBAG2_TYPE_DATA; name.vt = VT_R4; name.pstrName = L"ImageQuality"; VARIANT value; VariantInit(&value); value.vt = VT_R4; value.fltVal = (FLOAT)(quality / 100.0); //Ignore result code. // This returns E_FAIL if the named property is not in the bag. //TODO(bungeman) enumerate the properties, // write and set hr iff property exists. piPropertybag->Write(1, &name, &value); } if (SUCCEEDED(hr)) { hr = piBitmapFrameEncode->Initialize(piPropertybag.get()); } //Set the size of the frame. const UINT width = bitmap->width(); const UINT height = bitmap->height(); if (SUCCEEDED(hr)) { hr = piBitmapFrameEncode->SetSize(width, height); } //Set the pixel format of the frame. If native encoded format cannot match BGRA, //it will choose the closest pixel format that it supports. const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA; WICPixelFormatGUID formatGUID = formatDesired; if (SUCCEEDED(hr)) { hr = piBitmapFrameEncode->SetPixelFormat(&formatGUID); } if (SUCCEEDED(hr)) { //Be sure the image format is the one requested. hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL; } //Write the pixels into the frame. if (SUCCEEDED(hr)) { SkAutoLockPixels alp(*bitmap); const UINT stride = (UINT) bitmap->rowBytes(); hr = piBitmapFrameEncode->WritePixels( height , stride , stride * height , reinterpret_cast<BYTE*>(bitmap->getPixels())); } if (SUCCEEDED(hr)) { hr = piBitmapFrameEncode->Commit(); } if (SUCCEEDED(hr)) { hr = piEncoder->Commit(); } return SUCCEEDED(hr);}
开发者ID:03050903,项目名称:skia,代码行数:101,
示例20: WmipEnableDisableTraceNTSTATUS WmipEnableDisableTrace( IN ULONG Ioctl, IN PWMITRACEENABLEDISABLEINFO TraceEnableInfo )/*++Routine Description: This routine will enable or disable a tracelog guidArguments: Ioctl is the IOCTL used to call this routine from UM TraceEnableInfo has all the info needed to enable or disableReturn Value:--*/{ NTSTATUS Status; LPGUID Guid; PBGUIDENTRY GuidEntry; BOOLEAN RequestSent; BOOLEAN IsEnable; ULONG64 LoggerContext; PAGED_CODE(); Guid = &TraceEnableInfo->Guid; Status = WmipCheckGuidAccess(Guid, TRACELOG_GUID_ENABLE, EtwpDefaultTraceSecurityDescriptor); if (NT_SUCCESS(Status)) { // // The following code is serialized for Trace Guids. Only one // control application can be enabling or disabling Trace Guids at a time. // Must be taken before SMCritSection is taken. Otherwise deadlocks will result. // WmipEnterTLCritSection(); IsEnable = TraceEnableInfo->Enable; // // Check for Heap and Crit Sec Tracing Guid. // if( IsEqualGUID(&HeapGuid,Guid)) { if(IsEnable){ SharedUserData->TraceLogging |= ENABLEHEAPTRACE; // // increment counter. The counter // is composed of first two bytes // SharedUserData->TraceLogging += 0x00010000; } else { SharedUserData->TraceLogging &= DISABLEHEAPTRACE; } WmipLeaveTLCritSection(); return STATUS_SUCCESS; } else if(IsEqualGUID(&CritSecGuid,Guid)){ if(IsEnable) { SharedUserData->TraceLogging |= ENABLECRITSECTRACE; // // increment counter. The counter // is composed of first two bytes // SharedUserData->TraceLogging += 0x00010000; } else { SharedUserData->TraceLogging &= DISABLECRITSECTRACE; } WmipLeaveTLCritSection(); return STATUS_SUCCESS; } else if(IsEqualGUID(&NtdllTraceGuid,Guid)){ if(!IsEnable){//.........这里部分代码省略.........
开发者ID:AlexiaChen,项目名称:wrk_study,代码行数:101,
示例21: enum_services_providersHRESULT enum_services_providers(const GUID * const service, DPN_SERVICE_PROVIDER_INFO * const info_buffer, DWORD * const buf_size, DWORD * const returned){ static const WCHAR serviceproviders[] = {'S','O','F','T','W','A','R','E','//','M','i','c','r','o','s','o','f','t','//', 'D','i','r','e','c','t','P','l','a','y','8','//', 'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','s',0}; static const WCHAR friendly[] = {'F','r','i','e','n','d','l','y',' ','N','a','m','e',0}; static const WCHAR dp_adapterW[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n', ' ','-',' ','I','P','v','4',0}; static const GUID adapter_guid = {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}}; DWORD req_size = 0; LONG res; HKEY key = NULL; LONG next_key; DWORD index = 0; WCHAR provider[MAX_PATH]; DWORD size; if(!returned || !buf_size) return E_POINTER; if(!service) { *returned = 0; res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceproviders, 0, KEY_READ, &key); if(res == ERROR_FILE_NOT_FOUND) return DPNERR_DOESNOTEXIST; next_key = RegEnumKeyW( key, index, provider, MAX_PATH); while(next_key == ERROR_SUCCESS) { res = RegGetValueW(key, provider, friendly, RRF_RT_REG_SZ, NULL, NULL, &size); if(res == ERROR_SUCCESS) { req_size += sizeof(DPN_SERVICE_PROVIDER_INFO) + size; (*returned)++; } index++; next_key = RegEnumKeyW( key, index, provider, MAX_PATH ); } } else if(IsEqualGUID(service, &CLSID_DP8SP_TCPIP)) { req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_adapterW); } else { FIXME("Application requested a provider we don't handle (yet)/n"); return DPNERR_DOESNOTEXIST; } if(*buf_size < req_size) { RegCloseKey(key); *buf_size = req_size; return DPNERR_BUFFERTOOSMALL; } if(!service) { int offset = 0; int count = 0; char *infoend = ((char *)info_buffer + (sizeof(DPN_SERVICE_PROVIDER_INFO) * (*returned))); index = 0; next_key = RegEnumKeyW( key, index, provider, MAX_PATH); while(next_key == ERROR_SUCCESS) { res = RegGetValueW(key, provider, friendly, RRF_RT_REG_SZ, NULL, NULL, &size); if(res == ERROR_SUCCESS) { info_buffer[count].guid = CLSID_DP8SP_TCPIP; info_buffer[count].pwszName = (LPWSTR)(infoend + offset); RegGetValueW(key, provider, friendly, RRF_RT_REG_SZ, NULL, info_buffer[count].pwszName, &size); offset += size; count++; } index++; next_key = RegEnumKeyW(key, index, provider, MAX_PATH); } } else { info_buffer->pwszName = (LPWSTR)(info_buffer + 1); lstrcpyW(info_buffer->pwszName, dp_adapterW); info_buffer->guid = adapter_guid; *returned = 1; } RegCloseKey(key); return DPN_OK;//.........这里部分代码省略.........
开发者ID:AndreRH,项目名称:wine,代码行数:101,
示例22: test_lsastatic void test_lsa(void){ NTSTATUS status; LSA_HANDLE handle; LSA_OBJECT_ATTRIBUTES object_attributes; ZeroMemory(&object_attributes, sizeof(object_attributes)); object_attributes.Length = sizeof(object_attributes); status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle); ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED, "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x/n", status); /* try a more restricted access mask if necessary */ if (status == STATUS_ACCESS_DENIED) { trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION/n"); status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_VIEW_LOCAL_INFORMATION, &handle); ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION) returned 0x%08x/n", status); } if (status == STATUS_SUCCESS) { PPOLICY_AUDIT_EVENTS_INFO audit_events_info; PPOLICY_PRIMARY_DOMAIN_INFO primary_domain_info; PPOLICY_ACCOUNT_DOMAIN_INFO account_domain_info; PPOLICY_DNS_DOMAIN_INFO dns_domain_info; status = pLsaQueryInformationPolicy(handle, PolicyAuditEventsInformation, (PVOID*)&audit_events_info); if (status == STATUS_ACCESS_DENIED) skip("Not enough rights to retrieve PolicyAuditEventsInformation/n"); else ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAuditEventsInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { pLsaFreeMemory((LPVOID)audit_events_info); } status = pLsaQueryInformationPolicy(handle, PolicyPrimaryDomainInformation, (PVOID*)&primary_domain_info); ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyPrimaryDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { if (primary_domain_info->Sid) { LPSTR strsid; if (pConvertSidToStringSidA(primary_domain_info->Sid, &strsid)) { if (primary_domain_info->Name.Buffer) { LPSTR name = NULL; UINT len; len = WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL ); name = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, name, len, NULL, NULL ); trace(" name: %s sid: %s/n", name, strsid); LocalFree( name ); } else trace(" name: NULL sid: %s/n", strsid); LocalFree( strsid ); } else trace("invalid sid/n"); } else trace("Running on a standalone system./n"); pLsaFreeMemory((LPVOID)primary_domain_info); } status = pLsaQueryInformationPolicy(handle, PolicyAccountDomainInformation, (PVOID*)&account_domain_info); ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { pLsaFreeMemory((LPVOID)account_domain_info); } /* This isn't supported in NT4 */ status = pLsaQueryInformationPolicy(handle, PolicyDnsDomainInformation, (PVOID*)&dns_domain_info); ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { if (dns_domain_info->Sid || !IsEqualGUID(&dns_domain_info->DomainGuid, &GUID_NULL)) { LPSTR strsid = NULL; LPSTR name = NULL; LPSTR domain = NULL; LPSTR forest = NULL; LPSTR guidstr = NULL; WCHAR guidstrW[64]; UINT len; guidstrW[0] = '/0'; pConvertSidToStringSidA(dns_domain_info->Sid, &strsid); StringFromGUID2(&dns_domain_info->DomainGuid, guidstrW, sizeof(guidstrW)/sizeof(WCHAR)); len = WideCharToMultiByte( CP_ACP, 0, guidstrW, -1, NULL, 0, NULL, NULL ); guidstr = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, guidstrW, -1, guidstr, len, NULL, NULL ); if (dns_domain_info->Name.Buffer) { len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL ); name = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, name, len, NULL, NULL ); } if (dns_domain_info->DnsDomainName.Buffer) { len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, NULL, 0, NULL, NULL ); domain = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, domain, len, NULL, NULL ); } if (dns_domain_info->DnsForestName.Buffer) { len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsForestName.Buffer, -1, NULL, 0, NULL, NULL ); forest = LocalAlloc( 0, len );//.........这里部分代码省略.........
开发者ID:devyn,项目名称:wine,代码行数:101,
示例23: LoopbackCaptureForvoid LoopbackCaptureFor(IMMDevice* mmDevice, std::string filename, int secs){ // open new file MMIOINFO mi = { 0 }; // some flags cause mmioOpen write to this buffer // but not any that we're using std::wstring wsFilename(filename.begin(), filename.end()); // mmioOpen wants a wstring HMMIO file = mmioOpen(const_cast<LPWSTR>(wsFilename.c_str()), &mi, MMIO_WRITE | MMIO_CREATE); time_t startTime = time(nullptr); // activate an IAudioClient IAudioClient* audioClient; HRESULT hr = mmDevice->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, (void**)&audioClient); if (FAILED(hr)) { fprintf(stderr, "IMMDevice::Activate(IAudioClient) failed: hr = 0x%08x", hr); return; } // get the default device periodicity REFERENCE_TIME hnsDefaultDevicePeriod; hr = audioClient->GetDevicePeriod(&hnsDefaultDevicePeriod, nullptr); if (FAILED(hr)) { fprintf(stderr, "IAudioClient::GetDevicePeriod failed: hr = 0x%08x/n", hr); audioClient->Release(); return; } // get the default device format WAVEFORMATEX* waveform; hr = audioClient->GetMixFormat(&waveform); if (FAILED(hr)) { fprintf(stderr, "IAudioClient::GetMixFormat failed: hr = 0x%08x/n", hr); CoTaskMemFree(waveform); audioClient->Release(); return; } // coerce int-16 wave format // can do this in-place since we're not changing the size of the format // also, the engine will auto-convert from float to int for us switch (waveform->wFormatTag) { case WAVE_FORMAT_IEEE_FLOAT: waveform->wFormatTag = WAVE_FORMAT_PCM; waveform->wBitsPerSample = BITS_PER_SAMPLE; waveform->nBlockAlign = BLOCK_ALIGN; waveform->nAvgBytesPerSec = BYTE_RATE; break; case WAVE_FORMAT_EXTENSIBLE: { // naked scope for case-local variable PWAVEFORMATEXTENSIBLE pEx = reinterpret_cast<PWAVEFORMATEXTENSIBLE>(waveform); if (IsEqualGUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, pEx->SubFormat)) { pEx->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; pEx->Samples.wValidBitsPerSample = BITS_PER_SAMPLE; waveform->wBitsPerSample = BITS_PER_SAMPLE; waveform->nBlockAlign = waveform->nChannels * BYTE_PER_SAMPLE; waveform->nAvgBytesPerSec = waveform->nBlockAlign * waveform->nSamplesPerSec; } break; } } MMCKINFO ckRIFF = { 0 }; MMCKINFO ckData = { 0 }; hr = WriteWaveHeader(file, waveform, &ckRIFF, &ckData); // create a periodic waitable timer HANDLE hWakeUp = CreateWaitableTimer(nullptr, FALSE, nullptr); UINT32 nBlockAlign = waveform->nBlockAlign; // call IAudioClient::Initialize // note that AUDCLNT_STREAMFLAGS_LOOPBACK and AUDCLNT_STREAMFLAGS_EVENTCALLBACK // do not work together... // the "data ready" event never gets set // so we're going to do a timer-driven loop hr = audioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_LOOPBACK, 0, 0, waveform, 0); if (FAILED(hr)) { fprintf(stderr, "IAudioClient::Initialize failed: hr = 0x%08x/n", hr); CloseHandle(hWakeUp); audioClient->Release(); return; } // free up waveform CoTaskMemFree(waveform); // activate an IAudioCaptureClient IAudioCaptureClient* audioCaptureClient; hr = audioClient->GetService(__uuidof(IAudioCaptureClient), (void**)&audioCaptureClient); // register with MMCSS DWORD nTaskIndex = 0;//.........这里部分代码省略.........
开发者ID:Nespa32,项目名称:sm_project,代码行数:101,
示例24: test_PSPropertyKeyFromString//.........这里部分代码省略......... HRESULT ret; char guid_buf[40], guid_buf2[40]; const struct { LPCWSTR pwzString; PROPERTYKEY *pkey; HRESULT hr_expect; PROPERTYKEY pkey_expect; } testcases[] = { {NULL, NULL, E_POINTER}, {NULL, &out, E_POINTER, out_init}, {emptyW, NULL, E_POINTER}, {emptyW, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_clsidW, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_truncatedW, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_nobracketsW, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_badbracketW, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_badcharW, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_badchar2W, &out, E_INVALIDARG, {GUID_NULL, 0}}, {fmtid_baddashW, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar3W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar4W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_baddash2W, &out, E_INVALIDARG, { {0x12345678,0,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar5W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar6W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_baddash3W, &out, E_INVALIDARG, { {0x12345678,0x1234,0,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar7W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar8W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0,0,0,0,0,0,0}}, 0}}, {fmtid_baddash4W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0,0,0,0,0,0,0}}, 0}}, {fmtid_badchar9W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0,0,0,0,0,0}}, 0}}, {fmtid_badchar9_adjW, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0,0,0,0,0,0}}, 0}}, {fmtid_badchar10W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0,0,0,0,0}}, 0}}, {fmtid_badchar11W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0,0,0,0}}, 0}}, {fmtid_badchar12W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0,0,0}}, 0}}, {fmtid_badchar13W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0,0}}, 0}}, {fmtid_badchar14W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0x90,0}}, 0}}, {fmtid_badbracket2W, &out, E_INVALIDARG, { {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0x90,0x00}}, 0 }}, {fmtid_spaceW, &out, E_INVALIDARG, {GUID_NULL, 0 }}, {fmtid_spaceendW, &out, E_INVALIDARG, {expect_guid, 0}}, {fmtid_spacesendW, &out, E_INVALIDARG, {expect_guid, 0}}, {fmtid_nopidW, &out, E_INVALIDARG, {expect_guid, 0}}, {fmtid_badpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_adjpidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_spacespidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_negpidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_negnegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_negnegnegpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_negspacepidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_negspacenegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_negspacespidW, &out, S_OK, {expect_guid, 0}}, {fmtid_pospidW, &out, S_OK, {expect_guid, 0}}, {fmtid_posnegpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_symbolpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_letterpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_spacepadpidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_spacemixpidW, &out, S_OK, {expect_guid, 1}}, {fmtid_tabpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_hexpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_mixedpidW, &out, S_OK, {expect_guid, 0}}, {fmtid_overflowpidW, &out, S_OK, {expect_guid, 3755744309U}}, {fmtid_commapidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_commaspidW, &out, S_OK, {expect_guid, 0}}, {fmtid_commaspacepidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_spacecommapidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_spccommaspcpidW, &out, S_OK, {expect_guid, 13579}}, {fmtid_spacescommaspidW, &out, S_OK, {expect_guid, 0}}, {fmtid_commanegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_spccommanegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_commaspcnegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_spccommaspcnegpidW, &out, S_OK, {expect_guid, 4294953717U}}, {fmtid_commanegspcpidW, &out, S_OK, {expect_guid, 0U}}, {fmtid_negcommapidW, &out, S_OK, {expect_guid, 0}}, {fmtid_normalpidW, &out, S_OK, {expect_guid, 13579}}, }; int i; for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) { if (testcases[i].pkey) *testcases[i].pkey = out_init; ret = PSPropertyKeyFromString(testcases[i].pwzString, testcases[i].pkey); ok(ret == testcases[i].hr_expect, "[%d] Expected PSPropertyKeyFromString to return 0x%08x, got 0x%08x/n", i, testcases[i].hr_expect, ret); if (testcases[i].pkey) { ok(IsEqualGUID(&testcases[i].pkey->fmtid, &testcases[i].pkey_expect.fmtid), "[%d] Expected GUID %s, got %s/n", i, show_guid(&testcases[i].pkey_expect.fmtid, guid_buf), show_guid(&testcases[i].pkey->fmtid, guid_buf2)); ok(testcases[i].pkey->pid == testcases[i].pkey_expect.pid, "[%d] Expected property ID %u, got %u/n", i, testcases[i].pkey_expect.pid, testcases[i].pkey->pid); } }}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:101,
示例25: ImpCypherDecryptSectorData// =========================================================================// Decryption function// Note: PlaintextLength must be set to the size of the PlaintextData buffer on// entry; on exit, this will be set to the size of the buffer used.NTSTATUSImpCypherDecryptSectorData( IN GUID* CypherGUID, IN LARGE_INTEGER SectorID, // Indexed from zero IN int SectorSize, // In bytes IN int KeyLength, // In bits IN FREEOTFEBYTE* Key, IN char* KeyASCII, // ASCII representation of "Key" IN int IVLength, // In bits IN FREEOTFEBYTE* IV, IN int CyphertextLength, // In bytes IN FREEOTFEBYTE* CyphertextData, OUT FREEOTFEBYTE* PlaintextData){ NTSTATUS status = STATUS_SUCCESS; // libtomcrypt can't handle NULL IVs in CBC mode - it ASSERTs that IV != NULL char ltcNullIV[FREEOTFE_MAX_CYPHER_BLOCKSIZE]; int cipher; symmetric_CBC *cbc; int errnum; unsigned int blockLength; DEBUGOUTCYPHERIMPL(DEBUGLEV_ENTER, (TEXT("ImpCypherDecryptData/n"))); cbc = FREEOTFE_MEMALLOC(sizeof(symmetric_CBC)); FREEOTFE_MEMZERO(cbc, sizeof(symmetric_CBC)); if (IsEqualGUID(&CIPHER_GUID_DES, CypherGUID)) { status = InitLTCDESCypher(&cipher); blockLength = des_desc.block_length; } else if (IsEqualGUID(&CIPHER_GUID_3DES, CypherGUID)) { status = InitLTC3DESCypher(&cipher); blockLength = des3_desc.block_length; } else { DEBUGOUTCYPHERIMPL(DEBUGLEV_ERROR, (TEXT("Unsupported cipher GUID passed in./n"))); status = STATUS_INVALID_PARAMETER; } // libtomcrypt can't handle NULL IVs in CBC mode - it ASSERTs that IV != NULL if ( (IVLength == 0) || (IV == NULL) ) { FREEOTFE_MEMZERO(<cNullIV, sizeof(ltcNullIV)); IV = (char*)<cNullIV; } if NT_SUCCESS(status) { // Start a CBC session if ((errnum = cbc_start( cipher, IV, Key, (KeyLength/8), 0, cbc )) != CRYPT_OK) { status = STATUS_UNSUCCESSFUL; DEBUGOUTCYPHERIMPL(DEBUGLEV_ERROR, (TEXT("Unable to start CBC session (errnum: %d)/n"), errnum)); } else { if ((errnum = cbc_decrypt( CyphertextData, PlaintextData, CyphertextLength, cbc )) != CRYPT_OK) { DEBUGOUTCYPHERIMPL(DEBUGLEV_ERROR, (TEXT("Unable to encrypt/decrypt block (errnum: %d)/n"), errnum)); status = STATUS_UNSUCCESSFUL; } cbc_done(cbc); } } SecZeroMemory(cbc, sizeof(symmetric_CBC)); FREEOTFE_FREE(cbc); DEBUGOUTCYPHERIMPL(DEBUGLEV_EXIT, (TEXT("ImpCypherDecryptData/n"))); return status;}
开发者ID:compvid30,项目名称:strongcrypt,代码行数:96,
示例26: IExtractIconW_Constructor/*************************************************************************** IExtractIconW_Constructor*/IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl){ CComPtr<IDefaultExtractIconInit> initIcon; IExtractIconW *extractIcon; GUID const * riid; int icon_idx; UINT flags; CHAR sTemp[MAX_PATH]; WCHAR wTemp[MAX_PATH]; LPITEMIDLIST pSimplePidl = ILFindLastID(pidl); HRESULT hr; hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon)); if (FAILED(hr)) return NULL; hr = initIcon->QueryInterface(IID_PPV_ARG(IExtractIconW,&extractIcon)); if (FAILED(hr)) return NULL; if (_ILIsDesktop(pSimplePidl)) { initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DESKTOP); } else if ((riid = _ILGetGUIDPointer(pSimplePidl))) { /* my computer and other shell extensions */ static const WCHAR fmt[] = { 'C', 'L', 'S', 'I', 'D', '//', '{', '%', '0', '8', 'l', 'x', '-', '%', '0', '4', 'x', '-', '%', '0', '4', 'x', '-', '%', '0', '2', 'x', '%', '0', '2', 'x', '-', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '%', '0', '2', 'x', '}', 0 }; WCHAR xriid[50]; swprintf(xriid, fmt, riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); const WCHAR* iconname = NULL; if (_ILIsBitBucket(pSimplePidl)) { static const WCHAR szFull[] = {'F','u','l','l',0}; static const WCHAR szEmpty[] = {'E','m','p','t','y',0}; IEnumIDList *EnumIDList = NULL; CoInitialize(NULL); IShellFolder2 *psfRecycleBin = NULL; IShellFolder *psfDesktop = NULL; hr = SHGetDesktopFolder(&psfDesktop); if (SUCCEEDED(hr)) hr = psfDesktop->BindToObject(pSimplePidl, NULL, IID_IShellFolder2, (void**) &psfRecycleBin); if (SUCCEEDED(hr)) hr = psfRecycleBin->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &EnumIDList); ULONG itemcount; LPITEMIDLIST pidl = NULL; if (SUCCEEDED(hr) && (hr = EnumIDList->Next(1, &pidl, &itemcount)) == S_OK) { CoTaskMemFree(pidl); iconname = szFull; } else { iconname = szEmpty; } if (psfDesktop) psfDesktop->Release(); if (psfRecycleBin) psfRecycleBin->Release(); if (EnumIDList) EnumIDList->Release(); } if (HCR_GetIconW(xriid, wTemp, iconname, MAX_PATH, &icon_idx)) { initIcon->SetNormalIcon(wTemp, icon_idx); } else { if (IsEqualGUID(*riid, CLSID_MyComputer)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_COMPUTER); else if (IsEqualGUID(*riid, CLSID_MyDocuments)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_DOCUMENTS); else if (IsEqualGUID(*riid, CLSID_NetworkPlaces)) initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_MY_NETWORK_PLACES); else initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_FOLDER); } } else if (_ILIsDrive (pSimplePidl)) { static const WCHAR drive[] = { 'D', 'r', 'i', 'v', 'e', 0 }; int icon_idx = -1; if (_ILGetDrive(pSimplePidl, sTemp, MAX_PATH))//.........这里部分代码省略.........
开发者ID:Nevermore2015,项目名称:reactos,代码行数:101,
示例27: test_lsastatic void test_lsa(void){ NTSTATUS status; LSA_HANDLE handle; LSA_OBJECT_ATTRIBUTES object_attributes; ZeroMemory(&object_attributes, sizeof(object_attributes)); object_attributes.Length = sizeof(object_attributes); status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle); ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED, "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08x/n", status); /* try a more restricted access mask if necessary */ if (status == STATUS_ACCESS_DENIED) { trace("LsaOpenPolicy(POLICY_ALL_ACCESS) failed, trying POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES/n"); status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES, &handle); ok(status == STATUS_SUCCESS, "LsaOpenPolicy(POLICY_VIEW_LOCAL_INFORMATION|POLICY_LOOKUP_NAMES) returned 0x%08x/n", status); } if (status == STATUS_SUCCESS) { PPOLICY_AUDIT_EVENTS_INFO audit_events_info; PPOLICY_PRIMARY_DOMAIN_INFO primary_domain_info; PPOLICY_ACCOUNT_DOMAIN_INFO account_domain_info; PPOLICY_DNS_DOMAIN_INFO dns_domain_info; HANDLE token; BOOL ret; status = pLsaQueryInformationPolicy(handle, PolicyAuditEventsInformation, (PVOID*)&audit_events_info); if (status == STATUS_ACCESS_DENIED) skip("Not enough rights to retrieve PolicyAuditEventsInformation/n"); else ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAuditEventsInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { pLsaFreeMemory((LPVOID)audit_events_info); } status = pLsaQueryInformationPolicy(handle, PolicyPrimaryDomainInformation, (PVOID*)&primary_domain_info); ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyPrimaryDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { if (primary_domain_info->Sid) { LPSTR strsid; if (pConvertSidToStringSidA(primary_domain_info->Sid, &strsid)) { if (primary_domain_info->Name.Buffer) { LPSTR name = NULL; UINT len; len = WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL ); name = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, primary_domain_info->Name.Buffer, -1, name, len, NULL, NULL ); trace(" name: %s sid: %s/n", name, strsid); LocalFree( name ); } else trace(" name: NULL sid: %s/n", strsid); LocalFree( strsid ); } else trace("invalid sid/n"); } else trace("Running on a standalone system./n"); pLsaFreeMemory((LPVOID)primary_domain_info); } status = pLsaQueryInformationPolicy(handle, PolicyAccountDomainInformation, (PVOID*)&account_domain_info); ok(status == STATUS_SUCCESS, "LsaQueryInformationPolicy(PolicyAccountDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { pLsaFreeMemory((LPVOID)account_domain_info); } /* This isn't supported in NT4 */ status = pLsaQueryInformationPolicy(handle, PolicyDnsDomainInformation, (PVOID*)&dns_domain_info); ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "LsaQueryInformationPolicy(PolicyDnsDomainInformation) failed, returned 0x%08x/n", status); if (status == STATUS_SUCCESS) { if (dns_domain_info->Sid || !IsEqualGUID(&dns_domain_info->DomainGuid, &GUID_NULL)) { LPSTR strsid = NULL; LPSTR name = NULL; LPSTR domain = NULL; LPSTR forest = NULL; LPSTR guidstr = NULL; WCHAR guidstrW[64]; UINT len; guidstrW[0] = '/0'; pConvertSidToStringSidA(dns_domain_info->Sid, &strsid); StringFromGUID2(&dns_domain_info->DomainGuid, guidstrW, sizeof(guidstrW)/sizeof(WCHAR)); len = WideCharToMultiByte( CP_ACP, 0, guidstrW, -1, NULL, 0, NULL, NULL ); guidstr = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, guidstrW, -1, guidstr, len, NULL, NULL ); if (dns_domain_info->Name.Buffer) { len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, NULL, 0, NULL, NULL ); name = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, dns_domain_info->Name.Buffer, -1, name, len, NULL, NULL ); } if (dns_domain_info->DnsDomainName.Buffer) { len = WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, NULL, 0, NULL, NULL ); domain = LocalAlloc( 0, len ); WideCharToMultiByte( CP_ACP, 0, dns_domain_info->DnsDomainName.Buffer, -1, domain, len, NULL, NULL ); } if (dns_domain_info->DnsForestName.Buffer) {//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:RosWine,代码行数:101,
注:本文中的IsEqualGUID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ IsEqualIID函数代码示例 C++ IsEqual函数代码示例 |