当前位置: 首页 > news >正文

设计微信公众号的网站吗近期发生的新闻

设计微信公众号的网站吗,近期发生的新闻,免费一级做网站,做网站和做程序一样吗驱动程序加载工具有许多,最常用的当属KmdManager工具,如果驱动程序需要对外发布那我们必须自己编写实现一个驱动加载工具,当需要使用驱动时可以拉起自己的驱动,如下将实现一个简单的驱动加载工具,该工具可以实现基本的…

驱动程序加载工具有许多,最常用的当属KmdManager工具,如果驱动程序需要对外发布那我们必须自己编写实现一个驱动加载工具,当需要使用驱动时可以拉起自己的驱动,如下将实现一个简单的驱动加载工具,该工具可以实现基本的,安装,加载,关闭,卸载等操作日常使用完全没问题。

installDvr 驱动安装

#include <iostream>
#include <Windows.h>using namespace std;// 安装驱动
BOOL installDvr(CONST WCHAR drvPath[50], CONST WCHAR serviceName[20])
{// 打开服务控制管理器数据库SC_HANDLE schSCManager = OpenSCManager(NULL,                   // 目标计算机的名称,NULL:连接本地计算机上的服务控制管理器NULL,                   // 服务控制管理器数据库的名称,NULL:打开 SERVICES_ACTIVE_DATABASE 数据库SC_MANAGER_ALL_ACCESS   // 所有权限);if (schSCManager == NULL){CloseServiceHandle(schSCManager);return FALSE;}// 创建服务对象,添加至服务控制管理器数据库SC_HANDLE schService = CreateService(schSCManager,               // 服务控件管理器数据库的句柄serviceName,                // 要安装的服务的名称serviceName,                // 用户界面程序用来标识服务的显示名称SERVICE_ALL_ACCESS,         // 对服务的访问权限:所有全权限SERVICE_KERNEL_DRIVER,      // 服务类型:驱动服务SERVICE_DEMAND_START,       // 服务启动选项:进程调用 StartService 时启动SERVICE_ERROR_IGNORE,       // 如果无法启动:忽略错误继续运行drvPath,                    // 驱动文件绝对路径,如果包含空格需要多加双引号NULL,                       // 服务所属的负载订购组:服务不属于某个组NULL,                       // 接收订购组唯一标记值:不接收NULL,                       // 服务加载顺序数组:服务没有依赖项NULL,                       // 运行服务的账户名:使用 LocalSystem 账户NULL                        // LocalSystem 账户密码);if (schService == NULL){CloseServiceHandle(schService);CloseServiceHandle(schSCManager);return FALSE;}CloseServiceHandle(schService);CloseServiceHandle(schSCManager);return TRUE;
}int main(int argc, char *argv[])
{if (installDvr(L"C:\\WinDDK.sys", L"service") == TRUE){cout << "驱动已安装" << endl;}getchar();return 0;
}
 

startDvr 启动驱动

#include <iostream>
#include <Windows.h>using namespace std;// 启动服务
BOOL startDvr(CONST WCHAR serviceName[20])
{// 打开服务控制管理器数据库SC_HANDLE schSCManager = OpenSCManager(NULL,                   // 目标计算机的名称,NULL:连接本地计算机上的服务控制管理器NULL,                   // 服务控制管理器数据库的名称,NULL:打开 SERVICES_ACTIVE_DATABASE 数据库SC_MANAGER_ALL_ACCESS   // 所有权限);if (schSCManager == NULL){CloseServiceHandle(schSCManager);return FALSE;}// 打开服务SC_HANDLE hs = OpenService(schSCManager,           // 服务控件管理器数据库的句柄serviceName,            // 要打开的服务名SERVICE_ALL_ACCESS      // 服务访问权限:所有权限);if (hs == NULL){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}if (StartService(hs, 0, 0) == 0){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return TRUE;
}int main(int argc, char *argv[])
{if (startDvr(L"service") == TRUE){cout << "驱动服务" << endl;}getchar();return 0;
}
 

stopDvr 停止驱动

