Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to write a programme in V C++ the display on the screen like this??? Pin
Adam Roderick J8-Sep-09 23:28
Adam Roderick J8-Sep-09 23:28 
Questionrequestion create an instance of Command [modified] Pin
MsmVc8-Sep-09 21:30
MsmVc8-Sep-09 21:30 
AnswerRe: requestion create an instance of Command Pin
CPallini8-Sep-09 21:38
mveCPallini8-Sep-09 21:38 
QuestionRe: requestion create an instance of Command Pin
David Crow9-Sep-09 3:23
David Crow9-Sep-09 3:23 
AnswerRe: requestion create an instance of Command Pin
Stuart Dootson9-Sep-09 3:31
professionalStuart Dootson9-Sep-09 3:31 
GeneralRe: requestion create an instance of Command Pin
MsmVc10-Sep-09 18:49
MsmVc10-Sep-09 18:49 
QuestionKill Process using DebugActiveProcess. Pin
gothic_coder8-Sep-09 20:55
gothic_coder8-Sep-09 20:55 
AnswerRe: Kill Process using DebugActiveProcess. Pin
gothic_coder9-Sep-09 3:08
gothic_coder9-Sep-09 3:08 
I'm doing something like this.


#define DEBUG_KILL_PROCESS_ON_EXIT	0x1 
#define OBJ_KERNEL_HANDLE			0x00000200L
#define OBJ_CASE_INSENSITIVE		0x00000040L
#define OBJECT_ALL_ACCESS			(STANDARD_RIGHTS_REQUIRED | 0x1)


if(strcmp(Proc_Argument, "-debug") == 0)
{
	OBJECT_ATTRIBUTES	objAttr;
			
	objAttr.Length = sizeof(OBJECT_ATTRIBUTES);
	objAttr.RootDirectory = NULL;
	objAttr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE;
	objAttr.ObjectName = NULL;
	objAttr.SecurityDescriptor = NULL;
	objAttr.SecurityQualityOfService = NULL;

	HMODULE hDebugObject = NULL;
	HANDLE MyDebugHandle = NULL;
			
	HANDLE hProc = MyOpenProcess(PROCESS_SUSPEND_RESUME,FALSE, dwID);
			
	typedef NTSTATUS (WINAPI *_NtCreateDebugObject)(OUT PHANDLE DebugHandle,
                 				IN ACCESS_MASK DesiredAccess,
						IN POBJECT_ATTRIBUTES ObjectAttributes,
						IN ULONG Flags);

				 
	_NtCreateDebugObject Debug_Object;


			
	typedef NTSTATUS (WINAPI *_NtDebugActiveProcess)(IN HANDLE ProcessHandle,
						IN HANDLE DebugHandle);

	_NtDebugActiveProcess Debug_Process = NULL;


	hDebugObject = GetModuleHandle("ntdll.dll");

	if(hDebugObject == INVALID_HANDLE_VALUE || hDebugObject == NULL)
	{
		hDebugObject = LoadLibrary("ntdll.dll");
		if(hDebugObject == INVALID_HANDLE_VALUE || hDebugObject == NULL)
		{
			MessageBox(NULL, "Cannot Load NtDll.dll", "Error", MB_OK);
					
		}
	}

	Debug_Object = (_NtCreateDebugObject)GetProcAddress(hDebugObject, "NtCreateDebugObject");
	Debug_Process = (_NtDebugActiveProcess)GetProcAddress(hDebugObject, "NtDebugActiveProcess");


	NTSTATUS nStatus = Debug_Object(&MyDebugHandle,
								OBJECT_ALL_ACCESS,
								&objAttr,
								DEBUG_KILL_PROCESS_ON_EXIT);
	
        DWORD err = GetLastError();

	if(nStatus != STATUS_SUCCESS)
	{
		MessageBox(NULL, "Fail to create object", "Error", MB_OK)
		return FALSE;
	}

	NTSTATUS nStatusProc = Debug_Process(hWnd, MyDebugHandle);

        //This does not attch the process... Don't know what's the problem..
		
	err = GetLastError();
			
	if(nStatusProc != STATUS_SUCCESS)
	{
                
		MessageBox(NULL, "Cannot Attach Processl", "Error", MB_OK)
		return FALSE;
	}
			
	CloseHandle(MyDebugHandle);

}



Also the error after Debug_Process comes out to be 299 i.e "Only part of a ReadProcessMemory or WriteProcessMemory request was completed."...
Questionlibraries, headers (.h) in C language [modified] Pin
programmer2028-Sep-09 20:45
programmer2028-Sep-09 20:45 
AnswerRe: libraries, headers (.h) in C language Pin
ThatsAlok8-Sep-09 20:56
ThatsAlok8-Sep-09 20:56 
AnswerRe: libraries, headers (.h) in C language Pin
CPallini8-Sep-09 20:57
mveCPallini8-Sep-09 20:57 
AnswerRe: libraries, headers (.h) in C language Pin
Hamid_RT8-Sep-09 21:00
Hamid_RT8-Sep-09 21:00 
GeneralRe: libraries, headers (.h) in C language Pin
ThatsAlok8-Sep-09 21:05
ThatsAlok8-Sep-09 21:05 
AnswerRe: libraries, headers (.h) in C language Pin
Richard MacCutchan8-Sep-09 23:13
mveRichard MacCutchan8-Sep-09 23:13 
AnswerRe: libraries, headers (.h) in C language Pin
Selvam R9-Sep-09 2:15
professionalSelvam R9-Sep-09 2:15 
QuestionSource code not working in outlook 2002 Pin
Game-point8-Sep-09 19:35
Game-point8-Sep-09 19:35 
AnswerRe: Source code not working in outlook 2002 Pin
ThatsAlok8-Sep-09 21:03
ThatsAlok8-Sep-09 21:03 
AnswerRe: Source code not working in outlook 2002 Pin
Selvam R9-Sep-09 2:19
professionalSelvam R9-Sep-09 2:19 
QuestionRe: Source code not working in outlook 2002 Pin
David Crow9-Sep-09 3:25
David Crow9-Sep-09 3:25 
QuestionHow do i do Unit testing for C programming in visual studio Pin
mohant$.net8-Sep-09 19:33
mohant$.net8-Sep-09 19:33 
AnswerRe: How do i do Unit testing for C programming in visual studio Pin
CPallini8-Sep-09 20:53
mveCPallini8-Sep-09 20:53 
GeneralRe: How do i do Unit testing for C programming in visual studio Pin
mohant$.net8-Sep-09 20:56
mohant$.net8-Sep-09 20:56 
GeneralRe: How do i do Unit testing for C programming in visual studio Pin
CPallini8-Sep-09 21:00
mveCPallini8-Sep-09 21:00 
AnswerRe: How do i do Unit testing for C programming in visual studio Pin
David Crow9-Sep-09 3:27
David Crow9-Sep-09 3:27 
AnswerRe: How do i do Unit testing for C programming in visual studio Pin
Rick York9-Sep-09 11:28
mveRick York9-Sep-09 11:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.