Tuesday, June 24, 2008

Notes for me .. in case i forgot where to find it ...

When you are searching for something ... you need to have the right keywords for it ...

Like for example I've read a very informative Microsoft TechEd document titled
"Writing Secure Native Code with Visual C++" a couple of years ago.

I'd been searching for a long time ... just to find out that it is not available online ... hehehhe

some excerpt

------------------------------------------------------------------------------------------------
By default, the older less-secure C runtime functions are declared to be deprecated in the C runtime library header files using the __declspec(deprecated) extended attribute syntax. To turn off the deprecation warnings for the older, less secure functions, you may define the macro _CRT_SECURE_NO_DEPRECATE. Alternatively, you may use the #pragma warning to disable individual warnings.

#define _CRT_SECURE_NO_WARNINGS
#pragma warning (disable:4996)

------------------------------------------------------------------------------------------------
Many of the new C runtime functions check incoming parameters for validity. Parameter validation includes checking for NULL pointers, checking that integral values are within valid ranges, and checking for valid enumeration values. If a problem is detected by the function, an invalid parameter handler is automatically called by the runtime library. The default invalid parameter handler provided by the C runtime raises and Access Violation exception. In Debug mode, an assertion is also raised.

The runtime library provides a function, __set_invalid_parameter_handler so that you may install your own function to respond to input parameter errors. Your function may terminate the application, or it may return control to the calling function that received the invalid parameters. The calling function will normally discontinue execution and set errno to an error code such as EINVAL to indicate invalid parameters. The calling function may use more specific values for errno, such as EBADF to indicate a bad file pointer was detected.
------------------------------------------------------------------------------------------------


Another site that I always use for reference is the site below ... for VMWare and Virtual PC detection stuff

http://chitchat.at.infoseek.co.jp/vmware/backdoor.html#top

Excerpt
===================================================
/* in Intel syntax (MASM and most Windows based assemblers) */
MOV EAX, 564D5868h /* magic number */
MOV EBX, command-specific-parameter
MOV CX, backdoor-command-number
MOV DX, 5658h /* VMware I/O Port */
IN EAX, DX (or OUT DX, EAX)

/* in AT&T syntax (gnu as and many unix based assemblers) */
movl $0x564D5868, %eax; /* magic number */
movl command-specific-parameter, %ebx;
movw backdoor-command-number, %cx;
movw $0x5658, %dx; /* VMware I/O port */
inl %dx, %eax; (or outl %eax, %dx)
===================================================

and also this one

http://www.codegurus.be/codegurus/Programming/virtualpc&vmware_en.htm

No comments: