/////////////////////////////////////////////////////////////////////////////// /// @fn CConnection::Send /// @description Given a message and wether or not it should be sequenced, /// write that message to the channel. /// @pre The CConnection object is initialized. /// @post If the window is in not full, the message will have been written to /// to the channel. Before being sent the message has been signed with the /// UUID, source hostname and sequence number (if it is being sequenced). /// If the message is being sequenced and the window is not already full, /// the timeout timer is cancelled and reset. /// @param p_mesg A CMessage to write to the channel. /////////////////////////////////////////////////////////////////////////////// void CConnection::Send(CMessage & p_mesg) { Logger.Debug << __PRETTY_FUNCTION__ << std::endl; // If the UUID of the reciepient (The value stored by GetUUID of this // object) is the same as the this node's uuid (As stored by the // Connection manager) place the message directly into the recieved // Queue. if(GetUUID() == GetConnectionManager().GetUUID()) { p_mesg.SetSourceUUID(GetConnectionManager().GetUUID()); p_mesg.SetSourceHostname(GetConnectionManager().GetHostname()); p_mesg.SetSendTimestampNow(); GetDispatcher().HandleRequest(GetBroker(),p_mesg); return; } ProtocolMap::iterator sit = m_protocols.find(p_mesg.GetProtocol()); if(sit == m_protocols.end()) { sit = m_protocols.find(m_defaultprotocol); } (*sit).second->Send(p_mesg); }
nsresult MediaEngineWebRTCVideoSource::Allocate(const dom::MediaTrackConstraints &aConstraints, const MediaEnginePrefs &aPrefs) { LOG((__FUNCTION__)); if (mState == kReleased && mInitDone) { // Note: if shared, we don't allow a later opener to affect the resolution. // (This may change depending on spec changes for Constraints/settings) if (!ChooseCapability(aConstraints, aPrefs)) { return NS_ERROR_UNEXPECTED; } if (mViECapture->AllocateCaptureDevice(GetUUID().get(), kMaxUniqueIdLength, mCaptureIndex)) { return NS_ERROR_FAILURE; } mState = kAllocated; LOG(("Video device %d allocated", mCaptureIndex)); } else if (MOZ_LOG_TEST(GetMediaManagerLog(), LogLevel::Debug)) { MonitorAutoLock lock(mMonitor); if (mSources.IsEmpty()) { LOG(("Video device %d reallocated", mCaptureIndex)); } else { LOG(("Video device %d allocated shared", mCaptureIndex)); } } return NS_OK; }
// Copy Constructor ODPoint::ODPoint( ODPoint* orig ) { m_ODPointName = orig->GetName(); m_lat = orig->m_lat; m_lon = orig->m_lon; m_seg_len = orig->m_seg_len; m_seg_vmg = orig->m_seg_vmg; m_seg_etd = orig->m_seg_etd; m_bDynamicName = orig->m_bDynamicName; m_bPtIsSelected = orig->m_bPtIsSelected; m_bIsBeingEdited = orig->m_bIsBeingEdited; m_bIsActive = orig->m_bIsActive; m_bPointPropertiesBlink = orig->m_bPointPropertiesBlink; m_bPathManagerBlink = orig->m_bPathManagerBlink; m_bIsInRoute = orig->m_bIsInRoute; m_bIsInPath = orig->m_bIsInPath; m_bIsInBoundary = orig->m_bIsInBoundary; m_bIsInTrack = orig->m_bIsInTrack; m_CreateTimeX = orig->m_CreateTimeX; m_GPXTrkSegNo = orig->m_GPXTrkSegNo; m_bIsolatedMark = orig->m_bIsolatedMark; m_bShowName = orig->m_bShowName; m_bKeepXPath = orig->m_bKeepXPath; m_bIsVisible = orig->m_bIsVisible; m_bIsListed = orig->m_bIsListed; CurrentRect_in_DC = orig->CurrentRect_in_DC; m_NameLocationOffsetX = orig->m_NameLocationOffsetX; m_NameLocationOffsetY = orig->m_NameLocationOffsetY; m_pMarkFont = orig->m_pMarkFont; m_ODPointDescription = orig->m_ODPointDescription; m_btemp = orig->m_btemp; m_sTypeString = orig->m_sTypeString; m_HyperlinkList = new HyperlinkList; m_IconName = orig->m_IconName; ReLoadIcon(); m_bIsInLayer = orig->m_bIsInLayer; m_GUID = GetUUID(); m_SelectNode = NULL; m_ManagerNode = NULL; m_fIconScaleFactor = 1.0; m_ODPointArrivalRadius = orig->GetODPointArrivalRadius(); m_bShowODPointRangeRings = orig->m_bShowODPointRangeRings; m_iODPointRangeRingsNumber = g_iODPointRangeRingsNumber; m_fODPointRangeRingsStep = g_fODPointRangeRingsStep; m_iODPointRangeRingsStepUnits = g_iODPointRangeRingsStepUnits; m_wxcODPointRangeRingsColour = g_colourODPointRangeRingsColour; m_iRangeRingStyle = wxPENSTYLE_SOLID; m_iRangeRingWidth = 2; SetRangeRingBBox(); CreateColourSchemes(); SetColourScheme(g_global_color_scheme); }
void MediaEngineWebRTCVideoSource::GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) { if (!mHardcodedCapabilities.IsEmpty()) { MediaEngineCameraVideoSource::GetCapability(aIndex, aOut); } mViECapture->GetCaptureCapability(GetUUID().get(), kMaxUniqueIdLength, aIndex, aOut); }
bool Object::QueryInterface( const UUID &uuid, void **ppObject ) { if( uuid == GetUUID() || uuid == UUIDS::IUNKNOWN) { *ppObject = this; return true; } return false; }
bool Texture::QueryInterface( const UUID &uuid, void **ppObject ) { if( uuid == GetUUID() || uuid == Object::GetUUID() || uuid == Buffer::GetUUID() || uuid == Texture::GetUUID() ) { *ppObject = this; return true; } return false; }
bool OpenGLShaderUniformBuffer::QueryInterface( const UUID &uuid, void **ppObject ) { if( uuid == GetUUID() || uuid == Object::GetUUID() || uuid == Buffer::GetUUID() || uuid == ShaderUniformBuffer::GetUUID() || uuid == OpenGLShaderUniformBuffer::GetUUID() ) { *ppObject = this; return true; } return false; }
int GDALJP2Box::DumpReadable( FILE *fpOut, int nIndentLevel ) { if( fpOut == NULL ) fpOut = stdout; int i; for(i=0;i<nIndentLevel;i++) fprintf( fpOut, " " ); fprintf( fpOut, " Type=%s, Offset=" CPL_FRMT_GIB "/" CPL_FRMT_GIB", Data Size=" CPL_FRMT_GIB, szBoxType, nBoxOffset, nDataOffset, GetDataLength() ); if( IsSuperBox() ) { fprintf( fpOut, " (super)" ); } fprintf( fpOut, "\n" ); if( IsSuperBox() ) { GDALJP2Box oSubBox( GetFILE() ); for( oSubBox.ReadFirstChild( this ); strlen(oSubBox.GetType()) > 0; oSubBox.ReadNextChild( this ) ) { oSubBox.DumpReadable( fpOut, nIndentLevel + 1 ); } } if( EQUAL(GetType(),"uuid") ) { char *pszHex = CPLBinaryToHex( 16, GetUUID() ); for(i=0;i<nIndentLevel;i++) fprintf( fpOut, " " ); fprintf( fpOut, " UUID=%s", pszHex ); if( EQUAL(pszHex,"B14BF8BD083D4B43A5AE8CD7D5A6CE03") ) fprintf( fpOut, " (GeoTIFF)" ); if( EQUAL(pszHex,"96A9F1F1DC98402DA7AED68E34451809") ) fprintf( fpOut, " (MSI Worldfile)" ); if( EQUAL(pszHex,"BE7ACFCB97A942E89C71999491E3AFAC") ) fprintf( fpOut, " (XMP)" ); CPLFree( pszHex ); fprintf( fpOut, "\n" ); } return 0; }
void MediaEngineRemoteVideoSource::GetCapability(size_t aIndex, webrtc::CaptureCapability& aOut) { if (!mHardcodedCapabilities.IsEmpty()) { MediaEngineCameraVideoSource::GetCapability(aIndex, aOut); } mozilla::camera::GetCaptureCapability(mCapEngine, GetUUID().get(), aIndex, aOut); }
size_t MediaEngineRemoteVideoSource::NumCapabilities() { int num = mozilla::camera::NumberOfCapabilities(mCapEngine, GetUUID().get()); if (num > 0) { return num; } switch(mMediaSource) { case dom::MediaSourceEnum::Camera: #ifdef XP_MACOSX // Mac doesn't support capabilities. // // Hardcode generic desktop capabilities modeled on OSX camera. // Note: Values are empirically picked to be OSX friendly, as on OSX, values // other than these cause the source to not produce. if (mHardcodedCapabilities.IsEmpty()) { for (int i = 0; i < 9; i++) { webrtc::CaptureCapability c; c.width = 1920 - i*128; c.height = 1080 - i*72; c.maxFPS = 30; mHardcodedCapabilities.AppendElement(c); } for (int i = 0; i < 16; i++) { webrtc::CaptureCapability c; c.width = 640 - i*40; c.height = 480 - i*30; c.maxFPS = 30; mHardcodedCapabilities.AppendElement(c); } } break; #endif default: webrtc::CaptureCapability c; // The default for devices that don't return discrete capabilities: treat // them as supporting all capabilities orthogonally. E.g. screensharing. c.width = 0; // 0 = accept any value c.height = 0; c.maxFPS = 0; mHardcodedCapabilities.AppendElement(c); break; } return mHardcodedCapabilities.Length(); }
int GDALJP2Box::DumpReadable( FILE *fpOut ) { if( fpOut == NULL ) fpOut = stdout; fprintf( fpOut, " Type=%s, Offset=%d/%d, Data Size=%d", szBoxType, (int) nBoxOffset, (int) nDataOffset, (int)(nBoxLength - (nDataOffset - nBoxOffset)) ); if( IsSuperBox() ) { fprintf( fpOut, " (super)" ); } fprintf( fpOut, "\n" ); if( IsSuperBox() ) { GDALJP2Box oSubBox( GetFILE() ); for( oSubBox.ReadFirstChild( this ); strlen(oSubBox.GetType()) > 0; oSubBox.ReadNextChild( this ) ) { oSubBox.DumpReadable( fpOut ); } printf( " (end of %s subboxes)\n", szBoxType ); } if( EQUAL(GetType(),"uuid") ) { char *pszHex = CPLBinaryToHex( 16, GetUUID() ); fprintf( fpOut, " UUID=%s", pszHex ); if( EQUAL(pszHex,"B14BF8BD083D4B43A5AE8CD7D5A6CE03") ) fprintf( fpOut, " (GeoTIFF)" ); if( EQUAL(pszHex,"96A9F1F1DC98402DA7AED68E34451809") ) fprintf( fpOut, " (MSI Worldfile)" ); CPLFree( pszHex ); fprintf( fpOut, "\n" ); } return 0; }
nsresult MediaEngineRemoteVideoSource::UpdateSingleSource( const AllocationHandle* aHandle, const NormalizedConstraints& aNetConstraints, const MediaEnginePrefs& aPrefs, const nsString& aDeviceId, const char** aOutBadConstraint) { if (!ChooseCapability(aNetConstraints, aPrefs, aDeviceId)) { *aOutBadConstraint = FindBadConstraint(aNetConstraints, *this, aDeviceId); return NS_ERROR_FAILURE; } switch (mState) { case kReleased: MOZ_ASSERT(aHandle); if (camera::GetChildAndCall(&camera::CamerasChild::AllocateCaptureDevice, mCapEngine, GetUUID().get(), kMaxUniqueIdLength, mCaptureIndex, aHandle->mPrincipalInfo)) { return NS_ERROR_FAILURE; } mState = kAllocated; SetLastCapability(mCapability); LOG(("Video device %d allocated", mCaptureIndex)); break; case kStarted: if (mCapability != mLastCapability) { camera::GetChildAndCall(&camera::CamerasChild::StopCapture, mCapEngine, mCaptureIndex); if (camera::GetChildAndCall(&camera::CamerasChild::StartCapture, mCapEngine, mCaptureIndex, mCapability, this)) { LOG(("StartCapture failed")); return NS_ERROR_FAILURE; } SetLastCapability(mCapability); } break; default: LOG(("Video device %d in ignored state %d", mCaptureIndex, mState)); break; } return NS_OK; }
size_t MediaEngineRemoteVideoSource::NumCapabilities() const { mHardcodedCapabilities.Clear(); int num = mozilla::camera::GetChildAndCall( &mozilla::camera::CamerasChild::NumberOfCapabilities, mCapEngine, GetUUID().get()); if (num < 1) { // The default for devices that don't return discrete capabilities: treat // them as supporting all capabilities orthogonally. E.g. screensharing. // CaptureCapability defaults key values to 0, which means accept any value. mHardcodedCapabilities.AppendElement(webrtc::CaptureCapability()); num = mHardcodedCapabilities.Length(); // 1 } return num; }
void MediaEngineWebRTCVideoSource::Refresh(int aIndex) { // NOTE: mCaptureIndex might have changed when allocated! // Use aIndex to update information, but don't change mCaptureIndex!! // Caller looked up this source by uniqueId, so it shouldn't change char deviceName[kMaxDeviceNameLength]; char uniqueId[kMaxUniqueIdLength]; if (mViECapture->GetCaptureDevice(aIndex, deviceName, sizeof(deviceName), uniqueId, sizeof(uniqueId))) { return; } SetName(NS_ConvertUTF8toUTF16(deviceName)); #ifdef DEBUG MOZ_ASSERT(GetUUID().Equals(uniqueId)); #endif }
void MediaEngineRemoteVideoSource::Refresh(int aIndex) { // NOTE: mCaptureIndex might have changed when allocated! // Use aIndex to update information, but don't change mCaptureIndex!! // Caller looked up this source by uniqueId, so it shouldn't change char deviceName[kMaxDeviceNameLength]; char uniqueId[kMaxUniqueIdLength]; if (mozilla::camera::GetChildAndCall( &mozilla::camera::CamerasChild::GetCaptureDevice, mCapEngine, aIndex, deviceName, sizeof(deviceName), uniqueId, sizeof(uniqueId), nullptr)) { return; } SetName(NS_ConvertUTF8toUTF16(deviceName)); #ifdef DEBUG MOZ_ASSERT(GetUUID().Equals(uniqueId)); #endif }
UNITY_EXPORT void Unity_AppResume() { MojingSDK_AppResume(GetUUID().ToCStr()); }
ODPoint::ODPoint( double lat, double lon, const wxString& icon_ident, const wxString& name, const wxString &pGUID, bool bAddToList ) { // Establish points m_lat = lat; m_lon = lon; // Normalize the longitude, to fix any old poorly formed points if( m_lon < -180. ) m_lon += 360.; else if( m_lon > 180. ) m_lon -= 360.; // Nice defaults m_seg_len = 0.0; m_seg_vmg = 0.0; m_seg_etd = wxInvalidDateTime; m_bDynamicName = false; m_bPtIsSelected = false; m_bIsBeingEdited = false; m_bIsActive = false; m_bPointPropertiesBlink = false; m_bPathManagerBlink = false; m_bIsInRoute = false; m_bIsInPath = false; m_bIsInBoundary = false; m_bIsInTrack = false; m_CreateTimeX = wxDateTime::Now(); m_GPXTrkSegNo = 1; m_bIsolatedMark = false; m_bShowName = g_bBoundaryPointShowName; m_bKeepXPath = false; m_bIsVisible = true; m_bIsListed = true; CurrentRect_in_DC = wxRect( 0, 0, 0, 0 ); m_NameLocationOffsetX = -10; m_NameLocationOffsetY = 8; m_pMarkFont = NULL; m_btemp = false; m_sTypeString = wxEmptyString; m_SelectNode = NULL; m_ManagerNode = NULL; m_fIconScaleFactor = 1.0; m_HyperlinkList = new HyperlinkList; if( !pGUID.IsEmpty() ) m_GUID = pGUID; else m_GUID = GetUUID(); // Get Icon bitmap m_IconName = icon_ident; ReLoadIcon(); SetName( name ); // Possibly add the ODPoint to the global list maintained by the ODPoint manager if( bAddToList && NULL != g_pODPointMan ) g_pODPointMan->AddODPoint( this ); m_bIsInLayer = g_bODIsNewLayer; if( m_bIsInLayer ) { m_LayerID = g_ODLayerIdx; m_bIsListed = false; } else m_LayerID = 0; SetODPointArrivalRadius( g_n_arrival_circle_radius ); m_bShowODPointRangeRings = g_bODPointShowRangeRings; m_iODPointRangeRingsNumber = g_iODPointRangeRingsNumber; m_fODPointRangeRingsStep = g_fODPointRangeRingsStep; m_iODPointRangeRingsStepUnits = g_iODPointRangeRingsStepUnits; m_wxcODPointRangeRingsColour = g_colourODPointRangeRingsColour; m_iRangeRingStyle = wxPENSTYLE_SOLID; m_iRangeRingWidth = 2; SetRangeRingBBox(); CreateColourSchemes(); SetColourScheme(g_global_color_scheme); }
PyObject* GetData(Cursor* cur, Py_ssize_t iCol) { // Returns an object representing the value in the row/field. If 0 is returned, an exception has already been set. // // The data is assumed to be the default C type for the column's SQL type. ColumnInfo* pinfo = &cur->colinfos[iCol]; // First see if there is a user-defined conversion. int conv_index = GetUserConvIndex(cur, pinfo->sql_type); if (conv_index != -1) return GetDataUser(cur, iCol, conv_index); switch (pinfo->sql_type) { case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR: return GetText(cur, iCol); case SQL_CHAR: case SQL_VARCHAR: case SQL_LONGVARCHAR: case SQL_SS_XML: case SQL_DB2_XML: return GetText(cur, iCol); case SQL_GUID: if (UseNativeUUID()) return GetUUID(cur, iCol); return GetText(cur, iCol); break; case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: return GetBinary(cur, iCol); case SQL_DECIMAL: case SQL_NUMERIC: return GetDataDecimal(cur, iCol); case SQL_BIT: return GetDataBit(cur, iCol); case SQL_TINYINT: case SQL_SMALLINT: case SQL_INTEGER: return GetDataLong(cur, iCol); case SQL_BIGINT: return GetDataLongLong(cur, iCol); case SQL_REAL: case SQL_FLOAT: case SQL_DOUBLE: return GetDataDouble(cur, iCol); case SQL_TYPE_DATE: case SQL_TYPE_TIME: case SQL_TYPE_TIMESTAMP: return GetDataTimestamp(cur, iCol); case SQL_SS_TIME2: return GetSqlServerTime(cur, iCol); } return RaiseErrorV("HY106", ProgrammingError, "ODBC SQL type %d is not yet supported. column-index=%zd type=%d", (int)pinfo->sql_type, iCol, (int)pinfo->sql_type); }
const A_UUID& CConstObject::GetUUID(const char* name, _U32 index) const { return GetUUID(Zion::StringFormat("%s[%d]", name, index).c_str()); }
/// Returns true if this node considers itself a coordinator bool IsCoordinator() const { return (Coordinator() == GetUUID()); };
ODPoint::ODPoint() { m_pbmIcon = NULL; // Nice defaults m_seg_len = 0.0; m_seg_vmg = 0.0; m_seg_etd = wxInvalidDateTime; m_bDynamicName = false; m_bPtIsSelected = false; m_bIsBeingEdited = false; m_bIsActive = false; m_bPointPropertiesBlink = false; m_bPathManagerBlink = false; m_bIsInRoute = false; m_bIsInPath = false; m_bIsInBoundary = false; m_bIsInTrack = false; m_CreateTimeX = wxDateTime::Now(); m_GPXTrkSegNo = 1; m_bIsolatedMark = false; m_bShowName = true; m_bKeepXPath = false; m_bIsVisible = true; m_bIsListed = true; CurrentRect_in_DC = wxRect( 0, 0, 0, 0 ); m_NameLocationOffsetX = -10; m_NameLocationOffsetY = 8; m_pMarkFont = NULL; m_btemp = false; m_SelectNode = NULL; m_ManagerNode = NULL; m_fIconScaleFactor = 1.0; m_sTypeString = wxEmptyString; m_HyperlinkList = new HyperlinkList; m_GUID = GetUUID(); m_IconName = wxEmptyString; ReLoadIcon(); m_ODPointName = wxEmptyString; m_bIsInLayer = false; m_LayerID = 0; m_ODPointArrivalRadius = g_n_arrival_circle_radius; m_bShowODPointRangeRings = g_bODPointShowRangeRings; m_iODPointRangeRingsNumber = g_iODPointRangeRingsNumber; m_fODPointRangeRingsStep = g_fODPointRangeRingsStep; m_iODPointRangeRingsStepUnits = g_iODPointRangeRingsStepUnits; m_wxcODPointRangeRingsColour = g_colourODPointRangeRingsColour; m_iRangeRingStyle = wxPENSTYLE_SOLID; m_iRangeRingWidth = 2; SetRangeRingBBox(); CreateColourSchemes(); SetColourScheme(g_global_color_scheme); }
//try to launch RDM int startRDM() { DEBUGMSG(1, (L"Entering startRDM()\n")); int cnt=0; //repeat counter BOOL isOK = FALSE; int iRet=0; do { cnt++; //if tsc is already running, kill it //first ensure TSSHELLWND is not minimized or connect will hang (why?) #if _WIN32_WCE == 0x420 HWND hwndTSC = FindWindow(L"UIMainClass", NULL);//FindWindow(NULL, L"Terminal Services Client"); if(hwndTSC==NULL) hwndTSC = FindWindow(NULL, L"Terminal Services Client"); //at start we see the 'connect' dialog //in a connected session the class and title changes! #else HWND hwndTSC = FindWindow(L"TSSHELLWND",NULL); #endif DEBUGMSG(1, (L"TSC is running as window: 0x%08x\n",hwndTSC)); if(hwndTSC!=NULL) ShowWindow(hwndTSC, SW_SHOWNORMAL); #if _WIN32_WCE == 0x420 if(IsProcessRunning(L"mstsc40.exe")) { //on pocketpc we have mstsc40.exe if( KillExeWindow(L"mstsc40.exe") ) { #else if(IsProcessRunning(L"wpctsc.exe")) { if( KillExeWindow(L"wpctsc.exe") ) { #endif //killedit OK Sleep(1000); } else { //was unable to kill iRet = -1; //unable to kill wpctsc continue; } } //write defaults to REG and default.rdp writeRDP(); writeMRU(); //ensure at least one entry is in MRU DWORD dProcIDTSC=0; //to save proc ID of TSC main window //start a new instance of tsc PROCESS_INFORMATION pi; #if _WIN32_WCE == 0x420 if (CreateProcess(L"\\windows\\mstsc40.exe", L"", NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)!=0) #else if (CreateProcess(L"\\windows\\wpctsc.exe", L"", NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)!=0) #endif { //OK Sleep(1000); //give some time to setup CloseHandle(pi.hThread); CloseHandle(pi.hProcess); } else { //start failed iRet = -2; //unable to start wpctsc continue; } //find the "Remote Desktop Mobile" dialog window #if _WIN32_WCE == 0x420 DWORD pidTSC = FindPID(L"mstsc40.exe"); #else DWORD pidTSC = FindPID(L"wpctsc.exe"); #endif HWND hTscDialog = getTscDialog(pidTSC); //FindWindow(L"Dialog", NULL); if(hTscDialog!=NULL) { //check if this is the right window #if _WIN32_WCE == 0x420 if(FindPID(L"mstsc40.exe") != 0) { if(FindPID(hTscDialog)!= FindPID(L"mstsc40.exe")) { #else if(FindPID(L"wpctsc.exe") != 0) { if(FindPID(hTscDialog)!= FindPID(L"wpctsc.exe")) { #endif iRet = -4; //error finding TSC dialog continue; } else { #ifdef DEBUG DEBUGMSG(1, (L" ### ScanTSCwindow ### \r\n")); scanTscWindow(hTscDialog); //scan TSC window and list child windows and CtrlIDs DEBUGMSG(1, (L" --- ScanTSCwindow --- \r\n")); #endif isOK=TRUE; iRet=0; } } } else { iRet = -3; //could not find tsc dialog continue; } } while (!isOK && cnt<3); DEBUGMSG(1, (L"Leaving startRDM() with code: %i\n", iRet)); return iRet; } /* TSC dialog elements: class text ctrlID "Dialog" "" 0x0 "static" "Status:" 0x40e "static" "Not connected" 0x410 //status "combobox" "192.168.0.2" 0x403 //Computer COMBO BOX! "Edit" "192.168.0.2" 0x3e9 //Computer "sbedit" "rdesktop" 0x3ef //Username "sbedit" "Intermec+2004" 0x3f0 //Password "sbedit" "" 0x3f1 //Domain "Button" "Save password" 0x3f2 //scave pw option "static" "Computer:" 0x3f7 "static" "User name:" 0x3f8 "static" "Password:"******"static" "Domain:" 0x3fa "SIPPREF" "SIP1" 0x41c */ /* For PPC2003 ### ScanTSCwindow ### "Dialog" "Terminal Services Client" 0x0 "static" "Server:" 0xffff "Edit" "192.168.128.5" 0x28e "static" "Recent servers:" 0xffff "listbox" "" 0x294 "Button" "Connect" 0x290 "Button" "Limit size of server desktop to fit on this screen" 0x421 */ //######################### Main Function ############################## int startTSC() { TCHAR* szHWID = new TCHAR[MAX_PATH]; GetUUID(szHWID); LRESULT lRes=0; #ifdef DEBUG1 writeReg(); //write default settings to reg #endif readReg(); //get the screen size getScreenSize(); int iRet = startRDM(); if (iRet != 0) return iRet; HWND hTscDialog = FindWindow(L"Dialog", NULL); //fill in the values //find window handle to each control and send new values //use know CtrlIDs to send DlgItem-messages TCHAR strText[MAX_PATH]; //EnableWindow(hTscDialog, FALSE); //int idDlgItem = GetDlgCtrlID(hDialogItem); // use this or SendMessage with handle of control //WM_SETTEXT wParam = 0; lParam = (LPARAM)(LPCTSTR) lpsz; wsprintf(strText, L"start filling fields"); SendDlgItemMessage(hTscDialog, 0x3f1, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) strText); Sleep(500); UpdateWindow(hTscDialog); #if _WIN32_WCE == 0x420 //fill in the server setDlgText(hTscDialog, myDlgItems[0].szValue, myDlgItems[0].dwCtrlID); //use fit to screen? if(g_bUseFitToScreen) { if(wcscmp(myDlgItems[1].szValue, L"1")==0) { lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[1].dwCtrlID), BM_SETCHECK, BST_CHECKED, 0); DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[1].szLabel, lRes)); } } else { //uncheck "Limit size of server desktop to fit on this screen lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[1].dwCtrlID), BM_SETCHECK, BST_UNCHECKED, 0); DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[1].szLabel, lRes)); } #else for (int i=0; i < COUNT_DLG_ITEMS; i++) { if(i!=4) { //special handling or the checkbox setDlgText(hTscDialog, myDlgItems[i].szValue, myDlgItems[i].dwCtrlID); //lRes = SendDlgItemMessage(hTscDialog, myDlgItems[i].dwCtrlID, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) myDlgItems[i].szValue); //DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes)); } else { //change the Save Password checkbox if(wcscmp(myDlgItems[i].szValue, L"1")==0) { lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), BM_SETCHECK, BST_CHECKED, 0); DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes)); } else { lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), BM_SETCHECK, BST_UNCHECKED, 0); DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes)); } } UpdateWindow(hTscDialog); EnableWindow(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), FALSE); Sleep(500); } #endif //SetForegroundWindow(hTscDialog); Sleep(300); //working solution one to start the Connect //hacked by ceSpy: send RDM WM_USER+1001 with wParam=0 and lParam=0, works if one manually connect was OK //SendMessage(FindWindow(L"TSSHELLWND", NULL), WM_USER+1001, 0, 0); //test with WM_KEY...DOES not work //SendMessage(GetDesktopWindow(), WM_KEYDOWN, VK_F1, 0); //Sleep(10); //SendMessage(GetDesktopWindow(), WM_KEYUP, VK_F1, 0); #if _WIN32_WCE == 0x420 //we can use the connect button to connect HWND hwndButton = GetDlgItem(hTscDialog, myDlgItems[2].dwCtrlID); SendMessage(hwndButton, BM_CLICK, 0, 0); #else if(bUseMouseClick) { //Solution two with mouse_event, click at 13,306. The 13 comes from the assumption that hight of //menu bar is 26 pixel and I want to click in the mid //this solution does work as keyb_event does work // normalized coordinates: // (0,0) = upper left corner // (0xFFFF,0xFFFF) = lower right corner DWORD dX = (0xFFFF / iScreenWidth) * (80); // changed from 13 to width=240, 1/3=80 DWORD dY = (0xFFFF / iScreenHeight) * (iScreenHeight - 13); DEBUGMSG(1, (L"mouse click at: %u, %u\n", dX * 0xFFFFFFFF / 240, dY * 0xFFFFFFFF / 320)); //SetForegroundWindow(hTscDialog); //dont mess with windows z-order //this will make a cursor visible mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, dX, dY, 0, 0); Sleep(5); mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, dX, dY, 0, 0); Sleep(30); /* //this is what happens, if you tap the screen mouse_event(MOUSEEVENTF_TOUCH | MOUSEEVENTF_LEFTDOWN, dX, dY, 0, 0); mouse_event(MOUSEEVENTF_TOUCH | MOUSEEVENTF_LEFTUP, dX, dY, 0, 0); //Sleep(3000); */ } else { //Solution three, best solution, ensure you use the scancode value too! AFAIK the scancode for F1 is always 0x70 keybd_event(VK_F1, 0x70, 0, 0); Sleep(30); keybd_event(VK_F1, 0x70, KEYEVENTF_KEYUP, 0); }//bUseMouseClick #endif /* //test with WM_LBUTTONDOWN, did not work HWND hClickWnd = FindWindow(L"TSSHELLWND", NULL); lRes = PostMessage(hClickWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(60,307)); DEBUGMSG(1, (L"SendMessage(WM_LBUTTONDOWN, MK_LBUTTON) Result=0x%0x, GetLastError=0x%0x\n", lRes, GetLastError())); Sleep(30); lRes = PostMessage(hClickWnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(60,307)); DEBUGMSG(1, (L"SendMessage(WM_LBUTTONUP, MK_LBUTTON) Result=0x%0x, GetLastError=0x%0x\n", lRes, GetLastError())); */ //SendMessage(FindWindow(L"TSSHELLWND", NULL), WM_SETTEXT, 0, (LPARAM)(LPCTSTR) L"PLEASE WAIT"); //SetForegroundWindow(FindWindow(L"TSSHELLWND", NULL)); //ShowWindow(FindWindow(L"TSSHELLWND", NULL), SW_SHOWNORMAL); //need this? //UpdateWindow(hTscDialog); //now wait for the Dialog to disapear and start rdm_keep_busy so the session will not timeout if(wcslen(sAppOnExit)>0) { TCHAR* strExeFile; int ch = '\\'; strExeFile = wcsrchr(sAppOnExit, ch); if(strExeFile!=NULL) strExeFile++; //add one position as the found backslash is part of the pointer else strExeFile = sAppOnExit; //if not found, just let it point to the original string if(!IsProcessRunning(strExeFile)) { SHELLEXECUTEINFO sei = {0}; sei.cbSize = sizeof(sei); sei.nShow = SW_SHOWNORMAL; sei.lpFile = sAppOnExit; sei.lpParameters = sExeArgs;// L"noRdpStart"; if (!ShellExecuteEx(&sei)) { DEBUGMSG(1, (L"Starting '%s' FAILED\n", sAppOnExit)); } else { DEBUGMSG(1, (L"Starting '%s' OK\n", sAppOnExit)); } } } return 0; }