News:

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

OS Info Dump

Started by dedndave, July 28, 2009, 01:41:48 PM

Previous topic - Next topic

dedndave

originally, i had not intended to ID windows 1 or 3
after some thought, they are capable of running 32-bit code (well, 3 is at least), so let's try and ID them

in 16-bit code, we could use INT 21h to get the version
or, we could examine the PSP to find the environment block and read the variables
neither of those methods work for 32-bit code

i know very little about win 3
i don't even know if it has a registry - lol
if it does, we could use a compatible registry query api call to read some values in the registry and ID the windows version
i have googled my face off trying to find info - lol
maybe you you guys that have win 3 systems could find the API function and the registry values for us ?

sinsi

Windows 3.x was all 16-bit exe's (NE instead of PE). You could use 32-bit registers but all api calls were to 16-bit dll's.
Win32s came along, with 32-bit dll's but not much worked on it since it was a very small subset of what we think of as the win32 api (nt 3.1 and beyond).

Forget about win3.x - it's only sad people like me using it in a vm, but it is funny seeing the internet in ie5 (win3.x was a c*** to get tcp/ip working)
Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

this program uses the PE format and it runs under 3.11
well, it could if it didn't call API functions that weren't supported - lol
i was thinking of adding a simple test at the beginning to detect 3.11/earlier
not having it around to play with, i dunno how to write it
if 3.11 has a registry, i am guessing i could use RegOpenKey and RegQueryKey (maybe not Reg...Ex)
all i need is key\subkey\value(s)
i could then avoid the calls that make it crash

FORTRANS

Hi Dave,

   Results from the dark ages:

- - -

WinOS2 3.1 (Windows 3.1 under OS/2 rather than DOS)

{Popup box}
Win32s - Error
A:\OSINFO23.EXE: Invalid format

{Popup box}
Unexpected error: 23

- - -

Windows for Workgroups 3.11 (DOS 6.2x)

{Popup box}
Win32s - Error
A:\OSINFO23.EXE: Invalid format

{Popup box}
Cannot run OSINFO23.EXE

- - -

Regards,

Steve N.

dedndave

ohhhhhhhhhhhhhhhhhhhh
are you saying that no PE programs can run under 3.11 ???
even if it is a simple "hello world" ?

is this correct ?
the win32s extension allows PE format programs to run

Slugsnack

that's what the dos stub tells you. probably something like "This program cannot be run in DOS mode"

see hex dump


dedndave

yes, but that stub is not being executed - instead, win 3.1 says "invalid format" and "error 23"
it is difficult to find information for older OS's
from what i can gather, wind32s should be loaded to run 32-bit apps
but i can find no mention of the PE format with win32s

FORTRANS

Hi,

   Some 32-bit programs are supposed to run under Win32s.
And some did back in the old days.  But most evolved to not
run.  However, I don't really know the rules.  Maybe I can
look into it...  Maybe search the news groups...

Steve N.

dedndave

well, the questions are these, Steve
will win 3.11 without win32s run a PE format exe ?
will win 3.11 with win32s run a PE format exe ?

if so, it would be nice to ID win 3
there must be a registry entry
or, perhaps, i can read a file in C:\Windows (like win.ini or something) that will always ID win 1/3

MichaelW

Windows 95 OSR1:

DednDave OS Info Dump Ver 2.03

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"Version"="Windows 95"
"VersionNumber"="4.00.950"
"ProductName"="Microsoft Windows 95"
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"="a"
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"="18796-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Key not found)

OSVERSIONINFOEX Structure:

       Version.Build: 4.0.67109814
         Platform ID: Win32 on Windows 95
         CSD Version:


At least the early versions of Windows 95 do not include msvcrt.dll, but I was able to get around this by renaming the included msvcrt20.dll to msvcrt.dll.
eschew obfuscation

dedndave

good job
the crt is only used for things like "print" and "inkey"
it won't be part of the final routine

FORTRANS

Quote from: MichaelW on August 02, 2009, 08:35:45 PM
At least the early versions of Windows 95 do not include msvcrt.dll, but I was able to get around this by renaming the included msvcrt20.dll to msvcrt.dll.

   I copied msvcrt20.dll to msvcrt.dll in windows 3.11, but no changes
noticed in the failures.

Steve

dedndave

will it run  PE format "hello world" using WriteFile to output to screen ?
this program is attached...

        .386
        .MODEL     FLAT,STDCALL
        OPTION     CASEMAP:NONE

        INCLUDE    \masm32\include\windows.inc
        INCLUDE    \masm32\include\kernel32.inc
        INCLUDELIB \masm32\lib\kernel32.lib

        .DATA

TextMsg db 'Hello Steve',0Dh,0Ah

        .DATA?

RdWrCnt dd ?

        .CODE

_main   PROC

        INVOKE  GetStdHandle,
                STD_OUTPUT_HANDLE

        INVOKE  WriteFile,
                eax,
                ADDR TextMsg,
                SIZEOF TextMsg,
                ADDR RdWrCnt,
                NULL

        INVOKE  ExitProcess,0

_main   ENDP

        END     _main


[attachment deleted by admin]

FORTRANS

Hi Dave,

   No go here on 3.11.  I'm beginig to wonder how
the FREECELL.EXE runs.

Regards,

Steve N.

dedndave

well, it appears it is the PE format
of course, i do not see a file specifically named "kernel32.dll"
perhaps the win32s install has such a file
at this point, i am going to draw the line at win95 and call it "good", as Sinsi suggested
thank you Steve and Sinsi both for all your assistance