I have a Windows NT Service and a Third Party exe which i want to run as a child process of NT Service, such that as soon as my NT service process crashes, this child process is also killed
For this i found the way of doing this using Kill child process when parent process is killed
I tried to implement it and worked fine using a normal parent process, but when i do the same in my NT Service as the parent SetInformationJobObject method return false and a Exception with Error Code 0
Exception: _COMPlusExceptionCode = -532462766
What is the difference between a Normal process and a NT Service process which is causing this exception ?
i am using Win2k8 R2 Server machine and C#
[EDIT1] Exception: GenericParameterAttributes = '(((System.Reflection.RuntimeConstructorInfo)(ex._exceptionMethod)).ReflectedType).GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException' {"Method may only be called on a Type for which Type.IsGenericParameter is true."}
EDIT 2: Because SetLastError was not set to true in the function defination using DLLImport, so last error was wrong Correct ErrorCode is 24 which say bad lench of the structure, so what should be the correct structure ?
Edit 3: Correct Length Expected in the case of a NT Servce for my 64 bit win2k8R2 server machine seems to be 144 as compared to 112 as defined in the above post
Edit 4: Is this the only way of doing this, what are other options of doing same ?