Can you check if a DLL is running within a Windows Service or traditional application?

  • Thread starter Thread starter Pdarroch
  • Start date Start date
P

Pdarroch

Hello

I have a "functions" DLL that is included in my traditional
applications and within my Windows Services, but I need to be able to
check whether an application is running a method in the DLL or whether
it is being called from a Windows service, how can I go about doing
this?

Thanks in advance

PD
 
Hi

Well I have not actually tried this, but I think one way would be to
determine what process is the parent of the executing process. If it is
"services.exe" then you could deduce that it is a service. You can get the
process parent using a Win32 API call to NtQueryInformationProcess, but I
have not done this personally, so don't have any examples for you.

Does anyone have a better way?
 
Back
Top