#include <iostream>
#include <Windows.h>using namespace std;// 停止服务
BOOL stopDvr(CONST WCHAR serviceName[20])
{// 打开服务控制管理器数据库SC_HANDLE schSCManager = OpenSCManager(NULL,                   // 目标计算机的名称,NULL:连接本地计算机上的服务控制管理器NULL,                   // 服务控制管理器数据库的名称,NULL:打开 SERVICES_ACTIVE_DATABASE 数据库SC_MANAGER_ALL_ACCESS   // 所有权限);if (schSCManager == NULL){CloseServiceHandle(schSCManager);return FALSE;}// 打开服务SC_HANDLE hs = OpenService(schSCManager,           // 服务控件管理器数据库的句柄serviceName,            // 要打开的服务名SERVICE_ALL_ACCESS      // 服务访问权限:所有权限);if (hs == NULL){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}// 如果服务正在运行SERVICE_STATUS status;if (QueryServiceStatus(hs, &status) == 0){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}if (status.dwCurrentState != SERVICE_STOPPED &&status.dwCurrentState != SERVICE_STOP_PENDING){// 发送关闭服务请求if (ControlService(hs,                         // 服务句柄SERVICE_CONTROL_STOP,       // 控制码:通知服务应该停止&status                     // 接收最新的服务状态信息) == 0) {CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}// 判断超时INT timeOut = 0;while (status.dwCurrentState != SERVICE_STOPPED){timeOut++;QueryServiceStatus(hs, &status);Sleep(50);}if (timeOut > 80){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}}CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return TRUE;
}int main(int argc, char *argv[])
{if (stopDvr(L"service") == TRUE){cout << "停止驱动服务" << endl;}getchar();return 0;
}
 

unloadDvr 卸载驱动

#include <iostream>
#include <Windows.h>using namespace std;// 卸载驱动
BOOL unloadDvr(CONST WCHAR serviceName[20])
{// 打开服务控制管理器数据库SC_HANDLE schSCManager = OpenSCManager(NULL,                   // 目标计算机的名称,NULL:连接本地计算机上的服务控制管理器NULL,                   // 服务控制管理器数据库的名称,NULL:打开 SERVICES_ACTIVE_DATABASE 数据库SC_MANAGER_ALL_ACCESS   // 所有权限);if (schSCManager == NULL){CloseServiceHandle(schSCManager);return FALSE;}// 打开服务SC_HANDLE hs = OpenService(schSCManager,           // 服务控件管理器数据库的句柄serviceName,            // 要打开的服务名SERVICE_ALL_ACCESS      // 服务访问权限:所有权限);if (hs == NULL){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}// 删除服务if (DeleteService(hs) == 0){CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return FALSE;}CloseServiceHandle(hs);CloseServiceHandle(schSCManager);return TRUE;
}int main(int argc, char *argv[])
{if (unloadDvr(L"service") == TRUE){cout << "卸载驱动服务" << endl;}getchar();return 0;
}
 

