master
gmh5225 2 years ago
parent a69675881d
commit f3f5135efc
No known key found for this signature in database
GPG Key ID: 3BBC731F40B2CEC1

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "tool/QDarkStyleSheet"]
path = tool/QDarkStyleSheet
url = https://github.com/gmh5225/QDarkStyleSheet

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -1,3 +1,7 @@
# Tool-DIYSystemMemoryDump
DIYSystemMemoryDump is a tool that forces a lock on the type of system memory dump.
![image](DIYSystemMemoryDump.png)
# Documents
- https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/memory-dump-file-options

73
tool/.gitignore vendored

@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1 @@
Subproject commit 6eca4512251843debc24029672d866ca36cb8057

@ -0,0 +1,26 @@
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QTextStream>
int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication a(argc, argv);
MainWindow w;
QFile f(":/qdarkstyle/dark/style.qss");
if (!f.exists()) {
printf("Unable to set stylesheet, file not found\n");
} else {
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
}
w.show();
return a.exec();
}

@ -0,0 +1,63 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <thread>
#include <QMessageBox>
#include <QSettings>
#include <QThread>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), mDumpType(DUMPTYPE::KERNEL), mStop(false),
mRunning(false)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
setFixedSize(this->width(), this->height());
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_start_clicked()
{
if (mRunning) {
QMessageBox::information(this, "Tips", "You are running now!");
return;
}
mRunning = true;
mStop = false;
//https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/memory-dump-file-options
if (ui->radioButton_Auto->isChecked()) {
mDumpType = DUMPTYPE::AUTO;
} else if (ui->radioButton_Complete->isChecked()) {
mDumpType = DUMPTYPE::COMPLETE;
} else if (ui->radioButton_Kernel->isChecked()) {
mDumpType = DUMPTYPE::KERNEL;
} else if (ui->radioButton_Small->isChecked()) {
mDumpType = DUMPTYPE::SMALL;
}
std::thread t1([&] {
while (!mStop) {
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl
QSettings qRegQ("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\CrashControl",
QSettings::NativeFormat);
qRegQ.setValue("AlwaysKeepMemoryDump", (int) 0);
qRegQ.setValue("CrashDumpEnabled", (int) mDumpType);
//20ms
QThread::msleep(20);
}
mRunning = false;
});
t1.detach();
QMessageBox::information(this, "Tips", "Start new running!");
}
void MainWindow::on_pushButton_stop_clicked()
{
mStop = true;
QMessageBox::information(this, "Tips", "Stop running!");
}

@ -0,0 +1,34 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_pushButton_start_clicked();
void on_pushButton_stop_clicked();
public:
enum DUMPTYPE { AUTO = 7, KERNEL = 2, SMALL = 3, COMPLETE = 1 };
public:
DUMPTYPE mDumpType;
bool mStop;
bool mRunning;
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>228</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>DIYSystemMemoryDump</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Dump Type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButton_Complete">
<property name="text">
<string>Complete memory dump</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_Kernel">
<property name="text">
<string>Kernel memory dump</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="radioButton_Auto">
<property name="text">
<string>Automatic memory dump</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_Small">
<property name="text">
<string>Small memory dump</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_start">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_stop">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,44 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
!contains(QMAKE_HOST.arch, x86_64) {
TARGET = DIYSystemMemoryDump32
} else {
TARGET = DIYSystemMemoryDump64
}
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
# ICO
RC_ICONS = NewWorld.ico
# RESOURCES
RESOURCES += QDarkStyleSheet/qdarkstyle/dark/style.qrc
RESOURCES += QDarkStyleSheet/qdarkstyle/light/style.qrc
RESOURCES += QDarkStyleSheet/qdarkstyle/X64DBGDark/style.qrc
#UAC
QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:"level='requireAdministrator'"
Loading…
Cancel
Save