|
This is intentionally difficult to do.
Part of how virus programs protect themselves is by terminating the anti-virus programs. And anti-virus programs protect themselves by making them very difficult to terminate.
If it's that annoying to you, I suggest you uninstall it in favor of some other program.
I'm not quite sure how Norton does it though...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Norton accomplished this with a kernel hook from a device driver.
Normally here is what happens:
1.) User program invokes TerminateProcess() is called from kernel32.
2.) TerminateProcess() calls NtTerminateProcess() exported from NTDLL.DLL.
3.) NtTerminateProcess() invokes ZwTerminateProcess()
4.) ZwTerminateProcess() will mov 0x101 into eax and mov edx,esp.
5.) SYSENTER instruction is executed.
Looks something like:
TerminateProcess()
...
call ds:NtTerminateProcess
...
mov eax, 101h
mov edx, 7FFE0300h
call edx
.text 7FFE0300: mov edx,esp
systenter
ret
However, Norton has implemented a ZwTerminateProcess hook by modifying the SDT (Service Descriptor Table) so at this point they have intercepted the call and their code executes instead, blocking you from terminating the application.
|
|
|
|
|
Could you give an example of how I might do this in my code?
Thanks.
|
|
|
|
|
I'm trying to load data into a vector and simply can't fiquire out how to do it.
Here's the class that holds (should) hold the data:
class CMyTrailer {
public:
// Varables
CString m_csData;
CMyTrailer();
~CMyTrailer();
};
#include <vector>
using std::vector;
using std::copy;
using std::iterator;
using std::string;
Here's my error from the compiler:
error C2653: 'vector<class CMyTrailer,class std::allocator<class CMyTrailer> >' : is not a class or namespace name
error C2653: 'vector<class CMyTrailer,class std::allocator<class CMyTrailer> >' : is not a class or namespace name
error C2955: 'iterator' : use of class template requires template argument list
Here's my vector declaration:
vector<CMyTrailer> TRL_MFG;
vector<CMyTrailer>::iterator TRL_ITItem;
Can any one help, Please!
-- modified at 14:17 Monday 19th November, 2007
A C++ programming language novice, but striving to learn
|
|
|
|
|
Did you include the file where CMyTrailer is declared in the file where you are declaring your vector ?
|
|
|
|
|
I think the answer is yes: here's the header:
// Trailer.h
#if !defined(AFX_TRAILER_H)
#define AFX_TRAILER_H
#include "MyTrailer.h"
#include <vector>
using std::vector;
using std::copy;
using std::iterator;
using std::string;
class CTrailer {
public:
CTrailer(int nIsPage=0);
~CTrailer();
// Varables:
// Vectors:
// Setup vectors:
vector<CMyTrailer> TRL_ITEM;
vector<CMyTrailer> TRL_MFG;
vector<CMyTrailer> TRL_ID;
vector<CMyTrailer>::iterator TRL_ITItem;
vector<CMyTrailer>::iterator TRL_ITMFG;
vector<CMyTrailer>::iterator TRL_ITID;
vector<CMyTrailer> m_vITEM; // Item
vector<CMyTrailer> m_MFG; // MFG vector
vector<CMyTrailer> m_IDNUM; // Part#/ID#
// Iterators:
vector<CMyTrailer>::iterator m_ITItem;
vector<CMyTrailer>::iterator m_ITMFG;
vector<CMyTrailer>::iterator m_ITID;
//Functions:
};
#endif
-- modified at 21:55 Monday 19th November, 2007
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hi
Put this code
using namespace std;
instead of
using std::vector;
using std::copy;
using std::iterator;
using std::string;
and I hope it works fine.
Warm Regards
Bhawna
|
|
|
|
|
I never use using namespace in a header file. This will 'propagate' the namespace across all files that include this specific header file, leading to potential conflicts. In header files, I just put the namespace with the class declaration:
std::vector<MyClass> ....
|
|
|
|
|
Use this code
using std::vector<CMyTrailer>;
Thanks
Bhawna
|
|
|
|
|
Hi,
I have the following code:
typedef std::map<std::string, std::string> MyMapType;
MyMapType myMap;
myMap["abc"] = "def";
This works as expected. But I want my map to be on the heap, so I tried this:
MyMapType *myNewMap = new MyMapType;
myNewMap["abc"] = "def";
*myNewMap["abc"] = "def";
The two lines are commented with the compile time errors it generates. What have I missed?
- Dy
|
|
|
|
|
A pair of braces:
(*myNewMap)["abc"] = "def";
compiles well.
BTW, you also missed to properly format your code (have a look at typedef statement in the OP).
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.
|
|
|
|
|
CPallini wrote: A pair of braces
D'oh! Thanks very much for helping me out.
- Dy
|
|
|
|
|
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.
|
|
|
|
|
Hello,
i have a ms access database, there is information written in cyrillic encoding. When i read the text from c++ using Ado, it cannt read proper text, it reads only "???????????????", what should i do to read correct text in c++?
here is the code
<br />
CString strItem; <br />
strItem = (char *) (_bstr_t) pRecordPtr->Fields->GetItem("name")->Value;<br />
strItem is "?????" if when encoding is cyrillic.
thanks
|
|
|
|
|
Gofur Halmurat wrote: what should i do to read correct text in c++?
Study the subject "character encoding" so you understand it. Perhaps start here[^] but look beyond that as well.
|
|
|
|
|
Hello,
Is there sql command like "SET CHARACTER SET utf8" in Jet Sql, Mysql has the command, but wondering that Microsoft Jet sql has it?
if Microsoft Jet Sql has it, it would be better to change encoding
thanks
|
|
|
|
|
you should consider using UNICODE strings.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Why all the casting? What is the type of Value ?
Steve
|
|
|
|
|
The Value's type is _variant_t
I tried to convert _variant_t to CString
<br />
_variant_t vari= ...;<br />
CString s;<br />
s = (LPCSTR)(_bstr_t)vari.bstrVal;<br />
but it doesnt show the right encoding, i think the problem is with UNICODE
but i dont know how to implement it.
thanks
|
|
|
|
|
Hello everyone,
About Template Partial Specialization,
http://www.cprogramming.com/tutorial/template_specialization.html
sometimes in real case like below,
http://www.sgi.com/tech/stl/iterator_traits.html
there will be two definitions at the same time,
<code>
template <typename T>
class Foo {
}
template <typename T>
class Foo <T *>
{
}
</code>
In theory, compiler will match the latter one with first priority compared with the 1st one.
My question is, I tihnk for basic data types it is easy to match,
example,
when we pass Foo <int*>, the latter one is matched and T is int. But for arbitrary data types, like used data types, how could compiler judge whether a type is pointer (when the latter template class should be matched) or not a pointer (when the first template class should be matched).
thanks in advance,
George
|
|
|
|
|
I guess it will depend on what you code inside. In extremis, it would be like a pointer void pBuf = NULL, you can get whatever you want with it, but afterwards to use it in another places you may have to cast the type. Maybe is not the best way, but is possible.
So that the template without parameter is just a void container that can hold whatever you give in, other thing will be how to use it after.
I like some of your questions, maybe I shouldn't answer if I don't know the answer for sure, but this way I learn too. Other people can correct/confirm me as well
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks Nelek,
I do not quite understand your points below. I think void pBuf = NULL should be void* pBuf = NULL? Please feel free to correct me if I am wrong.
And it is appreciated if you could provide some pseudo-code to show your points below. A couple of lines of code is more effective for a large section of literal description for developer.
Nelek wrote: In extremis, it would be like a pointer void pBuf = NULL, you can get whatever you want with it, but afterwards to use it in another places you may have to cast the type.
regards,
George
|
|
|
|
|
Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have.
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
<br />
int main(int argc, char * argv[])<br />
{<br />
system("setsdwperm.bat " + *argv[1]);<br />
}<br />
I got the project on the add new project dialog: Visual C++ -> General -> Empty Project
When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?
|
|
|
|
|
eggsovereasy wrote: system("setsdwperm.bat " + *argv[1]);
oh my god !!!
when you want to concatenate strings, you mustn't use the + operator !!! you have to use strcat() .
moreover, system() is deprecated if you're targetting your code for a given plateform (for Windows, you should prefer ShellExecute() or CreateProcess() for instance).
|
|
|
|
|
Ok, everything I try throws exceptions and I can't use the debugger with it?
Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.
|
|
|
|