Thread: windows service + hooks + dll

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    windows service + hooks + dll

    Hi all,

    I've written an application that uses keyboards hooks to monitor text input. When a certain string is encountered it logs information to a file. The hook code is contained in a dll, that I have not written and do not have the source code for (it provides an install and remove function).

    The application runs fine as a standard exe. But when I turned it into a windows service (call StartServiceCtrlDispatcher etc) it doesn't log (the install call doesn't return an error).

    Is there a special way to load dlls in a windows service?

    What could be going wrong within the dll when its run within a windows service rather than a standard exe?

    The dll does write debug info to stdout. Would this cause a problem?

    TIA, rotis23

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Sounds to me too much like your writing a password grabber, or other illegal software.

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    I'm sure it does Elixia.

    Its meant to catch known people using illegal pornography in Internet Cafes.

    It logs IP/MAC address based on a username.

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    if I do:

    Code:
    wsprintf(szErrorMessage,"Error: %d",GetLastError());
    I get error 183.

    Now error 183 means:

    183 Cannot create a file when that file already exists. ERROR_ALREADY_EXISTS

    The log file doesn't exist. But I wonder if this is a permissions thing. If I run as a service, does the service have my rights? Can a service create and write to a file?

    google me thinks.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Yes, but you can't use any of the standard handles (stdin, stdout, stderr, etc) and you must specifically enable if the service is allowed to interact with the desktop.

  6. #6
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    OK thanks, that must be the problem!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows Hooks for global mouse detection
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-12-2008, 08:04 AM
  2. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  4. Codec Bitrates?
    By gvector1 in forum C# Programming
    Replies: 2
    Last Post: 06-16-2003, 08:39 AM
  5. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 02:58 AM