|
Errot is
Can't create an instance of Command
|
|
|
|
|
Hello all.
I want to kill the process using DebugActiveProcess.. I read somewhere that to kill the debugee process or target process i need to terminate the Debug object.. Can anyone clarify that? How do i do that?
Thanks.
|
|
|
|
|
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);
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."...
|
|
|
|
|
Hello to everyone,
Does anyone know any document (downloadable from internet or any you can attach me in an email) wich deals with topics about libraries, headers (.h),...step by step with examples and all that....
S.O.: Windows
COMPILER: VC++ 2008
LANGUAGE: C
MAIL: programmer202@gmail.com
Thank you!
modified on Wednesday, September 9, 2009 3:27 AM
|
|
|
|
|
programmer202 wrote: LANGUAGE: C
MAIL: programmer202@gmail.com
Dear, which book are you are referencing for learning c++
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
programmer202 wrote: Does anyone know any document wich deals with topics about libraries, headers (.h), source code (.c),...step by step with examples and all that....
Yes: any good C programming language book deals with topics such basic as headers and source code.
BTW have you tried to google for [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
What do you need exactly? are you sure you want a book that it contains source codes?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: What do you need exactly? are you sure you want a book that it contains source codes?
might be looking for example book
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
This might be a good place to start.
|
|
|
|
|
|
Hi All,
i am trying to send mail using mapiex.dll in outlook 2002, but its not working other than that outlook 2007 , 2003 its all working fine ...plz suggest me how to rectify this problem ...
kindly help me
thanks
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
rajugis wrote: mapiex.dll in outlook 2002
Is it user defined dll?? if yes you need to check code of MapiEx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Are you getting error during linking time? If so, you may be miss symbols from your dll's. check with dependency walker for get missing symbols.
Thanks and Regards,
Selvam,
http://www.wincpp.com
|
|
|
|
|
What exactly is the problem?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All
How do i do Unit testing for C programming in visual studio.
I have written code in c in visual studio .net and now i need to do unit testing please gimme idea....how do we test.........
Thanks,
Mohan.T
Mohan t
|
|
|
|
|
If you need to do unit testing then, you've to know how to do it. What I mean is: "testing is a difficul activity, you've to know very well theory in order to start".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ya thanks,But am asking is there any tool for testing...
Mohan t working for N.I.C
|
|
|
|
|
That's a completely different question, and Google may give a precious help [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Unit testing is independent of programming language and IDE.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Hi,
I am trying to access an activeX dll from a C++ program. The dll does not have any exported functions and I am trying to access it explicitly, do I need to use create an interface using COM? LoadLibrary does not work because none of the functions are exported, Is there some tutorial on how to create a com interface?
Thanks
|
|
|
|
|
You don't need to create a COM interface. However you do need to obtain a COM interface, via, for instance CoCreateInstance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
assume the table has 2 fields: fe and fu.
fe (field-english) is english text field.
fu (field-unicode) is unicode text field.
also assume X is an unicode character, whose value is 1212 (hex word).
now we insert english string ab into field fe, Xa (values are 1212 6100) into fu.
how do we writesql statement?
i.e.
sql="insert into mytable (fe,fu) values(\'ab\', \'\x12\x12\x61\x00\' )";
the \x00 terminates the sql statement string.
any idea or suggestion?
(I am testing mysql database now, CString with unicode setting is not really suitable for mysql in the case).
thanks
|
|
|
|
|
Hi,
a new version of cfix, which is an open source unit testing framework
for user and kernel mode C and C++, is now available for download. Among
several minor improvements and fixes, cfix 1.5 adds two important new
features: The ability to implement unit tests as part of (existing) EXE
projects and support for multithreaded kernel mode unit tests.
For more details on these features, please refer to this blog post:
http://jpassing.com/?p=492
Updated cfix binaries and source code are available here:
https://sourceforge.net/projects/cfix/files/cfix/
Tutorials can be found here:
http://www.cfix-testing.org/doc/TutorialUserVsCc.html (Usermode C++)
http://www.cfix-testing.org/doc/TutorialUserVs.html (Usermode C)
http://www.cfix-testing.org/doc/TutorialKernelWdk.html (Kernel C)
Last but not least, in case you are a Visual Studio user, do not miss
out on giving Visual Assert Beta 2 a try -- it is an AddIn for Visual
Studio that seamlessly integrates cfix with the Visual C++ IDE:
http://www.visualassert.com/
As always, all kind of feedback is welcome!
--Johannes
|
|
|
|