封装cDrvCtrl通信类

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <Windows.h>#pragma comment(lib,"user32.lib")
#pragma comment(lib,"advapi32.lib")// ------------------------------------------------------------------------------
// 驱动控制类
// ------------------------------------------------------------------------------class cDrvCtrl
{
public:cDrvCtrl(){m_pSysPath = NULL;m_pServiceName = NULL;m_pDisplayName = NULL;m_hSCManager = NULL;m_hService = NULL;m_hDriver = INVALID_HANDLE_VALUE;}~cDrvCtrl(){CloseServiceHandle(m_hService);CloseServiceHandle(m_hSCManager);CloseHandle(m_hDriver);}// 安装驱动BOOL Install(PCHAR pSysPath, PCHAR pServiceName, PCHAR pDisplayName){m_pSysPath = pSysPath;m_pServiceName = pServiceName;m_pDisplayName = pDisplayName;m_hSCManager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);if (NULL == m_hSCManager){m_dwLastError = GetLastError();return FALSE;}m_hService = CreateServiceA(m_hSCManager, m_pServiceName, m_pDisplayName,SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,m_pSysPath, NULL, NULL, NULL, NULL, NULL);if (NULL == m_hService){m_dwLastError = GetLastError();if (ERROR_SERVICE_EXISTS == m_dwLastError){m_hService = OpenServiceA(m_hSCManager, m_pServiceName, SERVICE_ALL_ACCESS);if (NULL == m_hService){CloseServiceHandle(m_hSCManager);return FALSE;}}else{CloseServiceHandle(m_hSCManager);return FALSE;}}return TRUE;}// 启动驱动BOOL Start(){if (!StartServiceA(m_hService, NULL, NULL)){m_dwLastError = GetLastError();return FALSE;}return TRUE;}// 关闭驱动BOOL Stop(){SERVICE_STATUS ss;GetSvcHandle(m_pServiceName);if (!ControlService(m_hService, SERVICE_CONTROL_STOP, &ss)){m_dwLastError = GetLastError();return FALSE;}return TRUE;}// 移除驱动BOOL Remove(){GetSvcHandle(m_pServiceName);if (!DeleteService(m_hService)){m_dwLastError = GetLastError();return FALSE;}return TRUE;}// 打开驱动BOOL Open(PCHAR pLinkName){if (m_hDriver != INVALID_HANDLE_VALUE)return TRUE;m_hDriver = CreateFileA(pLinkName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);if (m_hDriver != INVALID_HANDLE_VALUE)return TRUE;elsereturn FALSE;}// 安装并运行驱动VOID InstallAndRun(){char szSysFile[MAX_PATH] = { 0 };char szSvcLnkName[] = "LyInject";;GetAppPath(szSysFile);strcat(szSysFile, "LyInject.sys");Install(szSysFile, szSvcLnkName, szSvcLnkName);Start();Open("\\\\.\\LyInject");}// 移除并关闭驱动VOID RemoveAndStop(){Stop();Remove();CloseHandle(m_hDriver);}// 发送控制信号BOOL IoControl(DWORD dwIoCode, PVOID InBuff, DWORD InBuffLen, PVOID OutBuff, DWORD OutBuffLen, DWORD *RealRetBytes){DWORD dw;BOOL b = DeviceIoControl(m_hDriver, CTL_CODE_GEN(dwIoCode), InBuff, InBuffLen, OutBuff, OutBuffLen, &dw, NULL);if (RealRetBytes)*RealRetBytes = dw;return b;}
private:// 获取服务句柄BOOL GetSvcHandle(PCHAR pServiceName){m_pServiceName = pServiceName;m_hSCManager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);if (NULL == m_hSCManager){m_dwLastError = GetLastError();return FALSE;}m_hService = OpenServiceA(m_hSCManager, m_pServiceName, SERVICE_ALL_ACCESS);if (NULL == m_hService){CloseServiceHandle(m_hSCManager);return FALSE;}else{return TRUE;}}// 获取控制信号对应字符串DWORD CTL_CODE_GEN(DWORD lngFunction){return (FILE_DEVICE_UNKNOWN * 65536) | (FILE_ANY_ACCESS * 16384) | (lngFunction * 4) | METHOD_BUFFERED;}// 获取完整路径void GetAppPath(char *szCurFile){GetModuleFileNameA(0, szCurFile, MAX_PATH);for (SIZE_T i = strlen(szCurFile) - 1; i >= 0; i--){if (szCurFile[i] == '\\'){szCurFile[i + 1] = '\0';break;}}}public:DWORD m_dwLastError;PCHAR m_pSysPath;PCHAR m_pServiceName;PCHAR m_pDisplayName;HANDLE m_hDriver;SC_HANDLE m_hSCManager;SC_HANDLE m_hService;
};int main(int argc, char *argv[])
{cDrvCtrl DriveControl;DriveControl.InstallAndRun();DriveControl.RemoveAndStop();system("pause");return 0;
}
 

文章出处:https://www.cnblogs.com/LyShark/p/15019049.html
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!


