News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Detect Windows OS

Started by Parse, August 19, 2005, 01:42:11 PM

Previous topic - Next topic

Parse

Hi,

What is the smallest way to detect whether the computer you're running on is win9x or winNT+.

call [GetVersion]
cmp eax, 80000000h
jb short win9x


that's what i've got So Far.

edit: Ok not the smallest way, but another way. I also use the checking of whether the RegisterServiceProcess Api can be found.

I'm looking for a better way. Oh, and not using GetVersionExA

P1

In real estate, it's location, location, location.

In programming, it's the need, the need, the need.

Please help us with the context of this request and the need.  Because I have seen too many times, where we are guessing at what you want, when we know the need, we can give a more appropiate answer.

Regards,  P1  :8)

diablo2oo2

one way is to check for an API which is only avaible on NT systems.

invoke GetModuleHandle,chr$("kernel32.dll")
invoke GetProcAddress,eax,chr$("UpdateResourceA")
.if eax==0
;not NT system...
.endif

Parse

Quote from: P1 on August 19, 2005, 02:05:19 PM
In real estate, it's location, location, location.

In programming, it's the need, the need, the need.

Please help us with the context of this request and the need.  Because I have seen too many times, where we are guessing at what you want, when we know the need, we can give a more appropiate answer.

Regards,  P1  :8)

I'm just trying to optimize a program. It branches off at some point, where on one side it uses NT only Apis, and on the other 9x apis. It's just for fun and to learn something. I was hoping you guys could show me some cool secret asm tricks to do this.

Petroizki

assume fs:nothing
cmp dword ptr fs:[30h], 0
js win9x


10 bytes...  :lol

Mark Jones

Quote from: Petroizki on August 20, 2005, 04:29:59 AM
assume fs:nothing
cmp dword ptr fs:[30h], 0
js win9x


10 bytes...  :lol

Hi Petroizki, what does that compare against, Win9x and NT? What about 2K and XP? :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Petroizki

Quote from: Mark Jones on August 20, 2005, 06:08:43 AMHi Petroizki, what does that compare against, Win9x and NT? What about 2K and XP? :)
NT+ vs. 9x.
2k and XP are NT derived OS's, so they are identified as NT too. :wink