资源简介

这是一个通过加载低级键盘钩子实现的屏幕锁屏,还有进程保护功能,不过不太完善,如果谁有兴趣做到了进程保护,可以交流一下

资源截图

代码片段和文件信息

#include “StdAfx.h“

DWORD WINAPI ThreadCheckProc(LPVOID lParam)
{
STARTUPINFO si={sizeof(si)};
PROCESS_INFORMATION pi={0};
HANDLE hMutex;
LPCWSTR pName=(LPCWSTR )lParam;
while(1)
{
hMutex=OpenMutex(MUTEX_ALL_ACCESSFALSEpName);
if(!hMutex)
{
CreateProcess(pName
NULL
NULL // Process handle not inheritable.
NULL // Thread handle not inheritable.
FALSE // Set handle inheritance to FALSE.
0 // No creation flags.
NULL // Use parent‘s environment block.
NULL // Use parent‘s starting directory.
&si // Pointer to STARTUPINFO structure.
&pi ); // Pointer to PROCESS_INFORMATION structure.
WaitForSingleobject( pi.hProcess INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
else
{
CloseHandle(hMutex);
}
Sleep(1);
}
}

HINSTANCE g_hInst = NULL;

BOOL CALLBACK FindDlgProc( HWND hWnd
  UINT nMsg WPARAM wParam LPARAM lParam )
{
switch( nMsg )
{
case WM_CREATE:
/* MessageBox( NULL “WM_CREATE“
“WinDlg“ MB_OK );*/
break;
case WM_INITDIALOG:
/* MessageBox( NULL “WM_INITDIALOG“
“WinDlg“ MB_OK );*/
break;
case WM_SYSCOMMAND:
{
switch( wParam )
{
case SC_CLOSE:
EndDialog( hWnd 0 );
break;
}
}
break;
}
return 0;
}

//void Find( HWND hWnd )
//{ //创建对话框
// HWND hDlg = CreateDialog( g_hInst 
// MAKEINTRESOURCE(IDD_FIND)
// hWnd FindDlgProc );
// //显示对话框
// ShowWindow( hDlg SW_SHOW );
//}

void OnCommand( HWND hWnd UINT nMsg
   WPARAM wParam LPARAM lParam )
{
int nCmdID = LOWORD( wParam );
//switch( nCmdID )
//{
//case ID_EXIT:
// PostQuitMessage( 0 );
// break;
//case ID_FIND:
// Find( hWnd );
// break;
//}
}

LRESULT CALLBACK WndProc( HWND   hWnd 
 UINT   nMsg
 WPARAM wParam
 LPARAM lParam )
{
switch( nMsg )
{
case WM_COMMAND:
OnCommand( hWnd nMsg wParam lParam );
break;
case WM_DESTROY:
PostQuitMessage( 0 );
return 0;
}
return DefWindowProc( hWnd nMsg
wParam lParam );
}

BOOL RegisterWnd( LPSTR pszClassName )
{
WNDCLASSEX wce = { 0 };
wce.cbSize        = sizeof( wce );
wce.cbClsExtra    = 0;
wce.cbWndExtra    = 0;
wce.hbrBackground = HBRUSH(COLOR_WINDOW);
wce.hCursor       = NULL;
wce.hIcon         = NULL;
wce.hIconSm       = NULL;
wce.hInstance     = g_hInst;
wce.lpfnWndProc   = WndProc;
wce.lpszClassName = pszClassName;
wce.lpszMenuName  = NULL;
wce.style         = CS_HREDRAW|CS_VREDRAW;

ATOM nAtom = RegisterClassEx( &wce );
if( 0 ==  nAtom )
{
return FALSE;
}

return TRUE;
}

HWND CreateWnd( LPSTR pszClassName )
{

HWND hWnd = CreateWindowEx( 0
pszClassName “MyWnd“ 
WS_OVERLAPPEDWINDOW CW_USEDEFAULT
CW_USEDEFAULT CW_USEDEFAULT
CW_USEDEFAULT NULL NULL g_hInst
NULL );
return hWnd;
}

void DisplayWnd( HWND hWnd )
{
ShowWindow( hWnd SW_SHOW );
UpdateWindow(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-03-12 16:07  LockScreen\
     目录           0  2014-03-12 11:49  LockScreen\LockScreen\
     文件        1832  2014-03-11 06:06  LockScreen\LockScreen.sln
     文件      111104  2014-03-12 16:06  LockScreen\LockScreen.suo
     文件        3618  2014-03-11 03:39  LockScreen\LockScreen\CheckProcess.cpp
     文件      110592  2010-12-01 20:13  LockScreen\LockScreen\CourseProtect.dll
     文件        2144  2010-12-01 20:13  LockScreen\LockScreen\CourseProtect.lib
     目录           0  2014-03-12 11:49  LockScreen\LockScreen\Debug\
     文件        7124  2014-03-12 11:49  LockScreen\LockScreen\Debug\BuildLog.htm
     文件       51679  2014-03-12 11:45  LockScreen\LockScreen\Debug\FullScreen.obj
     文件        1196  2014-03-12 11:45  LockScreen\LockScreen\Debug\LockScreen.exe.embed.manifest
     文件        1260  2014-03-12 11:46  LockScreen\LockScreen\Debug\LockScreen.exe.embed.manifest.res
     文件        1120  2014-03-12 11:49  LockScreen\LockScreen\Debug\LockScreen.exe.intermediate.manifest
     文件       27599  2014-03-12 11:45  LockScreen\LockScreen\Debug\LockScreen.obj
     文件    40828928  2014-03-12 11:45  LockScreen\LockScreen\Debug\LockScreen.pch
     文件     3957752  2014-03-12 11:45  LockScreen\LockScreen\Debug\LockScreen.res
     文件       52864  2014-03-12 11:49  LockScreen\LockScreen\Debug\LockScreenDlg.obj
     文件          60  2014-03-12 11:49  LockScreen\LockScreen\Debug\mt.dep
     文件      565960  2014-03-12 11:45  LockScreen\LockScreen\Debug\stdafx.obj
     文件     1838080  2014-03-12 11:49  LockScreen\LockScreen\Debug\vc90.idb
     文件     3207168  2014-03-12 11:49  LockScreen\LockScreen\Debug\vc90.pdb
     文件        8170  2014-03-11 00:40  LockScreen\LockScreen\FullScreen.cpp
     文件        1316  2014-03-11 00:40  LockScreen\LockScreen\FullScreen.h
     文件     3993016  2014-03-10 19:27  LockScreen\LockScreen\LockScreen.aps
     文件        1799  2014-03-11 07:36  LockScreen\LockScreen\LockScreen.cpp
     文件         465  2014-03-11 07:36  LockScreen\LockScreen\LockScreen.h
     文件        5648  2014-03-10 19:27  LockScreen\LockScreen\LockScreen.rc
     文件        5806  2014-03-12 11:10  LockScreen\LockScreen\LockScreen.vcproj
     文件        1423  2014-03-12 16:06  LockScreen\LockScreen\LockScreen.vcproj.又见杨柳岸-PC.又见杨柳岸.user
     文件        6319  2014-03-12 11:49  LockScreen\LockScreen\LockScreenDlg.cpp
     文件        1215  2014-03-12 11:45  LockScreen\LockScreen\LockScreenDlg.h
............此处省略30个文件信息

评论

共有 条评论