資源簡介
WinRing0再次升級版本,此次更新把驅動文件加入dll資源和exe資源里,使程序目錄更簡潔,不再包含sys驅動文件或者dll文件,也可以防止用戶誤刪除驅動文件,支持64位系統。支持靜態lib方式調用(程序目錄不再需要dll和sys文件),支持動態dll方式調用(程序目錄不再存在sys文件)。壓縮包包含WinRing0驅動源代碼和兩個實例demo源代碼(一個C++和一個C#)。
代碼片段和文件信息
//-----------------------------------------------------------------------------
//?????Author?:?hiyohiyo
//???????Mail?:?hiyohiyo@crystalmark.info
//????????Web?:?http://openlibsys.org/
//????License?:?The?modified?BSD?license
//
//??????????????????????????Copyright?2007-2020?OpenLibSys.org.?All?rights?reserved.
//-----------------------------------------------------------------------------
#include?“stdafx.h“
#include?“Driver.h“
#include?
#include?“OlsDll.h“
//-----------------------------------------------------------------------------
//
//?Global
//
//-----------------------------------------------------------------------------
extern?HANDLE?gHandle;
//-----------------------------------------------------------------------------
//
//?Prototypes
//
//-----------------------------------------------------------------------------
static?BOOL?InstallDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId?LPCTSTR?DriverPath);
static?BOOL?RemoveDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId);
static?BOOL?StartDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId);
static?BOOL?StopDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId);
static?BOOL?SystemInstallDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId?LPCTSTR?DriverPath);
static?BOOL?IsSystemInstallDriver(SC_HANDLE?hSCManager?LPCTSTR?DriverId?LPCTSTR?DriverPath);
//-----------------------------------------------------------------------------
//
//?Manage?Driver
//
//-----------------------------------------------------------------------------
BOOL?ManageDriver(LPCTSTR?DriverId?LPCTSTR?DriverPath?USHORT?Function)
{
SC_HANDLE hSCManager?=?NULL;
BOOL rCode?=?FALSE;
DWORD error?=?NO_ERROR;
if(DriverId?==?NULL?||?DriverPath?==?NULL)
{
return?FALSE;
}
hSCManager?=?OpenSCManager(NULL?NULL?SC_MANAGER_ALL_ACCESS);
????if(hSCManager?==?NULL)
{
????????return?FALSE;
????}
????switch(Function)
{
case?OLS_DRIVER_INSTALL:
if(InstallDriver(hSCManager?DriverId?DriverPath))
{
rCode?=?StartDriver(hSCManager?DriverId);
}
break;
case?OLS_DRIVER_REMOVE:
if(!?IsSystemInstallDriver(hSCManager?DriverId?DriverPath))
{
StopDriver(hSCManager?DriverId);
rCode?=?RemoveDriver(hSCManager?DriverId);
}
break;
case?OLS_DRIVER_SYSTEM_INSTALL:
if(IsSystemInstallDriver(hSCManager?DriverId?DriverPath))
{
rCode?=?TRUE;
}
else
{
if(!?OpenDriver())
{
StopDriver(hSCManager?DriverId);
RemoveDriver(hSCManager?DriverId);
if(InstallDriver(hSCManager?DriverId?DriverPath))
{
StartDriver(hSCManager?DriverId);
}
OpenDriver();
}
rCode?=?SystemInstallDriver(hSCManager?DriverId?DriverPath);
}
break;
case?OLS_DRIVER_SYSTEM_UNINSTALL:
if(!?IsSystemInstallDriver(hSCManager?DriverId?DriverPath))
{
rCode?=?TRUE;
}
else
{
if(gHandle?!=?INVALID_HANDLE_VALUE)
{
CloseHandle(gHandle);
gHandle?=?INVALID_HANDLE_VAL
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????125440??2020-03-10?12:52??WinRing0-v3.0.20-Source-ResDrv\Bin\Release\WinRing0SampleCppx32.exe
?????文件?????132096??2020-03-10?12:51??WinRing0-v3.0.20-Source-ResDrv\Bin\Release\WinRing0SampleCppx64.exe
?????文件?????176640??2020-03-10?10:04??WinRing0-v3.0.20-Source-ResDrv\Bin\Release\WinRing0SampleCs.exe
?????文件??????51712??2020-03-10?12:51??WinRing0-v3.0.20-Source-ResDrv\Bin\Release\WinRing0x32.dll
?????文件??????55808??2020-03-10?12:51??WinRing0-v3.0.20-Source-ResDrv\Bin\Release\WinRing0x64.dll
?????文件????1926144??2020-03-10?12:51??WinRing0-v3.0.20-Source-ResDrv\Bin\SRelease\WinRing0SampleCppx32.exe
?????文件????2675712??2020-03-10?12:51??WinRing0-v3.0.20-Source-ResDrv\Bin\SRelease\WinRing0SampleCppx64.exe
?????文件???????1274??2009-03-01?10:23??WinRing0-v3.0.20-Source-ResDrv\COPYRIGHT.txt
?????文件??????38601??2009-08-15?19:44??WinRing0-v3.0.20-Source-ResDrv\manual.chm
?????文件???????2400??2009-05-24?11:15??WinRing0-v3.0.20-Source-ResDrv\ReadMe.html
?????文件????????280??2020-03-09?22:12??WinRing0-v3.0.20-Source-ResDrv\Source\Clear.bat
?????文件???????1773??2009-05-27?21:46??WinRing0-v3.0.20-Source-ResDrv\Source\dll\CpuidX64.asm
?????文件???????7745??2020-01-18?22:49??WinRing0-v3.0.20-Source-ResDrv\Source\dll\Driver.cpp
?????文件????????635??2020-01-18?22:49??WinRing0-v3.0.20-Source-ResDrv\Source\dll\Driver.h
?????文件??????31944??2020-01-18?22:42??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApi.cpp
?????文件???????1235??2009-03-01?12:43??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApi.def
?????文件??????20127??2020-01-18?22:42??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApi.h
?????文件??????11405??2020-03-10?08:26??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApiInit.h
?????文件???????5280??2020-01-18?22:42??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApiInitDef.h
?????文件???????2907??2020-03-10?08:40??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsApiInitExt.h
?????文件???????2342??2020-01-18?22:49??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsDef.h
?????文件??????49716??2020-03-10?09:00??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsDll.aps
?????文件??????11499??2020-03-10?12:33??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsDll.cpp
?????文件???????1809??2020-03-09?11:37??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsDll.h
?????文件???????2976??2020-03-09?18:46??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsDll.rc
?????文件???????5411??2020-01-18?22:49??WinRing0-v3.0.20-Source-ResDrv\Source\dll\OlsIoctl.h
?????文件???????4016??2020-03-09?11:33??WinRing0-v3.0.20-Source-ResDrv\Source\dll\ResFile.h
?????文件????????487??2020-03-09?18:46??WinRing0-v3.0.20-Source-ResDrv\Source\dll\resource.h
?????文件????????426??2020-01-18?22:49??WinRing0-v3.0.20-Source-ResDrv\Source\dll\stdafx.cpp
?????文件????????757??2020-03-10?06:17??WinRing0-v3.0.20-Source-ResDrv\Source\dll\stdafx.h
............此處省略83個文件信息
評論
共有 條評論