|
-
February 5th, 2010, 12:22 PM
#1
ZwTerminateProcess failed with [DllImport]
I just want to use ZwTerminateProcess() native function through my C# Application.
I've been written this part of code :
Code:
[DllImport("ntdll.dll")]
public static extern NtStatus ZwTerminateProcess(
[In] [Optional] IntPtr ProcessHandle,
[In] NtStatus ExitStatus
);
but the compiler issues some error code :
Code:
Error 2 The type or namespace name 'NtStatus' could not be found (are you missing a using directive or an assembly reference?)
how Can I import this function ?
-
February 5th, 2010, 02:46 PM
#2
Re: ZwTerminateProcess failed with [DllImport]
There's really no need to try to pinvoke to a kernel mode api when in user mode.
If you are trying to terminate a project, you can use the Process class methods or pinvoke to TerminateProcess api.
-
February 5th, 2010, 03:29 PM
#3
Re: ZwTerminateProcess failed with [DllImport]
It's just for learning purpose dear dear arjay, I know what you are saying 
may help me?
-
February 5th, 2010, 04:05 PM
#4
Re: ZwTerminateProcess failed with [DllImport]
All you have to do is to define NtStatus.
-
February 5th, 2010, 04:55 PM
#5
Re: ZwTerminateProcess failed with [DllImport]
I think if found the answer, I should define it as :
typedef int NTSTATUS
how to add this to C#?
-
February 5th, 2010, 08:10 PM
#6
Re: ZwTerminateProcess failed with [DllImport]
 Originally Posted by escap3
I think if found the answer, I should define it as :
typedef int NTSTATUS
how to add this to C#?
I don't think you have to define that. Just treat it as an 'int' (i.e. instead of using NTSTATUS use Int32 or int).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|