void ALDeviceList::SelectBestDevice() { m_defaultDeviceIndex = -1; int best_majorVersion = -1; int best_minorVersion = -1; int majorVersion, minorVersion; for (int i = 0; i < GetNumDevices(); i++) { if( m_defaultDeviceName!=GetDeviceName(i) )continue; GetDeviceVersion (i, &majorVersion, &minorVersion); if( (majorVersion>best_majorVersion) || (majorVersion==best_majorVersion && minorVersion>best_minorVersion) ) { best_majorVersion = majorVersion; best_minorVersion = minorVersion; m_defaultDeviceIndex = i; } } if(m_defaultDeviceIndex==-1) { // not selected R_ASSERT(GetNumDevices()!=0); m_defaultDeviceIndex = 0; //first }; if(GetNumDevices()==0) Msg("SOUND: OpenAL: SelectBestDevice: list empty"); else Msg("SOUND: OpenAL: SelectBestDevice is %s %d.%d",GetDeviceName(m_defaultDeviceIndex).c_str(),best_majorVersion,best_minorVersion); }
IPCCommandResult FileIO::IOCtl(const IOCtlRequest& request) { DEBUG_LOG(IOS_FILEIO, "FileIO: IOCtl (Device=%s)", m_name.c_str()); s32 return_value = IPC_SUCCESS; switch (request.request) { case ISFS_IOCTL_GETFILESTATS: { if (m_file->IsOpen()) { DEBUG_LOG(IOS_FILEIO, "File: %s, Length: %" PRIu64 ", Pos: %i", m_name.c_str(), m_file->GetSize(), m_SeekPos); Memory::Write_U32(static_cast<u32>(m_file->GetSize()), request.buffer_out); Memory::Write_U32(m_SeekPos, request.buffer_out + 4); } else { return_value = FS_ENOENT; } } break; default: request.Log(GetDeviceName(), LogTypes::IOS_FILEIO, LogTypes::LERROR); } return GetDefaultReply(return_value); }
BOOL CBTTestDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CFont *font=new CFont; font->CreateFont( 14, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation 0, // nWeight FALSE, // bItalic FALSE, // bUnderline FALSE, // cStrikeOut DEFAULT_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality FF_DONTCARE, // nPitchAndFamily "Courier New"); // lpszFacename m_lbHCI.SetFont(font); fbtLogSetFile("bttest.log"); fbtLogSetLevel(255); UINT i=0; CString szString; while (i<255 && !IsAttached()) { szString.Format("\\\\.\\FbtUsb%02d", i++); CHciRoundTrip::Attach(szString); } if (!IsAttached()) { MessageBox(_T("No Bluetooth hardware detected!")); exit(0); } // Retrieve the HW driver device name fbtLog(fbtLog_Notice, _T("CBTTestDlg::OnInitDialog: Connected to device %s"), szString); char szDeviceName[80]={0}; if (GetDeviceName(szDeviceName, 80)>0) m_stDevice.SetWindowText(szDeviceName); // Let the dialog finish creating itself and displaying the window // When its done, it will process its message queue on catch WM_USER+1 PostMessage(WM_USER+1, 0, 0); return TRUE; // return TRUE unless you set the focus to a control }
IPCCommandResult CWII_IPC_HLE_Device_usb_oh0_46d_a03::IOCtl(u32 CommandAddress) { IPCCommandResult SendReply = GetNoReply(); SIOCtlVBuffer CommandBuffer(CommandAddress); switch (CommandBuffer.Parameter) { case USBV0_IOCTL_DEVREMOVALHOOK: // Reply is sent when device is removed //SendReply = true; break; default: WARN_LOG(OSHLE, "%s - IOCtl:", GetDeviceName().c_str()); WARN_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter); WARN_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); WARN_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); WARN_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); break; } Memory::Write_U32(0, CommandAddress + 4); return SendReply; }
IPCCommandResult CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 CommandAddress) { IPCCommandResult SendReply = GetNoReply(); SIOCtlVBuffer CommandBuffer(CommandAddress); switch (CommandBuffer.Parameter) { case USBV0_IOCTL_DEVINSERTHOOKID: case USBV0_IOCTL_DEVINSERTHOOK: { u16 vid = Memory::Read_U16(CommandBuffer.InBuffer[0].m_Address); u16 pid = Memory::Read_U16(CommandBuffer.InBuffer[1].m_Address); WARN_LOG(OSHLE, "DEVINSERTHOOK %x/%x", vid, pid); // It is inserted SendReply = GetDefaultReply(); } break; default: WARN_LOG(OSHLE, "%s - IOCtlV:", GetDeviceName().c_str()); WARN_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter); WARN_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); WARN_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); WARN_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer, LogTypes::OSHLE, LogTypes::LWARNING); break; } Memory::Write_U32(0, CommandAddress + 4); return SendReply; }
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(u32 CommandAddress) { IPCCommandResult SendReply = GetNoReply(); SIOCtlVBuffer CommandBuffer(CommandAddress); /*switch (CommandBuffer.Parameter) { default: WARN_LOG(OSHLE, "%s - IOCtlV:", GetDeviceName().c_str()); WARN_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter); WARN_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); WARN_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); WARN_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); break; }*/ WARN_LOG(OSHLE, "%s - IOCtlV:", GetDeviceName().c_str()); WARN_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter); WARN_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); WARN_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); WARN_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); Memory::Write_U32(0, CommandAddress + 4); return SendReply; }
IPCCommandResult NetIPTop::HandleGetSockNameRequest(const IOCtlRequest& request) { u32 fd = Memory::Read_U32(request.buffer_in); request.Log(GetDeviceName(), LogTypes::IOS_WC24); sockaddr sa; socklen_t sa_len = sizeof(sa); int ret = getsockname(WiiSockMan::GetInstance().GetHostSocket(fd), &sa, &sa_len); if (request.buffer_out_size < 2 + sizeof(sa.sa_data)) WARN_LOG(IOS_NET, "IOCTL_SO_GETSOCKNAME output buffer is too small. Truncating"); if (request.buffer_out_size > 0) Memory::Write_U8(request.buffer_out_size, request.buffer_out); if (request.buffer_out_size > 1) Memory::Write_U8(sa.sa_family & 0xFF, request.buffer_out + 1); if (request.buffer_out_size > 2) { Memory::CopyToEmu(request.buffer_out + 2, &sa.sa_data, std::min<size_t>(sizeof(sa.sa_data), request.buffer_out_size - 2)); } return GetDefaultReply(ret); }
IPCCommandResult NetIPTop::HandleGetSockOptRequest(const IOCtlRequest& request) { u32 fd = Memory::Read_U32(request.buffer_out); u32 level = Memory::Read_U32(request.buffer_out + 4); u32 optname = Memory::Read_U32(request.buffer_out + 8); request.Log(GetDeviceName(), LogTypes::IOS_WC24); // Do the level/optname translation int nat_level = MapWiiSockOptLevelToNative(level); int nat_optname = MapWiiSockOptNameToNative(optname); u8 optval[20]; u32 optlen = 4; int ret = getsockopt(WiiSockMan::GetInstance().GetHostSocket(fd), nat_level, nat_optname, (char*)&optval, (socklen_t*)&optlen); const s32 return_value = WiiSockMan::GetNetErrorCode(ret, "SO_GETSOCKOPT", false); Memory::Write_U32(optlen, request.buffer_out + 0xC); Memory::CopyToEmu(request.buffer_out + 0x10, optval, optlen); if (optname == SO_ERROR) { s32 last_error = WiiSockMan::GetInstance().GetLastNetError(); Memory::Write_U32(sizeof(s32), request.buffer_out + 0xC); Memory::Write_U32(last_error, request.buffer_out + 0x10); } return GetDefaultReply(return_value); }
PStringArray PVideoOutputDevice_EKIGA::GetDeviceNames() const { PStringArray devlist; devlist.AppendString(GetDeviceName()); return devlist; }
/* ======================== GetDisplayCoordinates ======================== */ static bool GetDisplayCoordinates( const int deviceNum, int & x, int & y, int & width, int & height, int & displayHz ) { idStr deviceName = GetDeviceName( deviceNum ); if ( deviceName.Length() == 0 ) { return false; } DISPLAY_DEVICE device = {}; device.cb = sizeof( device ); if ( !EnumDisplayDevices( 0, // lpDevice deviceNum, &device, 0 /* dwFlags */ ) ) { return false; } DISPLAY_DEVICE monitor; monitor.cb = sizeof( monitor ); if ( !EnumDisplayDevices( deviceName.c_str(), 0, &monitor, 0 /* dwFlags */ ) ) { return false; } DEVMODE devmode; devmode.dmSize = sizeof( devmode ); if ( !EnumDisplaySettings( deviceName.c_str(),ENUM_CURRENT_SETTINGS, &devmode ) ) { return false; } common->Printf( "display device: %i\n", deviceNum ); common->Printf( " DeviceName : %s\n", device.DeviceName ); common->Printf( " DeviceString: %s\n", device.DeviceString ); common->Printf( " StateFlags : 0x%x\n", device.StateFlags ); common->Printf( " DeviceID : %s\n", device.DeviceID ); common->Printf( " DeviceKey : %s\n", device.DeviceKey ); common->Printf( " DeviceName : %s\n", monitor.DeviceName ); common->Printf( " DeviceString: %s\n", monitor.DeviceString ); common->Printf( " StateFlags : 0x%x\n", monitor.StateFlags ); common->Printf( " DeviceID : %s\n", monitor.DeviceID ); common->Printf( " DeviceKey : %s\n", monitor.DeviceKey ); common->Printf( " dmPosition.x : %i\n", devmode.dmPosition.x ); common->Printf( " dmPosition.y : %i\n", devmode.dmPosition.y ); common->Printf( " dmBitsPerPel : %i\n", devmode.dmBitsPerPel ); common->Printf( " dmPelsWidth : %i\n", devmode.dmPelsWidth ); common->Printf( " dmPelsHeight : %i\n", devmode.dmPelsHeight ); common->Printf( " dmDisplayFlags : 0x%x\n", devmode.dmDisplayFlags ); common->Printf( " dmDisplayFrequency: %i\n", devmode.dmDisplayFrequency ); x = devmode.dmPosition.x; y = devmode.dmPosition.y; width = devmode.dmPelsWidth; height = devmode.dmPelsHeight; displayHz = devmode.dmDisplayFrequency; return true; }
IPCCommandResult STMImmediate::IOCtl(const IOCtlRequest& request) { s32 return_value = IPC_SUCCESS; switch (request.request) { case IOCTL_STM_IDLE: case IOCTL_STM_SHUTDOWN: NOTICE_LOG(IOS_STM, "IOCTL_STM_IDLE or IOCTL_STM_SHUTDOWN received, shutting down"); Core::QueueHostJob(&Core::Stop, false); break; case IOCTL_STM_RELEASE_EH: if (!s_event_hook_request) { return_value = IPC_ENOENT; break; } Memory::Write_U32(0, s_event_hook_request->buffer_out); EnqueueReply(*s_event_hook_request, IPC_SUCCESS); s_event_hook_request.reset(); break; case IOCTL_STM_HOTRESET: INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(IOS_STM, " IOCTL_STM_HOTRESET"); break; case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes) INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(IOS_STM, " IOCTL_STM_VIDIMMING"); // Memory::Write_U32(1, buffer_out); // return_value = 1; break; case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes) INFO_LOG(IOS_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(IOS_STM, " IOCTL_STM_LEDMODE"); break; default: request.DumpUnknown(GetDeviceName(), LogTypes::IOS_STM); } return GetDefaultReply(return_value); }
BOOL CDevCProbe::SetDeviceName( PDeviceDescriptor_t d, const std::tstring& strName ){ if (d && d->Com && strName.size() <= 15) { d->Com->WriteString(TEXT("$PCPILOT,C,SET,")); d->Com->WriteString(strName.c_str()); d->Com->WriteString(TEXT("\r\n")); return GetDeviceName(d); } return FALSE; }
tbool CDeviceManagerWaveIO::GetDeviceName_OutputsOnly(tint iIndex, tchar* pszName) { if (!DeviceMayHaveOutput(iIndex)) { *pszName = '\0'; return false; } return GetDeviceName(iIndex, pszName); } // GetDeviceName_OutputsOnly
IPCCommandResult NetIPTop::HandleListenRequest(const IOCtlRequest& request) { u32 fd = Memory::Read_U32(request.buffer_in); u32 BACKLOG = Memory::Read_U32(request.buffer_in + 0x04); u32 ret = listen(WiiSockMan::GetInstance().GetHostSocket(fd), BACKLOG); request.Log(GetDeviceName(), LogTypes::IOS_WC24); return GetDefaultReply(WiiSockMan::GetNetErrorCode(ret, "SO_LISTEN", false)); }
IPCCommandResult NetIPTop::HandleShutdownRequest(const IOCtlRequest& request) { request.Log(GetDeviceName(), LogTypes::IOS_WC24); u32 fd = Memory::Read_U32(request.buffer_in); u32 how = Memory::Read_U32(request.buffer_in + 4); int ret = shutdown(WiiSockMan::GetInstance().GetHostSocket(fd), how); return GetDefaultReply(WiiSockMan::GetNetErrorCode(ret, "SO_SHUTDOWN", false)); }
// void GetDeviceName( int *DeviceId, char strDeviceName[], int nErr[]); static PyObject* ParODE_GetDeviceName(PyObject *self, PyObject *args){ int deviceID; if(!PyArg_ParseTuple(args, "i", &deviceID)) return NULL; char deviceName[128]; int nErr = 0; GetDeviceName(&deviceID, deviceName, &nErr); return Py_BuildValue("s i", deviceName, nErr); }
void MMDeviceAudioSource::StartCapture() { if(mmClient) { mmClient->Start(); UINT64 freq; mmClock->GetFrequency(&freq); Log(TEXT("frequency for device '%s' is %llu, samples per sec is %u"), GetDeviceName(), freq, this->GetSamplesPerSec()); } }
void USBHost::DispatchHooks(const DeviceChangeHooks& hooks) { for (const auto& hook : hooks) { INFO_LOG(IOS_USB, "%s - %s device: %04x:%04x", GetDeviceName().c_str(), hook.second == ChangeEvent::Inserted ? "New" : "Removed", hook.first->GetVid(), hook.first->GetPid()); OnDeviceChange(hook.second, hook.first); } if (!hooks.empty()) OnDeviceChangeEnd(); }
IPCCommandResult CWII_IPC_HLE_Device_usb_oh0::IOCtl(u32 CommandAddress) { u32 Command = Memory::Read_U32(CommandAddress + 0x0c); u32 BufferIn = Memory::Read_U32(CommandAddress + 0x10); u32 BufferInSize = Memory::Read_U32(CommandAddress + 0x14); u32 BufferOut = Memory::Read_U32(CommandAddress + 0x18); u32 BufferOutSize = Memory::Read_U32(CommandAddress + 0x1c); WARN_LOG(OSHLE, "%s - IOCtl:%x", GetDeviceName().c_str(), Command); WARN_LOG(OSHLE, "%x:%x %x:%x", BufferIn, BufferInSize, BufferOut, BufferOutSize); return IOCtlV(CommandAddress); }
IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtl(u32 _CommandAddress) { u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 Command = Memory::Read_U32(_CommandAddress + 0x0C); INFO_LOG(WII_IPC_SSL, "%s unknown %i " "(BufferIn: (%08x, %i), BufferOut: (%08x, %i)", GetDeviceName().c_str(), Command, BufferIn, BufferInSize, BufferOut, BufferOutSize); Memory::Write_U32(0, _CommandAddress + 0x4); return IPC_DEFAULT_REPLY; }
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(u32 _CommandAddress) { SIOCtlVBuffer CommandBuffer(_CommandAddress); INFO_LOG(OSHLE, "%s - IOCtlV:", GetDeviceName().c_str()); INFO_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter); INFO_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); INFO_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); INFO_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); Memory::Write_U32(0, _CommandAddress + 4); return GetNoReply(); }
bool BL_CDEngine::OpenDevice(int8 aIndex) { // If a device is already opened, then close it first. CloseDevice(); // Open the device for reading. mCurrentDevice = open(GetDeviceName(aIndex), O_RDONLY); // Error? if(mCurrentDevice < 0) { return FALSE; } return TRUE; }
void CBCGPRibbonBackstagePagePrint::OnPrinterProperties() { CWaitCursor wait; CWinApp* pApp = AfxGetApp(); if (pApp == NULL) { ASSERT(FALSE); return; } int nSelection = GetPrinterSelection (); if (nSelection < 0) { ASSERT(FALSE); return; } PRINTDLG* dlgPrint = GetPrintDlg(); ASSERT(dlgPrint != NULL); if (dlgPrint->hDevMode == NULL) { ASSERT(FALSE); return; } CString strDeviceName (GetDeviceName ()); HANDLE hPrinter = OpenPrinterByName(strDeviceName); if (hPrinter == NULL) { ASSERT(FALSE); return; } UpdatePrinterProperties (TRUE); LPDEVMODE lpDevMode = (LPDEVMODE)::GlobalLock (dlgPrint->hDevMode); BOOL bRes = ::DocumentProperties(GetParent()->GetSafeHwnd (), hPrinter, (LPTSTR)(LPCTSTR)strDeviceName, lpDevMode, lpDevMode, DM_IN_PROMPT | DM_IN_BUFFER | DM_OUT_BUFFER) == IDOK; ::GlobalUnlock (dlgPrint->hDevMode); ::ClosePrinter (hPrinter); if (bRes) { UpdatePrinterProperties(FALSE, TRUE); } }
bool AudioSource::GetBuffer(float **buffer, UINT *numFrames, QWORD targetTimestamp) { bool bSuccess = false; outputBuffer.Clear(); while(audioSegments.Num()) { if(audioSegments[0]->timestamp < targetTimestamp) { Log(TEXT("Audio timestamp for device '%s' was behind target timestamp by %llu! Had to delete audio segment.\r\n"), GetDeviceName(), targetTimestamp-audioSegments[0]->timestamp); delete audioSegments[0]; audioSegments.Remove(0); } else break; } if(audioSegments.Num()) { bool bUseSegment = false; AudioSegment *segment = audioSegments[0]; QWORD difference = (segment->timestamp-targetTimestamp); if(difference <= 20) { //Log(TEXT("segment.timestamp: %llu, targetTimestamp: %llu"), segment.timestamp, targetTimestamp); outputBuffer.TransferFrom(segment->audioData); delete segment; audioSegments.Remove(0); bSuccess = true; } } outputBuffer.SetSize(441*2); *buffer = outputBuffer.Array(); *numFrames = outputBuffer.Num()/2; return bSuccess; }
static void GetAllDeviceNames( struct port_in * pin ) { struct connection_in * in = pin->first ; ASCII * remaining_device_list = owstrdup( pin->init_data ) ; ASCII * remember_location = remaining_device_list ; while (remaining_device_list != NULL) { const ASCII *current_device_start; for (current_device_start = strsep(&remaining_device_list, " ,"); current_device_start[0] != '\0'; ++current_device_start) { // note that strsep updates "remaining_device_list" pointer if (current_device_start[0] != ' ' && current_device_start[0] != ',') { break; } } GetDeviceName( ¤t_device_start, in ) ; } SAFEFREE( remember_location ) ; in->AnyDevices = (DirblobElements(&(in->master.fake.main)) > 0) ? anydevices_yes : anydevices_no ; }
NetworkHandler::NetworkHandler(std::string deviceName) { deviceName_ = deviceName; myMac_ = EthernetUtils::GetMacOfInterface(deviceName); myIP_ = EthernetUtils::GetIPOfInterface(GetDeviceName()); u_int32_t flags = 0; flags |= PF_RING_LONG_HEADER; flags |= PF_RING_PROMISC; flags |= PF_RING_DNA_SYMMETRIC_RSS; /* Note that symmetric RSS is ignored by non-DNA drivers */ const int snaplen = 128; pfring** rings = new pfring*[MAX_NUM_RX_CHANNELS]; numberOfQueues_ = pfring_open_multichannel((char*) deviceName.data(), snaplen, flags, rings); queueRings_ = new ntop::PFring *[numberOfQueues_]; for (uint_fast8_t i = 0; i < numberOfQueues_; i++) { std::string queDeviceName = deviceName; queDeviceName = deviceName + "@" + std::to_string((int) i); /* * http://www.ntop.org/pfring_api/pfring_8h.html#a397061c37a91876b6b68584e2cb99da5 */ pfring_set_poll_watermark(rings[i], 128); queueRings_[i] = new ntop::PFring(rings[i], (char*) queDeviceName.data(), snaplen, flags); if (queueRings_[i]->enable_ring() >= 0) { LOG_INFO<< "Successfully opened device " << queueRings_[i]->get_device_name(); } else { LOG_ERROR << "Unable to open device " << queDeviceName << "! Is pf_ring not loaded or do you use quick mode and have already a socket bound to this device?!"; exit(1); } } asyncSendData_.set_capacity(1000); }
HANDLE CBCGPRibbonBackstagePagePrint::OpenPrinterByName (LPCTSTR lpDeviceName) { CString strDeviceName (lpDeviceName); if (strDeviceName.IsEmpty ()) { strDeviceName = GetDeviceName (); } HANDLE hPrinter = NULL; if (!strDeviceName.IsEmpty ()) { if (!::OpenPrinter ((LPTSTR)(LPCTSTR)strDeviceName, &hPrinter, NULL)) { hPrinter = NULL; } } return hPrinter; }
std::vector<std::string> LoadedDeviceAdapter::GetAvailableDeviceNames() const { unsigned deviceCount = GetNumberOfDevices(); std::vector<std::string> deviceNames; deviceNames.reserve(deviceCount); for (unsigned i = 0; i < deviceCount; ++i) { ModuleStringBuffer nameBuf(this, "GetDeviceName"); bool ok = GetDeviceName(i, nameBuf.GetBuffer(), nameBuf.GetMaxStrLen()); if (!ok) { throw CMMError("Cannot get device name at index " + ToString(i) + " from device adapter module " + ToQuotedString(name_)); } deviceNames.push_back(nameBuf.Get()); } return deviceNames; }
bool CWII_IPC_HLE_Device_hid::IOCtlV(u32 _CommandAddress) { Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HID, LogTypes::LWARNING); u32 ReturnValue = 0; SIOCtlVBuffer CommandBuffer(_CommandAddress); DEBUG_LOG(WII_IPC_HID, "%s - IOCtlV:", GetDeviceName().c_str()); DEBUG_LOG(WII_IPC_HID, " Parameter: 0x%x", CommandBuffer.Parameter); DEBUG_LOG(WII_IPC_HID, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); DEBUG_LOG(WII_IPC_HID, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); DEBUG_LOG(WII_IPC_HID, " BufferVector: 0x%08x", CommandBuffer.BufferVector); DEBUG_LOG(WII_IPC_HID, " PayloadAddr: 0x%08x", CommandBuffer.PayloadBuffer[0].m_Address); DEBUG_LOG(WII_IPC_HID, " PayloadSize: 0x%08x", CommandBuffer.PayloadBuffer[0].m_Size); #if defined(_DEBUG) || defined(DEBUGFAST) DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); #endif Memory::Write_U32(ReturnValue, _CommandAddress + 4); return true; }
int Hub::DetectInstalledDevices() { ClearInstalledDevices(); InitializeModuleData(); char hubname[MM::MaxStrLength]; GetName(hubname); for(unsigned i = 0; i < GetNumberOfDevices(); i++) { char devname[MM::MaxStrLength]; if(GetDeviceName(i, devname, MM::MaxStrLength) && strcmp(hubname, devname) != 0) { MM::Device* dev = CreateDevice(devname); AddInstalledDevice(dev); } } return DEVICE_OK; }