Results 1 to 8 of 8
  1. #1

    Default Detecting application launch in C#


    Does anybody have any idea on how can I detect when an application is being launched using C#?
    Last edited by Tin_Tin; 09-08-2009 at 02:40 PM.

  2. #2
    Quote Originally Posted by Tin_Tin View Post
    Does anybody have any idea on how can I detect when an application is being launched using C#?
    IIRC, hook CreateProcess

  3. #3
    Quote Originally Posted by junkfactory View Post
    IIRC, hook CreateProcess
    Can you please explain.

  4. #4
    Quote Originally Posted by Tin_Tin View Post
    Does anybody have any idea on how can I detect when an application is being launched using C#?
    There's a kernel mode function for these.
    PsSetCreateProcessNotifyRoutine() offers the ability to register system-wide callback function which is called by OS each time when a new process starts, exits or is terminated. The mentioned API can be employed as an easy to implement method for tracking down processes simply by implementing a NT kernel-mode driver and a user mode Win32 control application. The role of the driver is to detect process execution and notifiy the control program about these events.
    Here's the link, all you have to do for your C# is to create a DLL wrapper for the DevIoCtrl function for your application.
    Even though it is a simple solution but you need an application and a driver for this solution to work.
    CodeProject: Detecting Windows NT/2K process execution. Free source code and programming help
    Last edited by xyberblue; 09-08-2009 at 11:06 PM.

  5. #5
    Quote Originally Posted by Tin_Tin View Post
    Can you please explain.
    CreateProcess is called everytime the OS creates a new process. This includes running executable files.

    The trick is to inject your DLL such that when CreateProcess is called by the OS, your function in the DLL will be called first instead of the original function. Google for CreateProcess API Hook

    Another little hacky way of achieving what you need is to create a thread that will poll the system getting a list of process. Maintaining a list will allow you to keep track of new processes, once you have one, get the PID and from that you can get more information about the process. However, this is inefficient but in theory it might work depending on how deep your requirements are and is relatively simple.

  6. #6
    ScrapeBox Development softtouch's Avatar
    Join Date
    Jan 2004
    Gender
    Male
    Posts
    3,699
    Blog Entries
    1
    You need to hook NtCreateProcessA, NtCreateProcessW and WinExec if you need realtime monitoring with the possibility to intercept the execution of the process.

    Polling only make sense when you do not intent to intercept the process execution.

    I am doing a lot of hooking (for example in my File Guard, or Autorun protect), and its not that difficult.

  7. #7
    Quote Originally Posted by softtouch View Post
    You need to hook NtCreateProcessA, NtCreateProcessW and WinExec if you need realtime monitoring with the possibility to intercept the execution of the process.

    Polling only make sense when you do not intent to intercept the process execution.

    I am doing a lot of hooking (for example in my File Guard, or Autorun protect), and its not that difficult.
    Can you point some online resources I can use, I really don't have any idea about hooking and all. What's the easiest and simplest way of doing this?
    Last edited by Tin_Tin; 09-12-2009 at 03:09 PM.

  8. #8
    ScrapeBox Development softtouch's Avatar
    Join Date
    Jan 2004
    Gender
    Male
    Posts
    3,699
    Blog Entries
    1
    I am not using C#, so i have no idea which would be the easiest way for you.

    But, take a look at this, its C#: EasyHook - The reinvention of Windows API Hooking - Home

  9.    Advertisement

Similar Threads

 
  1. New Radio Station Launched in Cebu
    By shaun1979ca in forum Music & Radio
    Replies: 3
    Last Post: 06-21-2011, 06:40 AM
  2. HD7/HD3 to launch in October
    By yan2x1987 in forum Gizmos & Gadgets (Old)
    Replies: 1
    Last Post: 09-08-2010, 08:38 PM
  3. WorldVision Campaign Launch in Ayala Cebu May 19
    By diem in forum Parties & Events
    Replies: 2
    Last Post: 05-21-2010, 07:32 AM
  4. Microsoft Business Launch in Cebu November 24, 2009
    By abortretryfail in forum Parties & Events
    Replies: 7
    Last Post: 11-25-2009, 10:48 PM
  5. Kapatid EP Launching in Cebu
    By nailworms in forum Parties & Events
    Replies: 27
    Last Post: 06-16-2009, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top