appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Mar 31, 2007 5:47 pm Post subject: Detecting Compatibility Mode/Windows Vista |
|
|
Normally you would detect the OS using GetVersion or GetVersionEx. However, with "compatibility mode" the return values are faked. This program (can be easily made into a function in your favourite language) uses an alternative method of detecting vista, searching for an address that is only present in windows vista's version of kernel32.dll.
Fasm syntax- http://www.flatassembler.net
Assembles to the minimum legal PE size, 1024 bytes
| Code: |
format PE CONSOLE
include 'include\win32a.inc'
mov ebx, [exit]
push k32
call [GetModuleHandle]
push gp3
push eax
call [GetProcAddress]
test eax, eax
jz .nov
push yes
jmp .end
.nov:
push nos
.end:
call [puts]
call [getch]
xchg ebx, ebp
add esp, 4
ret
yes db 'Windows Vista detected!',0
nos db 'Doesn''t look like vista to me.',0
k32 db 'Kernel32.dll',0
gp3 db 'CreateMutexEx',0
data import
library kernel32,'Kernel32.dll',\
msvcrt,'msvcrt.dll'
import kernel32,\
GetModuleHandle,'GetModuleHandleA',\
GetProcAddress,'GetProcAddress'
import msvcrt,\
puts,'puts',\
getch,'_getch',\
exit,'exit'
end data
|
_________________
|
|