Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. About InstallWinIoDriver function of WinIo.dll

About InstallWinIoDriver function of WinIo.dll

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cedricvictor
    wrote on last edited by
    #1

    Dear all: I use winIo.dll with my project, when I call InstallWinIoDriver function, it always return false, but my application still work, What happened? There are source code below

    bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)
    {
    SC_HANDLE hSCManager;
    SC_HANDLE hService;
    // Remove any previous instance of the driver
    RemoveWinIoDriver();

    hSCManager = OpenSCManager(NULL, NULL,     
    SC\_MANAGER\_ALL\_ACCESS);
    
    if(hSCManager)
    {
     // Install the driver
     hService = CreateService(hSCManager, L"WINIO", L"WINIO",   
     SERVICE\_ALL\_ACCESS, SERVICE\_KERNEL\_DRIVER, (IsDemandLoaded  
     == true) ? SERVICE\_DEMAND\_START : SERVICE\_SYSTEM\_START, 
     SERVICE\_ERROR\_NORMAL, pszWinIoDriverPath, NULL, NULL, NULL, 
     NULL, NULL);
    
      CloseServiceHandle(hSCManager);
     if(hService == NULL)
        return false;                   //strange 
    }
    else
        return false;                  //strange
        CloseServiceHandle(hService);  //strange
        return true;                   //strange
    

    }

    Thanks for your help, Victor

    G L 2 Replies Last reply
    0
    • C cedricvictor

      Dear all: I use winIo.dll with my project, when I call InstallWinIoDriver function, it always return false, but my application still work, What happened? There are source code below

      bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)
      {
      SC_HANDLE hSCManager;
      SC_HANDLE hService;
      // Remove any previous instance of the driver
      RemoveWinIoDriver();

      hSCManager = OpenSCManager(NULL, NULL,     
      SC\_MANAGER\_ALL\_ACCESS);
      
      if(hSCManager)
      {
       // Install the driver
       hService = CreateService(hSCManager, L"WINIO", L"WINIO",   
       SERVICE\_ALL\_ACCESS, SERVICE\_KERNEL\_DRIVER, (IsDemandLoaded  
       == true) ? SERVICE\_DEMAND\_START : SERVICE\_SYSTEM\_START, 
       SERVICE\_ERROR\_NORMAL, pszWinIoDriverPath, NULL, NULL, NULL, 
       NULL, NULL);
      
        CloseServiceHandle(hSCManager);
       if(hService == NULL)
          return false;                   //strange 
      }
      else
          return false;                  //strange
          CloseServiceHandle(hService);  //strange
          return true;                   //strange
      

      }

      Thanks for your help, Victor

      G Offline
      G Offline
      Gisle Vanem
      wrote on last edited by
      #2

      I have no idea really. But it's always useful to have some trace-code that prints the result of GetLastError() and FormatMessage(). Something like: MY_TRACE (("CreateService() failed; %s\n", my_strerror(GetLastError())));

      -- Gisle V.

      1 Reply Last reply
      0
      • C cedricvictor

        Dear all: I use winIo.dll with my project, when I call InstallWinIoDriver function, it always return false, but my application still work, What happened? There are source code below

        bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)
        {
        SC_HANDLE hSCManager;
        SC_HANDLE hService;
        // Remove any previous instance of the driver
        RemoveWinIoDriver();

        hSCManager = OpenSCManager(NULL, NULL,     
        SC\_MANAGER\_ALL\_ACCESS);
        
        if(hSCManager)
        {
         // Install the driver
         hService = CreateService(hSCManager, L"WINIO", L"WINIO",   
         SERVICE\_ALL\_ACCESS, SERVICE\_KERNEL\_DRIVER, (IsDemandLoaded  
         == true) ? SERVICE\_DEMAND\_START : SERVICE\_SYSTEM\_START, 
         SERVICE\_ERROR\_NORMAL, pszWinIoDriverPath, NULL, NULL, NULL, 
         NULL, NULL);
        
          CloseServiceHandle(hSCManager);
         if(hService == NULL)
            return false;                   //strange 
        }
        else
            return false;                  //strange
            CloseServiceHandle(hService);  //strange
            return true;                   //strange
        

        }

        Thanks for your help, Victor

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hmmm, Could be that the CreateService function[^] is returning either ERROR_DUPLICATE_SERVICE_NAME or maybe ERROR_SERVICE_EXISTS. As previously stated GetLastError[^] is your friend.

        cedricvictor wrote:

        but my application still work,

        Keep in mind that if you do not have source code for winIo.dll ... it could also be installing the service. Best Wishes, -David Delaune

        C 1 Reply Last reply
        0
        • L Lost User

          Hmmm, Could be that the CreateService function[^] is returning either ERROR_DUPLICATE_SERVICE_NAME or maybe ERROR_SERVICE_EXISTS. As previously stated GetLastError[^] is your friend.

          cedricvictor wrote:

          but my application still work,

          Keep in mind that if you do not have source code for winIo.dll ... it could also be installing the service. Best Wishes, -David Delaune

          C Offline
          C Offline
          cedricvictor
          wrote on last edited by
          #4

          Dear Randor: You are right. In other function, the service is exist. So the function always return false. Thank for your help, Victor

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups