Increase compiler warning level to W4 with WX

This commit is contained in:
silverf0x
2017-11-07 23:18:16 +01:00
parent 0554224b54
commit a5e4fd2c43
18 changed files with 74 additions and 48 deletions
+4 -4
View File
@@ -19,11 +19,11 @@ include_directories("${PROJECT_BINARY_DIR}")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /EHsc /Zi")
set(CMAKE_C_FLAGS_DEBUG "/W4 /MTd /EHsc /Zi")
set(CMAKE_CXX_FLAGS_DEBUG "/W4 /WX /MDd /EHsc /Zi")
set(CMAKE_C_FLAGS_DEBUG "/W4 /WX /MDd /EHsc /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "/W3 /O2 /Oi /Ot /Gy /MT /EHsc /MP")
set(CMAKE_C_FLAGS_RELEASE "/W4 /O2 /Oi /Ot /Gy /MT /EHsc /MP")
set(CMAKE_CXX_FLAGS_RELEASE "/W4 /WX /O2 /Oi /Ot /Gy /MD /EHsc /MP")
set(CMAKE_C_FLAGS_RELEASE "/W4 /WX /O2 /Oi /Ot /Gy /MD /EHsc /MP")
set(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO /OPT:REF /OPT:ICF")
+4
View File
@@ -43,4 +43,8 @@ add_executable(
RpcViewResource.rc
)
# Disable compiler warnings:
# C4091 in ShlObj.h and Dbghelp.h
# C4127 (conditional expression is constant) in qt headers
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4091 /wd4127")
target_link_libraries(RpcView Qt5::Widgets $ENV{CMAKE_PREFIX_PATH}/lib/Qt5WinExtras.lib)
+1
View File
@@ -89,6 +89,7 @@ void ConfigurationVisitor_C::Visit(InterfaceInfoWidget_C* pInterfaceInfoWidget)
void ConfigurationVisitor_C::Visit(ProcessInfoWidget_C* pProcessInfoWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pProcessInfoWidget);
}
//------------------------------------------------------------------------------
+1
View File
@@ -22,6 +22,7 @@ DecompilationWidget_C::DecompilationWidget_C(QWidget *parent) : QDockWidget(Widg
{
QFont font;
UNREFERENCED_PARAMETER(parent);
setObjectName(WidgetName);
font.setFamily("Courier");
+1
View File
@@ -26,6 +26,7 @@ EndpointSelectedVisitor_C::EndpointSelectedVisitor_C(quint32 Pid,RpcCore_T* pRpc
void EndpointSelectedVisitor_C::Visit(EndpointsWidget_C* pEndpointsWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pEndpointsWidget);
}
+2
View File
@@ -85,6 +85,8 @@ bool EndpointsWidget_C::IsEndpointsPresent(quint32 Pid, WCHAR* pName,WCHAR* pPro
QList<QStandardItem*> ItemList;
bool bResult = false;
UNREFERENCED_PARAMETER(Pid);
ItemList = pModel->findItems(QString::fromUtf16((const ushort*)pName), Qt::MatchFixedString, Column_Name);
if (ItemList.isEmpty()) goto End;
+4
View File
@@ -18,6 +18,7 @@ typedef struct _EnumCtxt_T{
//------------------------------------------------------------------------------
static BOOL WINAPI EnumProc(DWORD Pid, DWORD Ppid, EnumCtxt_T* pEnumCtxt, BOOL* pbContinue)
{
UNREFERENCED_PARAMETER(pbContinue);
ProcessEntry_C* pProcessEntry = new ProcessEntry_C(Ppid,Pid);
pEnumCtxt->pInitViewsVisitor->ProcessVector.push_back(pProcessEntry);
@@ -126,6 +127,7 @@ void InitViewsVisitor_C::Visit(InterfacesWidget_C* pInterfacesWidget)
void InitViewsVisitor_C::Visit(InterfaceInfoWidget_C* pInterfaceInfoWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pInterfaceInfoWidget);
}
@@ -133,6 +135,7 @@ void InitViewsVisitor_C::Visit(InterfaceInfoWidget_C* pInterfaceInfoWidget)
void InitViewsVisitor_C::Visit(ProcessInfoWidget_C* pProcessInfoWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pProcessInfoWidget);
}
@@ -140,6 +143,7 @@ void InitViewsVisitor_C::Visit(ProcessInfoWidget_C* pProcessInfoWidget)
void InitViewsVisitor_C::Visit(ProceduresWidget_C* pProceduresWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pProceduresWidget);
}
+5 -3
View File
@@ -158,15 +158,15 @@ End:
}
//------------------------------------------------------------------------------
void InterfaceInfoWidget_C::SetAddressRepresentation(AddressRepresentation_T AddressRepresentation)
void InterfaceInfoWidget_C::SetAddressRepresentation(AddressRepresentation_T AddrRepresentation)
{
this->AddressRepresentation = AddressRepresentation;
this->AddressRepresentation = AddrRepresentation;
pCallbackAddress->setText("");
pTypeFormatString->setText("");
pProcFormatString->setText("");
pExpressionEvaluation->setText("");
switch (AddressRepresentation)
switch (AddrRepresentation)
{
case AddressRepresentation_RVA:
if ((IfCallback != 0) && (IfCallback!=INVALID_IF_CALLBACK_ADDRESS)) pCallbackAddress->setText(QString("+0x%1").arg(IfCallback - Base, 8, 16, QLatin1Char('0')));
@@ -198,6 +198,8 @@ void InterfaceInfoWidget_C::AcceptVisitor(ViewVisitor_C* pVisitor)
//------------------------------------------------------------------------------
InterfaceInfoWidget_C::InterfaceInfoWidget_C(QWidget* pParent):QDockWidget(WidgetName)
{
UNREFERENCED_PARAMETER(pParent);
this->Pid = 0;
setObjectName(WidgetName);
+1 -2
View File
@@ -43,6 +43,7 @@ void InterfaceSelectedVisitor_C::Visit(EndpointsWidget_C* pEndpointsWidget)
void InterfaceSelectedVisitor_C::Visit(InterfacesWidget_C* pInterfacesWidget)
{
//nothing todo
UNREFERENCED_PARAMETER(pInterfacesWidget);
}
//------------------------------------------------------------------------------
@@ -119,9 +120,7 @@ void InterfaceSelectedVisitor_C::Visit(ProceduresWidget_C* pProceduresWidget)
WCHAR SymbolName[RPC_MAX_LENGTH];
ULONG ProcIdx;
VOID* ProcFormat = NULL;
LPCWSTR pProcName = NULL;
VOID* hPdb = NULL;
UCHAR* ProcAddress = NULL;
if (pRpcInterfaceInfo==NULL) goto End;
pProceduresWidget->reset(pRpcInterfaceInfo->Pid);
+6 -7
View File
@@ -51,10 +51,10 @@ void InterfacesWidget_C::InterfaceSelected(const QModelIndex& Index)
RPC_IF_ID RpcIfId;
UCHAR* pUuidStringA;
QString& PidString = pProxyModel->data( pProxyModel->index(Index.row(), Column_Pid) ).toString();
pUuidStringA = (UCHAR*)pProxyModel->data( pProxyModel->index(Index.row(), Column_Uuid) ).toString().toLatin1().data();
QString& VersionString = pProxyModel->data( pProxyModel->index(Index.row(), Column_Version) ).toString();
VersionStringList = VersionString.split(".", QString::SkipEmptyParts, Qt::CaseSensitive);
QString PidString = pProxyModel->data( pProxyModel->index(Index.row(), Column_Pid) ).toString();
pUuidStringA = (UCHAR*)pProxyModel->data( pProxyModel->index(Index.row(), Column_Uuid) ).toString().toLatin1().data();
QString VersionString = pProxyModel->data( pProxyModel->index(Index.row(), Column_Version) ).toString();
VersionStringList = VersionString.split(".", QString::SkipEmptyParts, Qt::CaseSensitive);
if (VersionStringList.isEmpty())
{
@@ -248,7 +248,6 @@ bool InterfacesWidget_C::AddInterfaces(RpcInterfaceInfo_T* pRpcInterfaceInfo)
int Index;
QString PidString;
WCHAR* pUuidString = NULL;
WCHAR* pTransfertSyntaxString = NULL;
WCHAR* pTypeW = NULL;
WCHAR* pStubW = NULL;
@@ -396,9 +395,9 @@ void InterfacesWidget_C::UpdateColumnsVisibility()
//------------------------------------------------------------------------------
void InterfacesWidget_C::SetAddressRepresentation(AddressRepresentation_T AddressRepresentation)
void InterfacesWidget_C::SetAddressRepresentation(AddressRepresentation_T AddrRepresentation)
{
switch (AddressRepresentation)
switch (AddrRepresentation)
{
case AddressRepresentation_RVA:
for (int i = 0; i < pModel->rowCount(); i++)
+20 -19
View File
@@ -132,7 +132,7 @@ bool MainWindow_C::eventFilter(QObject* pObject, QEvent* pEvent)
{
if (pEvent->type() == QEvent::ContextMenu)
{
QPoint& position = QCursor::pos();
QPoint position = QCursor::pos();
//
// Show the context menu associatd to columns
//
@@ -207,8 +207,9 @@ VOID __cdecl RpcPrint(void* pContext, const char* pTxt)
VOID __cdecl RpcDebug(const char* pFunction, ULONG Line, const char* pFormatString, ...)
{
va_list Arg;
va_start(Arg, pFormatString);
UNREFERENCED_PARAMETER(pFunction);
UNREFERENCED_PARAMETER(Line);
va_start(Arg, pFormatString);
_vcprintf(pFormatString, Arg);
}
@@ -384,7 +385,8 @@ void MainWindow_C::SendVisitor(ViewVisitor_C& Visitor)
//------------------------------------------------------------------------------
void MainWindow_C::closeEvent(QCloseEvent *event)
{
Exit();
UNREFERENCED_PARAMETER(event);
Exit();
}
@@ -554,15 +556,15 @@ void MainWindow_C::SetupMenu()
//
QMenu* pMenuFile = pMenuBar->addMenu("&File");
QAction* pActionAllProcessesDetails = pMenuFile->addAction("Show &Details for All Processes",this,SLOT(ViewDetailsForAllProcesses()));
QAction* pActionFileExit = pMenuFile->addAction("E&xit",this,SLOT(Exit()));
pMenuFile->addAction("E&xit",this,SLOT(Exit()));
//
// Option
//
QMenu* pMenuOptions = pMenuBar->addMenu("&Options");
QAction* pActionConfigureSymbols = pMenuOptions->addAction("Configure Sym&bols",this,SLOT(ConfigureSymbols()));
pMenuOptions->addAction("Configure Sym&bols",this,SLOT(ConfigureSymbols()));
QMenu* pSubMenupdateSpeed = pMenuOptions->addMenu("&Refresh Speed");
QAction* pActionRefresh = pMenuOptions->addAction("Refresh &Now", this, SLOT(RefreshViews()));
QAction* pActionViewSelectColumns = pMenuOptions->addAction("Select Col&umns", this, SLOT(ShowColumnsDialog()));
pMenuOptions->addAction("Select Col&umns", this, SLOT(ShowColumnsDialog()));
QMenu* pSubMenuAddress = pMenuOptions->addMenu("&Address");
pActionRefresh->setShortcut(Qt::Key_F5);
@@ -616,9 +618,9 @@ void MainWindow_C::SetupMenu()
// Filter
//
QMenu* pMenuFilter = pMenuBar->addMenu("Fil&ter");
QAction* pActionFilterProcesses = pMenuFilter->addAction("&Process", this, SLOT(FilterProcesses()));
QAction* pActionFilterEndpoints = pMenuFilter->addAction("&Endpoints", this, SLOT(FilterEndpoints()));
QAction* pActionFilterInterfaces = pMenuFilter->addAction("&Interfaces", this, SLOT(FilterInterfaces()));
pMenuFilter->addAction("&Process", this, SLOT(FilterProcesses()));
pMenuFilter->addAction("&Endpoints", this, SLOT(FilterEndpoints()));
pMenuFilter->addAction("&Interfaces", this, SLOT(FilterInterfaces()));
//
// Help
//
@@ -628,8 +630,8 @@ void MainWindow_C::SetupMenu()
//--
pMenuHelp->addSeparator();
//--
QAction* pActionAbout = pMenuHelp->addAction("&About", this, SLOT(About()));
pActionAboutQt = pMenuHelp->addAction("About &Qt", qApp, SLOT(aboutQt()));
pMenuHelp->addAction("&About", this, SLOT(About()));
pMenuHelp->addAction("About &Qt", qApp, SLOT(aboutQt()));
if (IsUserAnAdmin()) pActionAllProcessesDetails->setEnabled(false);
@@ -729,12 +731,11 @@ MainWindow_C::MainWindow_C(RpcCore_T* pRpcCore)
setStatusBar(&StatusBar);
HANDLE hIcon = LoadImageA(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MAIN_ICON), IMAGE_ICON, 0, 0, 0);
QFont font("Helvetica", 20, QFont::Bold);
#ifndef _DEBUG
HANDLE hIcon = LoadImageA(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MAIN_ICON), IMAGE_ICON, 0, 0, 0);
QSplashScreen SplashScreen(QtWin::fromHICON((HICON)hIcon),Qt::WindowStaysOnTopHint);
SplashScreen.showMessage(QString("RpcView"), Qt::AlignCenter, QColor(Qt::lightGray));
QFont font("Helvetica", 20, QFont::Bold);
SplashScreen.setFont(font);
SplashScreen.show();
#endif
@@ -780,12 +781,12 @@ MainWindow_C::MainWindow_C(RpcCore_T* pRpcCore)
restoreGeometry( pSettings->value("MainWindow/geometry").toByteArray() );
restoreState( pSettings->value("MainWindow/windowState").toByteArray() );
ConfigurationVisitor_C ConfigurationVisitor(ConfigurationVisitor_C::Load,pSettings);
SendVisitor(ConfigurationVisitor);
ConfigurationVisitor_C ConfigurationVisitorLoad(ConfigurationVisitor_C::Load,pSettings);
SendVisitor(ConfigurationVisitorLoad);
if (AddressRepresentation == AddressRepresentation_RVA)
{
ConfigurationVisitor_C ConfigurationVisitor(ConfigurationVisitor_C::AddressRVA, pSettings);
SendVisitor(ConfigurationVisitor);
ConfigurationVisitor_C ConfigurationVisitorAddr(ConfigurationVisitor_C::AddressRVA, pSettings);
SendVisitor(ConfigurationVisitorAddr);
}
SetEnvironmentVariableA( "RpcViewSymbolPath",pSettings->value("SymbolsPath").toByteArray() );
-1
View File
@@ -81,7 +81,6 @@ private:
QAction* pActionViewProcedures;
QAction* pActionViewInterfaceInfo;
QAction* pActionViewProcessInfo;
QAction* pActionAboutQt;
QAction* pActionSpeedFast;
QAction* pActionSpeedNormal;
QAction* pActionSpeedBelowNormal;
+5 -5
View File
@@ -20,9 +20,9 @@ QString GetProceduresWidgetColumName(ProceduresWigetColumn_T ProceduresWigetColu
//------------------------------------------------------------------------------
void ProceduresWidget_C::reset(ULONG Pid)
void ProceduresWidget_C::reset(ULONG pid)
{
this->Pid = Pid;
this->Pid = pid;
pProcedures->clear();
}
@@ -82,14 +82,14 @@ bool ProceduresWidget_C::AddProcedure(quint32 ProcIdx, WCHAR* pSymbolName, VOID*
//------------------------------------------------------------------------------
void ProceduresWidget_C::SetAddressRepresentation(AddressRepresentation_T AddressRepresentation)
void ProceduresWidget_C::SetAddressRepresentation(AddressRepresentation_T AddrRepresentation)
{
QTreeWidgetItem* pProcedure;
quintptr AbsoluteAddr;
this->AddressRepresentation = AddressRepresentation;
this->AddressRepresentation = AddrRepresentation;
switch (AddressRepresentation)
switch (AddrRepresentation)
{
case AddressRepresentation_RVA:
for (int i = 0; i < pProcedures->topLevelItemCount(); i++)
+3
View File
@@ -178,6 +178,9 @@ void ProcessInfoWidget_C::AcceptVisitor(ViewVisitor_C* pVisitor)
//------------------------------------------------------------------------------
ProcessInfoWidget_C::ProcessInfoWidget_C(QWidget* pParent):QDockWidget(WidgetName)
{
UNREFERENCED_PARAMETER(pParent);
setObjectName(WidgetName);
pTabWidget = new QTabWidget(this);
+7 -2
View File
@@ -146,6 +146,8 @@ void ProcessWidget_C::ProcessSelected(QTreeWidgetItem* pItem, int Column)
{
quint32 Pid;
UNREFERENCED_PARAMETER(Column);
Pid = pItem->data(Column_Pid,0).toInt();
emit ProcessSelected(Pid);
}
@@ -346,6 +348,8 @@ void ProcessWidget_C::LoadConfiguration(QSettings* pSettings)
//------------------------------------------------------------------------------
void ProcessWidget_C::InitProcessTreeWidget(QWidget* pParent)
{
UNREFERENCED_PARAMETER(pParent);
pProcessTree = new QTreeWidget(this);
QTreeWidgetItem* pHeaderItem = pProcessTree->headerItem();
@@ -374,6 +378,7 @@ void ProcessWidget_C::InitProcessTreeWidget(QWidget* pParent)
//------------------------------------------------------------------------------
void ProcessWidget_C::InitProcessTreeView(QWidget* pParent)
{
UNREFERENCED_PARAMETER(pParent);
pProxyModel = new QSortFilterProxyModel(this);
pProxyModel->setDynamicSortFilter(true);
pProxyModel->setFilterKeyColumn(Column_Pid);
@@ -493,6 +498,8 @@ void ProcessWidget_C::UpdateColumnsVisibility()
// Switch to the view header
void ProcessWidget_C::TreeHeaderClicked(int logicalIndex)
{
UNREFERENCED_PARAMETER(logicalIndex);
if (pStackedWidget->currentWidget()!=pProcessView)
{
pStackedWidget->setCurrentWidget(pProcessView);
@@ -527,8 +534,6 @@ void ProcessWidget_C::ViewHeaderClicked(int logicalIndex)
//------------------------------------------------------------------------------
ProcessWidget_C::ProcessWidget_C(QWidget* pParent):QGroupBox(WidgetName)
{
QGridLayout* pGridLayout;
setObjectName(WidgetName);
pStackedWidget = new QStackedWidget(this);
+3
View File
@@ -23,6 +23,7 @@ typedef struct _EnumCtxt_T{
//------------------------------------------------------------------------------
static BOOL WINAPI EnumProc(DWORD Pid, DWORD Ppid, EnumCtxt_T* pEnumCtxt, BOOL* pbContinue)
{
UNREFERENCED_PARAMETER(pbContinue);
ProcessEntry_C* pProcessEntry = new ProcessEntry_C(Ppid,Pid);
pEnumCtxt->pRefreshVisitor->ProcessVector.push_back(pProcessEntry);
@@ -189,6 +190,7 @@ void RefreshVisitor_C::Visit(InterfacesWidget_C* pInterfacesWidget)
void RefreshVisitor_C::Visit(InterfaceInfoWidget_C* pInterfaceInfoWidget)
{
//nothing to do here
UNREFERENCED_PARAMETER(pInterfaceInfoWidget);
}
@@ -210,6 +212,7 @@ void RefreshVisitor_C::Visit(ProcessInfoWidget_C* pProcessInfoWidget)
void RefreshVisitor_C::Visit(ProceduresWidget_C* pProceduresWidget)
{
//nothing to do
UNREFERENCED_PARAMETER(pProceduresWidget);
}
+1 -4
View File
@@ -57,7 +57,7 @@ BOOL NTAPI LoadCoreEngine(RpcCore_T** ppRpcCoreHelper, void** ppRpcCoreCtxt, BOO
hLib = LoadLibraryA(Win32FindData.cFileName);
if (hLib != NULL)
{
pRpcCoreHelper = (RpcCore_T*)GetProcAddress(hLib, RPC_CORE_EXPORT_SYMBOL);
pRpcCoreHelper = (RpcCore_T*)(ULONG_PTR)GetProcAddress(hLib, RPC_CORE_EXPORT_SYMBOL);
if (pRpcCoreHelper != NULL)
{
*ppRpcCoreCtxt = pRpcCoreHelper->RpcCoreInitFn();
@@ -66,13 +66,10 @@ BOOL NTAPI LoadCoreEngine(RpcCore_T** ppRpcCoreHelper, void** ppRpcCoreCtxt, BOO
pRpcCoreHelper->RpcCoreUninitFn(*ppRpcCoreCtxt);
if (bWow64Helper == pRpcCoreHelper->bWow64Helper)
{
// Version.As64BitsValue = pRpcCoreHelper->RuntimeVersion;
_cprintf("RpcCore : %s\n", Win32FindData.cFileName);
// _cprintf("Version : %I64X (%u.%u.%u.%u)\n", Version.As64BitsValue, Version.As16BitsValues.Part4, Version.As16BitsValues.Part3, Version.As16BitsValues.Part2, Version.As16BitsValues.Part1);
_cprintf("Helper : 0x%p\n", pRpcCoreHelper);
_cprintf("Wow64 : ");
if (pRpcCoreHelper->bWow64Helper) _cprintf("TRUE\n"); else _cprintf("FALSE\n");
// _cprintf("Description: %s\n\n", pRpcCoreHelper->pDescription);
*ppRpcCoreHelper = pRpcCoreHelper;
bResult = TRUE;
goto End;
+6 -1
View File
@@ -230,6 +230,7 @@ typedef struct _EnumCtxt_T{
//------------------------------------------------------------------------------
VOID __cdecl RpcDbgPrint(void* pContext, const char* pTxt)
{
UNREFERENCED_PARAMETER(pContext);
printf("%s\n", pTxt);
}
@@ -292,7 +293,7 @@ End:
//------------------------------------------------------------------------------
int DecompileAllInterfaces(RpcCore_T* pRpcCore)
{
EnumCtxt_T EnumCtxt;
EnumCtxt_T EnumCtxt = {0};
RpcDecompilerHelper_T* pRpcDecompilerHelper;
HMODULE hDecompiler = NULL;
@@ -336,6 +337,10 @@ End:
char* pCmdLineA = NULL;
char** argv = &pCmdLineA;
UNREFERENCED_PARAMETER(pCmdLine);
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(nCmdShow);
pCmdLineA = GetCommandLineA();
#endif
QApplication app(argc, argv);