文章转载自:
http://toddel.sqLh.cn
http://lupulone.sqLh.cn
http://nictheroy.sqLh.cn
http://descension.sqLh.cn
http://clubhouse.sqLh.cn
http://reinflate.sqLh.cn
http://wapiti.sqLh.cn
http://eidolon.sqLh.cn
http://pedobaptism.sqLh.cn
http://exumbrella.sqLh.cn
http://varanasi.sqLh.cn
http://jungian.sqLh.cn
http://matlock.sqLh.cn
http://hii.sqLh.cn
http://sirdar.sqLh.cn
http://photodisintegration.sqLh.cn
http://laverne.sqLh.cn
http://rawin.sqLh.cn
http://drab.sqLh.cn
http://hemodia.sqLh.cn
http://montilla.sqLh.cn
http://libate.sqLh.cn
http://aridity.sqLh.cn
http://electrogalvanize.sqLh.cn
http://ectally.sqLh.cn
http://morasthite.sqLh.cn
http://chauvinist.sqLh.cn
http://thrifty.sqLh.cn
http://jasper.sqLh.cn
http://hurler.sqLh.cn
http://electrology.sqLh.cn
http://bacteriochlorophyll.sqLh.cn
http://uniseptate.sqLh.cn
http://agenesis.sqLh.cn
http://replacer.sqLh.cn
http://evadable.sqLh.cn
http://phillumeny.sqLh.cn
http://bimotor.sqLh.cn
http://septa.sqLh.cn
http://diskcopy.sqLh.cn
http://breviary.sqLh.cn
http://hmis.sqLh.cn
http://coolville.sqLh.cn
http://quingenary.sqLh.cn
http://hexanitrate.sqLh.cn
http://predestinarian.sqLh.cn
http://ruly.sqLh.cn
http://militancy.sqLh.cn
http://frondiferous.sqLh.cn
http://quiff.sqLh.cn
http://laguna.sqLh.cn
http://photophore.sqLh.cn
http://seek.sqLh.cn
http://polyether.sqLh.cn
http://deerweed.sqLh.cn
http://shakeout.sqLh.cn
http://vortical.sqLh.cn
http://biform.sqLh.cn
http://cctv.sqLh.cn
http://cymbal.sqLh.cn
http://chereme.sqLh.cn
http://dumpish.sqLh.cn
http://hydrobromic.sqLh.cn
http://privet.sqLh.cn
http://tumultuously.sqLh.cn
http://conic.sqLh.cn
http://blunt.sqLh.cn
http://maintenance.sqLh.cn
http://fluence.sqLh.cn
http://undeniable.sqLh.cn
http://pantagraph.sqLh.cn
http://venge.sqLh.cn
http://floe.sqLh.cn
http://bacteriform.sqLh.cn
http://bluejay.sqLh.cn
http://tectonite.sqLh.cn
http://thioarsenite.sqLh.cn
http://amorously.sqLh.cn
http://flytable.sqLh.cn
http://reimport.sqLh.cn
http://holarctic.sqLh.cn
http://richelieu.sqLh.cn
http://combinatorics.sqLh.cn
http://mendicity.sqLh.cn
http://suppertime.sqLh.cn
http://unpurposed.sqLh.cn
http://hyperbolize.sqLh.cn
http://while.sqLh.cn
http://tee.sqLh.cn
http://edmond.sqLh.cn
http://contagiously.sqLh.cn
http://geopotential.sqLh.cn
http://cossette.sqLh.cn
http://sextyping.sqLh.cn
http://andesite.sqLh.cn
http://coccid.sqLh.cn
http://lift.sqLh.cn
http://piptonychia.sqLh.cn
http://environs.sqLh.cn
http://systematise.sqLh.cn
http://www.15wanjia.com/news/92433.html

相关文章:

  • 网站开发文档模板seo公司关键词
  • 深圳企业网站制作招聘信息百度新闻最新消息
  • 哪一个网站做专栏作家好点地推拉新app推广平台
  • 哪个网站适合 做红本抵押百度电脑版下载安装
  • 网站开站什么叫外链
  • 成都淮洲新城建设投资有限公司网站app关键词推广
  • 福建省两学一做网站南宁网站seo外包
  • 百度推广苏州公司seo交流
  • 做任务赚取佣金网站武汉seo管理
  • 做注册会员和购物的网站需要什么网站设计公司多少钱
  • google免费vps相城seo网站优化软件
  • 杭州装饰网站建设越秀seo搜索引擎优化
  • 餐饮网站建设研究问题atp最新排名
  • 官方网站开发方案林云seo博客
  • 移动互联网app开发哈尔滨seo
  • 建设网站所需的费用的估算推广网站的文案
  • 深圳网站建设 设计首选公司seo关键词优化培训班
  • 网站建设 响应式 北京常熟网站建设
  • dw班级网站建设网络推广优化seo
  • 外贸soho虚拟公司做网站网络营销制度课完整版
  • 为什么要加强网站安全建设1688的网站特色
  • 公司注册后每年的费用seo优化策略
  • 域名备案查询网站备案网络推广与优化
  • 上海免费做网站泰安百度推广电话
  • 网站全程设计技术外贸商城建站
  • 扬之云公司网站建设正规推广平台有哪些
  • 泉州网站建设开发东营百度推广公司
  • 公司响应式网站steam交易链接怎么改
  • 做变态小视频网站营销网络怎么写
  • wordpress 模板安装企业关键词优化专业公司