|
Anonymous wrote:
how does it (virus) account for the extra file size on the disk
Back in the DOS days, some viruses would have a memory-resident part that hooked various DOS calls (int 13 and/or int 21), and if a call was made to, say read or get the size of an infected file, the virus would modify the returned data to try and hide itself.
These days I doubt virus writers go to that much trouble, since no one keeps mental track of file sizes, and it wouldn't gain much.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
You cannot stop me with paramecium alone!
|
|
|
|
|
yeah , back in dos times the virus wirters tried to make their code as small as possible or make it multiples of 100 so that they dont modifty the last 2 digits of the original file size as it would be very obvious that something has changed.
Now a days virus are about 20k compared to 1 or 2 kb in dos days.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Most viruses/works/trojan horses these days just replace a good with with an infected file. The OS looks for a program by filename only so svchost.exe (infected) and svchost.exe (clean) look the same, until the AV software kicks in.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
can you give me some code samples or good advice?
|
|
|
|
|
Hello,
does anyone know how to embed and Automate a Word Document with MFC containing graphics, tables and bitmaps?
Thanks.
Sebas
|
|
|
|
|
Use the Word Automation model.
There exists an object called 'Word.Application' on every machine where Microsoft Word in installed. The version of Word makes no difference, this object refers always to the latest version.
Using the COM-thinking, you can request for a pointer to the IUnknown interface of a Word application (either a running one or a new instance) by using the above object name as a parameter in CLSIDFromProgID function call, and the returned CLSID in a call to either GetActiveObject or CoCreateInstance
At this point, you might want to use the ClassWizard / ClassView to derive a new IDispatch-wrapper class for 'Word.Application'. Then, you use the IUnknown pointer's QueryInterface to ask for an interface called IID_IDispatch . You can then attach the newly created wrapper class to this interface by calling AttachDispatch .
Now, you have complete access to the Word application, allowing you to create new documents, insert images, graphics, etc etc etc.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thank you very much. At tjis point I can open a word document, I know how to put text into it and how to put tables, but I don't know how to put graphics and images. Do you (or anyone) know where couls I find an example of code doing this?
Thanks a lot another time.
Sebas
|
|
|
|
|
I can't provide you with direct example code, but after a bit browsing through the interfaces provided by Microsoft Word Object Library, I found the CanvasShapes IDispatch interface.
This interface has a method called AddPicture , and the parameters of this function call determine the source file name, width, height, top coord, left coord and so on.
It might be precisely what you're looking for. I will attempt to implement it myself today, so if you can't get it working, I'll create some source code to help you out.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks Antti.
I've done what you say and I've found the code to put a picture and it is:
oShapes.AddPicture("c:\\picture.jpg", vtFalse, vtTrue, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional);
Do you know what is the parameter to put that picture fixed in the word document at a position?
Another thing, what type is VARIANT? It can be:
vtTrue
vtFalse
vtOptional
anymore?
Thanks another time
|
|
|
|
|
Sebas. wrote:
Do you know what is the parameter to put that picture fixed in the word document at a position?
No, sorry. I haven't familiarized myself with Word Automation now that you got it working. You need to find this one out yourself. Perhaps downloading the Office Developer's SDK will help. It has, for the least, wizards to create applications that automate Office family programs.
Sebas. wrote:
Another thing, what type is VARIANT?
VARIANT is a structure. It basically functions as a collection of possible parameter values. Like, there are members in the structure for integer, long, double, boolean, BSTR, CString, IDispatch, IUnknown and so on. You set one of these members to the right value, then use the vt member to tell the using function which of the members this VARIANT structure represents.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
|
Sebas,
It looks like you have done some work on MS Word automation more like to what I'm trying to do. Can you help? I have done word automation in VB but I am new to C++ and running into problems.
|
|
|
|
|
What do you need to accomplish ? What problems are you facing ?
If you've done Word automation in VB, you know a whole lot of the work already. All Office applications, whether running or stopped, expose an interface that can be used to invoke the methods. The procedure is similar: initialize COM (CoInitialize-call), either create a new object (CoCreateInstance) or try to find an existing one (GetActiveObject).
When the object is created, you always have access to the IUnknown interface. You can use this interface to query for alternative interfaces on the object (see the Word Automation Model reference for a comprehensive list of interfaces) to accomplish your needs.
Remember to release all interfaces, so that the object gets terminated and will not remain in memory after your program execution has stopped.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
For starters, I need a starting push. Do I start with a wrapper class with a type library or something else? Any reference code on how to initialize COM,instantiate
a COM object will help...
|
|
|
|
|
With Visual Studio, you get a handy little application installed that's called 'OLEViewer'. This program can be easily used to browse through the COM libraries installed on your machine. For example, if you go there, and find the Word Automation Server, you can fire up Word by creating an instance of that server. Know, however that if you start Word this way, it will not display it's user interface. But you can use CTRL+ALT+DEL and see 'WinWord.exe', which is the Word's executable, running there. Word is running, acting as an automation server, but just doesn't show an UI.
Another tool, called 'Runtime Object Table Viewer' or 'ROT Viewer' is also installed with Visual Studio. It probably doesn't have a shortcut, but you can easily add one. The name of the executable is 'irotview.exe'. Find it on your machine and add a shortcut. This application shows all running objects that are registered with OLE/COM. In english, if you fire up Word, it starts it's own automation server at the same time, and this server is registered to OLE/COM. So, if you run Word, you'll see it's automation server instance there.
I can create a small sample application that will help you get started. It will show step-by-step how to initialize COM, and allow you to query for a running Word instance or start a new instance, and then shut this instance down. It should take a few days. I'll send it to your e-mail when it's done.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks a lot, I await your sample app. I forgot to mention that my environment is Visual C++ 7.1
|
|
|
|
|
Dear all,
I checked through the network, it appears need SOAP Client SDK which only comes with XP Pro. Just wondering is there any SOAP Client which installed automatically with .NET Framework or XP Home+.
Thank you in advance.
|
|
|
|
|
Dear Sir,
I actually want some code which can get the Processor's or Mainboard's Serial Number.
Regards,
Kashif Mughal.
|
|
|
|
|
Go to Intel's website and try to find an article on how to retrieve the Processor Serial Number if there is one. I have some code from last year which I don't remember if it works or not and since I cannot compile it and test it right now I will leave that up to you. Sorry, but I don't remember much about getting a number from the motherboard. To my knowledge you can dump the BIOS info (I don't even remember how to do) and somewhere in there you can find the number of the motherboard but my memory on that area is very murky, so I cannot help you at all.
CString strPSN;
BOOL bPSNExists;
LARGE_INTEGER liPI64, liPI32;
__asm
{
mov eax, 01h;
cpuid;
mov liPI64.LowPart, edx;
}
if( (liPI64.LowPart & 0x00040000) > 0 )
bPSNExists = TRUE;
else
bPSNExists = FALSE;
if( bPSNExists )
{
__asm
{
mov eax, 01h;
cpuid;
mov liPI32.LowPart, eax;
mov eax, 03h;
cpuid;
mov liPI64.HighPart, edx;
mov liPI64.LowPart, ecx;
}
strPSN.Format( "%08x-%08x-%08x", liPI32.LowPart,
liPI64.HighPart, liPI64.LowPart );
}
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
See here.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hi!
Is there a way to convert key codes like VK_ENTER or DIK_ENTER (DirectInput), e.g. to a char/string "Enter"?
One more question: How do I save a WPARAM value (like the VK_ codes are passed) into a config file and read back the value?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
There is no ready-built conversion routine, but you can easily construct one yourself. Just compare the virtual-key value and format a CString object to represent the text string, like this
CString str;<br />
<br />
if ( vKey == VK_ENTER )<br />
str.Format("Enter");
The WPARAM value, in the 64-bit compatible environment, is typedeffed as UINT_PTR. This, on a 32-bit compiler, is typedeffed to standard type integer. Thus, the WPARAM value is an integer. You can directly convert the virtual-key code into an integer, then into a character string by using, for example, _itoa routine. Now, having the integer as a character string, you can write it into a file. The same process works just as good in reverse.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi all,
I have created a new ATL-COM Object (supporting MFC)
I've defined a method that returns the workspace of the current project.
Here is the code i am using:
CWinApp* pApp = AfxGetApp();
ASSERT(NULL != pApp);
CString szWorkspace(_T(""));
POSITION posdt = pApp->GetFirstDocTemplatePosition();
while (NULL != posdt)
{
CDocTemplate* pdt = pApp->GetNextDocTemplate(posdt);
if (0 == strcmp("CProjectWorkspaceDocTemplate",
pdt->GetRuntimeClass()->m_lpszClassName))
{
POSITION posdoc = pdt->GetFirstDocPosition();
if (NULL == posdoc)
break;
CDocument* pdoc = pdt->GetNextDoc(posdoc);
if (NULL == pdoc)
break;
szWorkspace = pdoc->GetPathName();
if (!szWorkspace.IsEmpty())
break;
}
}
trouble is , when i debug it this line returns NULL:
POSITION posdt = pApp->GetFirstDocTemplatePosition();
Why does it never succeed in getting the first doc template position?
can any1 help me here?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
According the MSDN Library:
POSITION GetFirstDocTemplatePosition( ) const;
Return Value
A POSITION value that can be used for iteration or object pointer retrieval; NULL if the list is empty.
Thus, logical deduction is that your document template is empty. Also, you're asking for the document template position from your ATL-COM application. In order to access the IDE from your application, see this extract from MSDN.
Add-ins are time- and labor-saving applications that attach to and are used within the IDE. They are COM objects that implement the IDTExtensibility2 Interface and communicate with the IDE through the automation object model contained in the EnvDTE type library (dte.olb)
Like said, you can use the provided automation object model (DTE) to access the Visual Studio IDE. This object model is located in the dte.olb file, and it's COM name is 'Microsoft Development Environment', added with a version number. You must use this approach if you're not writing an add-in. If you are, the DTE object is provided to you automatically.
To actually utilize the DTE object, here is a code fragment that first loads the Microsoft Development Environment 7.0 object, then requests a pointer to the running instance of Visual Studio .NET:
#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("7.0") lcid("0") raw_interfaces_only named_guids
#pragma warning( default : 4278 )
using namespace EnvDTE;
CComPtr<EnvDTE::_DTE> m_pDTE;
CLSID clsid;
CLSIDFromProgID(L"VisualStudio.DTE.7.1",&clsid);
CComPtr<IUnknown> punk;
HRESULT hr = GetActiveObject(clsid,NULL,&punk);
m_pDTE = punk; The same approach ideas should work just as well for other environments, just the version numbers change. See your own IDE documentation for the correct object name, or browse through the COM object adder.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
thanks for the reply...
you said : "If you are, the DTE object is provided to you automatically."
how? where?
can you show me an example?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|