资源简介
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个文件信息
评论
共有 条评论