AppX11::AppX11(QObject *parent) : QObject(parent), d(new Data) { d->xssTimer.setInterval(20000); connect(&d->xssTimer, &QTimer::timeout, this, [this] () { if (d->xss && d->display) { _Trace("Call XResetScreenSaver()."); XResetScreenSaver(d->display); } else _Error("Cannot run XResetScreenSaver()."); }); connect(&d->hbTimer, &QTimer::timeout, this, [this] () { if (!d->hbCommand.isEmpty()) { if (QProcess::startDetached(d->hbCommand)) _Trace("Run command: %%", d->hbCommand); else _Error("Cannot run command: %%", d->hbCommand); } else _Error("No command for heartbeat"); }); d->connection = QX11Info::connection(); d->display = QX11Info::display(); d->root = QX11Info::appRootWindow(); d->aNetWmState = d->getAtom("_NET_WM_STATE"); d->aNetWmStateAbove = d->getAtom("_NET_WM_STATE_ABOVE"); d->aNetWmStateStaysOnTop = d->getAtom("_NET_WM_STATE_STAYS_ON_TOP"); }
/* * Trace message request. * Returns errno to caller. */ static void traceRequest( struct UdsMsgHeader *hdr, struct AsrGeneralRsp *rsp, const char *fmt, /* printf() style format. */ ...) { char msg[256]; ThreadsReconfigSync(RC_allow); if (fmt != NULL) { va_list args; va_start(args, fmt); vsnprintf(msg, sizeof (msg), fmt, args); va_end(args); } else { *msg = '\0'; } if (rsp != NULL && rsp->GrStatus == -1) { rsp->GrErrno = errno; _Trace(TR_err, NULL, 0, "From %s[%d] %s:%d %s", hdr->UhName, (int)hdr->UhPid, hdr->UhSrcFile, hdr->UhSrcLine, msg); } else { _Trace(TR_ardebug, NULL, 0, "From %s[%d] %s:%d %s", hdr->UhName, (int)hdr->UhPid, hdr->UhSrcFile, hdr->UhSrcLine, msg); } }
void _TraceGUID(GUID guid, LPCTSTR msg) { TCHAR buf[40]; GUID2String(guid, buf); _Trace(FALSE, msg); _Trace(buf); }
/* * Send a customer message. */ void SendCustMsg( const char *srcFile, /* Caller's source file. */ const int srcLine, /* Caller's source line. */ int msgNum, /* Message catalog number. */ ...) { va_list args; char *fmt; char msg_buf[MAXLINE]; char *msg; int saveErrno; saveErrno = errno; fmt = getMsg(msgNum); va_start(args, msgNum); vsnprintf(msg_buf, sizeof (msg_buf), fmt, args); va_end(args); msg = sendMsg(msgNum, msg_buf); if (TraceFlags != NULL) { _Trace(TR_cust, srcFile, srcLine, "Message %d: %s", msgNum, msg); } errno = saveErrno; }
BZStagePlayLayerGamePlay::~BZStagePlayLayerGamePlay(void) { if (null != _pgame) _pgame->release(); _pgame = null; _Trace("%s destroyed", __FUNCTION__); }
int OpenFile( char *szFilename, int nDesiredAccess, ULONG ulShareAccess, ULONG ulCreateDisposition ) { // Example call: int fhandle = OpenFile(uncFilename, FILE_GENERIC_READ|SYNCHRONIZE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN); NTSTATUS ntStatus; HANDLE FileHandle=(HANDLE)-1; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatus; UNICODE_STRING uniFilename; ANSI_STRING ansiFilename; // The string coming through here is the fully qualified driver path in ASCII. // For now we'll display that driver path in all output text. // Convert it back to unicode. // RtlInitAnsiString( &ansiFilename, szFilename ); RtlAnsiStringToUnicodeString( &uniFilename, &ansiFilename, TRUE); InitializeObjectAttributes( &ObjectAttributes, &uniFilename, OBJ_CASE_INSENSITIVE, NULL, NULL ); // _DebugTrace(TraceInfo,"ZwCreateFile acc=%08X shar=%08X disp=%08X : %s\n", nDesiredAccess, ulShareAccess, ulCreateDisposition, szFilename); ++InMyOpenClose; ntStatus = ZwCreateFile( &FileHandle, nDesiredAccess|SYNCHRONIZE, &ObjectAttributes, &IoStatus, NULL, FILE_ATTRIBUTE_NORMAL, ulShareAccess, ulCreateDisposition, FILE_SYNCHRONOUS_IO_NONALERT|FILE_COMPLETE_IF_OPLOCKED, NULL, 0 ); --InMyOpenClose; RtlFreeUnicodeString( &uniFilename ); #ifdef GDATA if ( NT_SUCCESS(ntStatus) ) #endif //GDATA if ( ntStatus == STATUS_SUCCESS ) { return ( ( int )FileHandle ); } else if (FileHandle != (HANDLE)-1) // (ntStatus == STATUS_OPLOCK_BREAK_IN_PROGRESS|| ntStatus == STATUS_DELETE_PENDING ) { ++InMyOpenClose; ZwClose( FileHandle ); --InMyOpenClose; } _Trace(TraceInfo,"ZwCreateFile FFAILED: NtStatus=%08X :%s\n", ntStatus, szFilename); return -1; }
void _Trace(LPCTSTR lpszFormat, ...) { va_list args; va_start(args, lpszFormat); _Trace(TRUE, lpszFormat, args); va_end(args); }
void _Trace(BOOL endl, LPCTSTR lpszFormat, ...) { va_list args; va_start(args, lpszFormat); _Trace(endl, lpszFormat, args); va_end(args); }
/* * Error related to a system call. * Write a message with the errno value to the logfile. */ void SysError( const char *srcFile, /* Caller's source file. */ const int srcLine, /* Caller's source line. */ const char *fmt, /* printf() style format. */ ...) { char msg_buf[MAXLINE]; char *msg; char *p, *pe; int saveErrno; saveErrno = errno; /* * Format message and add error number. */ p = msg_buf; pe = p + sizeof (msg_buf) - 1; /* Catalog message. */ snprintf(p, Ptrdiff(pe, p), "%s", getMsg(14082)); p += strlen(p); snprintf(p, Ptrdiff(pe, p), ": "); p += strlen(p); /* The message */ if (fmt != NULL) { va_list args; va_start(args, fmt); vsnprintf(p, Ptrdiff(pe, p), fmt, args); va_end(args); p += strlen(p); } /* Error number */ if (saveErrno != 0) { snprintf(p, Ptrdiff(pe, p), ": "); p += strlen(p); (void) StrFromErrno(saveErrno, p, Ptrdiff(pe, p)); p += strlen(p); } *p = '\0'; msg = sendMsg(14082, msg_buf); errno = 0; /* Already included error number. */ _Trace(TR_err, srcFile, srcLine, "%s", msg); errno = saveErrno; }
/* * Fatal error related to a system call. * Write a message with the errno value to the logfile and terminate. */ void _LibFatal( const char *srcFile, /* Caller's source file. */ const int srcLine, /* Caller's source line. */ const char *functionName, /* Name of failing function. */ const char *functionArg) /* Argument to function */ { char msg_buf[MAXLINE]; char *msg; char *p, *pe; int saveErrno; saveErrno = errno; /* * Format message and add error number. */ p = msg_buf; pe = p + sizeof (msg_buf) - 1; snprintf(p, Ptrdiff(pe, p), "%s", getMsg(14080)); p += strlen(p); if (functionArg == NULL) { functionArg = "NULL"; } snprintf(p, Ptrdiff(pe, p), ": %s(%s) called from: %s:%d", functionName, functionArg, srcFile, srcLine); p += strlen(p); if (saveErrno != 0) { snprintf(p, Ptrdiff(pe, p), ": "); p += strlen(p); (void) StrFromErrno(saveErrno, p, Ptrdiff(pe, p)); p += strlen(p); } *p = '\0'; msg = sendMsg(14080, msg_buf); errno = 0; /* Already included error number */ _Trace(TR_err, srcFile, srcLine, "%s", msg); #if !defined(TEST) if (ErrorExitStatus == EXIT_FATAL) { exit(EXIT_FATAL); } _exit(ErrorExitStatus); #else /* !defined(TEST) */ printf("*** _LibFatal() would exit(%d)\n", (ErrorExitStatus != 0) ? ErrorExitStatus : EXIT_FATAL); #endif /* !defined(TEST) */ }
BZStagePlayLayerGamePlay::BZStagePlayLayerGamePlay(CAStage* pstage, CAStageLayer* playerParent) : CAStageLayer(pstage, playerParent) { GUARD_FUNCTION(); _Trace("%s allocated", __FUNCTION__); _nScore = -1; _nLevel = 0; _pgame = null; _pgame = null; _score = null; _level = null; _NullGetters(); }
AppX11::AppX11(QObject *parent) : QObject(parent), d(new Data) { d->ss_timer.setInterval(20000); connect(&d->ss_timer, &QTimer::timeout, [this] () { if (d->xss && d->display) { _Trace("Call XResetScreenSaver()."); XResetScreenSaver(d->display); } else _Error("Cannot run XResetScreenSaver()."); }); d->connection = QX11Info::connection(); d->display = QX11Info::display(); d->root = QX11Info::appRootWindow(); d->aNetWmState = d->getAtom("_NET_WM_STATE"); d->aNetWmStateAbove = d->getAtom("_NET_WM_STATE_ABOVE"); d->aNetWmStateStaysOnTop = d->getAtom("_NET_WM_STATE_STAYS_ON_TOP"); }
BOOL IO13(BYTE Disk, WORD Sector ,BYTE Head ,WORD NumSectors, LPBYTE Buffer, int wr) { BOOL ret=FALSE; LPBYTE buf=NULL; char deviceName[0x20]; MakeDeviceName(Disk,deviceName,0x20); DISK_GEOMETRY Geometry; GetDiskGeometry(deviceName,&Geometry); DWORD SecNo=Sector & 0x003F; DWORD CylNo=Sector<<2; CylNo&=0x0300; CylNo|=Sector>>8; LARGE_INTEGER pos; pos.HighPart= 0; pos.LowPart = (CylNo*Geometry.TracksPerCylinder + Head)*Geometry.SectorsPerTrack + SecNo -1; int i=0; int s=Geometry.BytesPerSector; while(1){ s>>=1; if(s) i++; else break; } pos=RtlLargeIntegerShiftLeft(pos,i); _Trace(TraceInfo,"IO13: %28.28s %02X c:%03X s:%02X h:%02X\n", deviceName, Disk, CylNo, SecNo, Head); if(Geometry.BytesPerSector > 0x200) { buf=new BYTE[NumSectors*Geometry.BytesPerSector]; if(!buf)return ret; if(wr)memcpy(buf,Buffer,NumSectors*0x200); } ret=NT_SUCCESS(NTSectorIO(deviceName,&pos,NumSectors*Geometry.BytesPerSector,buf?buf:Buffer,wr)); if(buf) { if(!wr)memcpy(Buffer,buf,NumSectors*0x200); delete buf; } return ret; }
/* * Out of memory error. * Write a message and terminate. */ void Nomem( const char *functionName, char *objectName, size_t size) { char msg_buf[MAXLINE]; char *msg; snprintf(msg_buf, sizeof (msg_buf), "%s: %s(%s, %u)", GetCustMsg(14081), functionName, objectName, size); msg = sendMsg(14081, msg_buf); _Trace(TR_err, NULL, 0, "%s", msg); #if !defined(TEST) exit(EXIT_NOMEM); #else /* !defined(TEST) */ printf("*** Nomem() would exit(%d)\n", EXIT_NOMEM); #endif /* !defined(TEST) */ }
BOOL IO2X(BYTE Drive, WORD Sector ,WORD NumSectors, LPBYTE Buffer, int wr) { BOOL ret=FALSE; LPBYTE buf=NULL; char deviceName[0x20]; MakeDeviceName(Drive,deviceName,0x20); DISK_GEOMETRY Geometry; GetDiskGeometry(deviceName,&Geometry); LARGE_INTEGER pos; pos.HighPart= 0; pos.LowPart = Sector; int i=0; int s=Geometry.BytesPerSector; while(1){ s>>=1; if(s) i++; else break; } pos=RtlLargeIntegerShiftLeft(pos,i); _Trace(TraceInfo,"IO2X: %28.28s %02X s:%d\n", deviceName, Drive, Sector); if(Geometry.BytesPerSector > 0x200) { buf=new BYTE[NumSectors*Geometry.BytesPerSector]; if(!buf)return ret; if(wr)memcpy(buf,Buffer,NumSectors*0x200); } ret=NT_SUCCESS(NTSectorIO(deviceName,&pos,NumSectors*Geometry.BytesPerSector,buf?buf:Buffer,wr)); if(buf) { if(!wr)memcpy(Buffer,buf,NumSectors*0x200); delete buf; } return ret; }
void CMiscDlg::EnableControls(BOOL bEnable) { ((CButton*)GetDlgItem (IDC_chCountry))->EnableWindow (bEnable); ((CComboBox*)GetDlgItem (IDC_cbCountry))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnCountryCode))->EnableWindow (bEnable); ((CSpinButtonCtrl*)GetDlgItem(IDC_spinMaxStations))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnMaxStation))->EnableWindow (bEnable); ((CEdit*)GetDlgItem (IDC_txtMaxStations))->EnableWindow (bEnable); ((CComboBox*)GetDlgItem (IDC_cbMACFilter))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnAddMAC))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnDelMAC))->EnableWindow (bEnable); ((CComboBox*)GetDlgItem (IDC_cbStattions))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnRefresh))->EnableWindow (bEnable); ((CComboBox*)GetDlgItem (IDC_cbACLPolicy))->EnableWindow (bEnable); ((CButton*)GetDlgItem (IDC_bnAclPolicy))->EnableWindow (bEnable); _ClearStatus; if(TRUE == bEnable) { if ( ! _tcscmp (m_pConfig->m_szCountryCode, _szDisabledCountrycode)) ((CButton*)GetDlgItem (IDC_chCountry))->SetCheck (0); else ((CButton*)GetDlgItem (IDC_chCountry))->SetCheck (1); OnBnClicked_chCountry (); m_pConfig->GetStationLimit(); printf ( _Trace ("Station limit= %u, Max limit= %u"), m_pConfig->m_nStationLimit, m_pConfig->m_nMaxStationLimit); ((CSpinButtonCtrl*)GetDlgItem(IDC_spinMaxStations))->SetRange(m_pConfig->m_nMaxStationLimit, _MIN_STATIONS); ((CSpinButtonCtrl*)GetDlgItem(IDC_spinMaxStations))->SetPos(m_pConfig->m_nStationLimit); RefreshMacFilter (TRUE); OnBnClicked_bnRefresh (); } }
BZStagePlayLayerHome::~BZStagePlayLayerHome(void) { _Trace("%s destroyed", __FUNCTION__); }
BZStagePlayLayerHome::BZStagePlayLayerHome(CAStage* pstage, CAStageLayer* playerParent) : BZStageLayerCommon(pstage, playerParent) { _Trace("%s allocated", __FUNCTION__); _bFirstRun = true; }