欢迎来到【胆够肥源码】【nodejs源码交叉编译】【编译r源码包】driverload源码-皮皮网网站!!!

皮皮网

【胆够肥源码】【nodejs源码交叉编译】【编译r源码包】driverload源码-皮皮网 扫描左侧二维码访问本站手机端

【胆够肥源码】【nodejs源码交叉编译】【编译r源码包】driverload源码

2024-12-27 04:31:53 来源:{typename type="name"/} 分类:{typename type="name"/}

1.C++ 启动服务问题!

driverload源码

C++ 启动服务问题!

       我是源码胆够肥源码楼主,此程序是加载sys的?

       BOOL LoadDriver( IN LPCTSTR lpFileName )

       {

        HANDLE hDevice=0;

        SC_HANDLE hSCManager = OpenSCManager( NULL, NULL,SC_MANAGER_CREATE_SERVICE );

        CreateService(hSCManager, SERVICE_NAME,SERVICE_NAME, SERVICE_START,SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START,SERVICE_ERROR_IGNORE, lpFileName, NULL, NULL, NULL, NULL, NULL );

        SC_HANDLE hService = OpenService( hSCManager, SERVICE_NAME, SERVICE_START );

        if(!StartService( hService, 0, NULL ))

        {

        printf("ERROR!");

        return false;

        }

        else

        return true;

        CloseServiceHandle( hService );

        CloseServiceHandle( hSCManager );

        hDevice = CreateFileA( DEVICE_NAME,GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );

       }

       BOOL UnloadDriver()

       {

        SC_HANDLE hSCManager = OpenSCManager( NULL, NULL,SC_MANAGER_CREATE_SERVICE );

        SC_HANDLE hService = OpenService( hSCManager, SERVICE_NAME, DELETE | SERVICE_STOP );

        SERVICE_STATUS ss;

        if (ControlService( hService, SERVICE_CONTROL_STOP, &ss ))

        return true;

        else

        return false;

        CloseServiceHandle( hService );

        CloseServiceHandle( hSCManager );

       }

       ---------------------------------------------

       程序刚开始运行 LoadDriver()成功,再UnloadDriver()成功,然后再次LoadDriver()却失败了! 如果关闭程序再重新打开, LoadDriver()又是成功的!! 呕血....