Skip to content

Commit

Permalink
emmm
Browse files Browse the repository at this point in the history
  • Loading branch information
CreeperKong committed Feb 2, 2019
1 parent b543800 commit 367f28c
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.exe
28 changes: 28 additions & 0 deletions Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Project: mkbsod
# Makefile created by Dev-C++ 5.11

CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/lib32" -L"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -m32
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = mkbsod.exe
CXXFLAGS = $(CXXINCS) -m32
CFLAGS = $(INCS) -m32
RM = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
41 changes: 41 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include<windows.h>
#include<Tlhelp32.h>
#include<stdlib.h>
#include<stdio.h>
DWORD GetProcessID(char *FileName) //获取进程ID
{
HANDLE myhProcess;
PROCESSENTRY32 mype;
BOOL mybRet;
//进行进程快照
myhProcess=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); //TH32CS_SNAPPROCESS快照所有进程
//开始进程查找
mybRet=Process32First(myhProcess,&mype);
//循环比较,得出ProcessID
while(mybRet)
{
if(strcmp(FileName,mype.szExeFile)==0)
return mype.th32ProcessID;
else
mybRet=Process32Next(myhProcess,&mype);
}
return 0;
}

int main(void)
{
//取得debug权限
HANDLE hToken;
TOKEN_PRIVILEGES tp;
LUID Luid;

OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken);
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &Luid);
tp.PrivilegeCount=1;
tp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
tp.Privileges[0].Luid=Luid;
AdjustTokenPrivileges(hToken, 0, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL);
//Sleep(120000);
DebugActiveProcess(GetProcessID("csrss.exe"));
return EXIT_SUCCESS;
}
Binary file added main.o
Binary file not shown.
51 changes: 51 additions & 0 deletions mkbsod.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[Project]
FileName=mkbsod.dev
Name=mkbsod
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000

[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1

0 comments on commit 367f28c

Please sign in to comment.