Is there an intrinsic to detect that program on virtual pc or native pc. I have a function to do this with inline assembler but to do this on 64 bit I need intrinsics because no 64bit support for inline assembler.
Regards,
T H K
3 3692
You could fumble through the op-codes and just in-line code them as hex constants in your in-line assembler.
I've used this sort of ugly "fix" before to use in-line assembly, when the full op-code set is not supported.
It works, but be careful how you go about it.
Alternately, and I think this is the better way, create a funtion using assembly language (e.g. VirtualMachineTest.asm), build it, create a header file to declare it (e.g. VirtualMachineTest.h), have your C++ program call the function, and add the object module to your linker parameters.
Good Luck!
Thanks Oralloy,
I'm going on 2nd way now looking to convert this code :)
bool IsInsideVMWare(void)
{
bool rc = true;
__try
{
__asm
{
push edx
push ecx
push ebx
mov eax, 'VMXh'
mov ebx, 0 // any value but not the MAGIC VALUE
mov ecx, 10 // get VMWare version
mov edx, 'VX' // port number
in eax, dx // read port
// on return EAX returns the VERSION
cmp ebx, 'VMXh' // is it a reply from VMWare?
setz [rc] // set return value
pop ebx
pop ecx
pop edx
}
}
__except(filter(GetExceptionCode()))
{
rc = false;
}
return rc;
}
But here is the problem now, how can i declare a boolean "rc" and how return value? Actually I'm not sure i need these.
toquikan,
You need to have a return of some sort. Either you will have to save it in a variable that is shared with your C++ code, or you will have to do a return code.
My suggestion is that you find a x64 assembly code example and use that as the basis of your code. If I remember from my x86 code, the integer return value goes into a standard register. If you declare the function as returning bool in C++, it should work just fine.
So you will have a header module like this:
IsInsideVMWare.h - //
-
// IsInsideVMWare.h
-
// function to detect host operating environment - inside VM ware or not
-
//
-
-
#if !defined(__ISINSIDEVMWARE_H__)
-
#define __ISINSIDEVMWARE_H__
-
extern "C" bool IsInsideVMWare(void);
-
#endif
And your ASM module will be appropriately strucutred.
As I recall, there are special name conversion conventions under Microsoft's compilers for "C" code function names. I believe that the name you'll have to export from your ASM module is _IsInsideVMWare (note the prefixed underscore). But, please don't hold me to this.
Luck!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jole |
last post by:
Hi
I'm writing a program that needs to read from a file. In order for the
program to be robust, it should somehow check that the file isn't corrupt,
or stuffed in any way. For example, that...
|
by: Jay |
last post by:
I'm sure this is a really dumb question, but how do you detect a variable
type in Python?
For example, I want to know if the variable "a" is a list of strings or a
single string. How do I do...
|
by: raptor |
last post by:
hi,
how to detect opera..it seems that even opera8 doesnt support
xmlhttp fully (.i.e. sendRequestHeader). I ask this 'cause opera
seems to mimic IE, at least in the preferences ?!
I havent...
|
by: athens.gr. |
last post by:
VIRTUALIZATION ENGINE CONSOLE A RUNTIME 1.1 - IBM (3 CDs), WEBSPHERE
BUSINESS INTEGRATION CONNECT ADVANCED v4.2.2 - IBM, other 16,000
more CDs,
(free donge)! No time limitation!
...
|
by: D. Shane Fowlkes |
last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a
SQLDataReader and filling in Labels with the retrieved (single) record.
However, how can I prevent from getting errors when a field...
|
by: regtrashcan |
last post by:
I have a webpage that detects whether Shockwave Player is installed and
the version number. The javascript/vbscript that I use has worked fine
until the latest release of the Shockwave Player. I am...
|
by: VK |
last post by:
I wandering about the common proctice of some UA's producers to spoof
the UA string to pretend to be another browser (most often IE).
Shouldn't it be considered as a trademark violation of the...
|
by: Sandeep |
last post by:
Hi,
I've an executable which displays/edits some user specific settings and do
some changes in %programfiles% folder as well.
XP:
It works fine 'coz you can change the user specific settings...
|
by: wilkinsonr |
last post by:
Hi All,
This is the situation. I have a porgram that is in a sub-dir of
program files that has an auto-updater. This updater needs to over
write both exe's and data files. If the user is not an...
|
by: ethangk |
last post by:
Hey,
Im using visual studio 2008, if I add a reference to the project references, but don't call it, using the "using" statement, and then test it out on a computer that doesn't have it, will that...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |