The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: dedndave on July 28, 2009, 01:41:48 PM

Title: OS Info Dump
Post by: dedndave on July 28, 2009, 01:41:48 PM
i am trying to collect information about the different OS's so i can ID them
your help would be greatly appreciated
see the attached program - source included
try to be specific, like "gold edition" or "64-bit"  (actually, i think the 64-bit info is elsewhere - i will work on that)

my OS: Windows XP (Pro) Media Center Edition 2005, sp2

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_rtm.040803-2158"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="4.0"


EDIT- update - added "ProductId" with the product key portion X'ed out
EDIT - version 2 - added GetVersionEx
EDIT - version 2.01 - added preliminary support for win95/98/98se/ME
EDIT - version 2.02 - modified win95/98/98se/ME so that the os version info structure size is set to 148 for older OS's
EDIT - version 2.03 - added version to banner - overwrite "Press any key to exit" for shorter screen


[attachment deleted by admin]
Title: Re: OS Info Dump
Post by: UtillMasm on July 28, 2009, 02:10:09 PM
C:\>OSinfo.exe

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows Vista (TM) Ultimate"
"CurrentVersion"="6.0"
"CurrentBuildNumber"="6002"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 2"
"BuildLab"="6002.lh_sp2rtm.090410-1830"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="5.0"

Press any key to exit
Title: Re: OS Info Dump
Post by: fearless on July 28, 2009, 03:04:19 PM
Windows XP Home Edition with Service Pack3 (32bit)

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 3"
"BuildLab"="2600.xpsp_sp3_gdr.090206-1234"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Key not found)
Title: Re: OS Info Dump
Post by: dedndave on July 28, 2009, 03:14:38 PM
thank you UtillMasm and fearless
i don't see a way to differentiate Home editions from Pro editions
Title: Re: OS Info Dump
Post by: fearless on July 28, 2009, 03:19:26 PM
Look for the Product ID as well, here is a link that explains what the start code of the product ID means:

http://wiki.lunarsoft.net/wiki/Product_IDs

Mine is 76477-OEM-0012345-67890

so 76477 seems to indicate the following: Windows XP Home OEM SP2     VRMHOEM_EN     4-08-04 12:00     76477     OEM

I remember installing XP which has SP2 already packaged with it, when i bought my new pc and put it together myself, and then i updated to SP3 once it was up and running.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId it has then to be converted to the 76477-OEM-0012345-67890 code. I think i have some code or some bookmarks somewhere on how that is done. Ill try and dig it out for you later on.


Edit: ok Dave, cheers for that, i edited out my key info, just in case ;-)
Title: Re: OS Info Dump
Post by: dedndave on July 28, 2009, 03:21:56 PM
you should remove that info fearless (or at least, the part after OEM) - but thank you
maybe i will add it and only show the first part

EDIT - very helpful link - thanks  :U
Title: Re: OS Info Dump
Post by: dedndave on July 28, 2009, 03:44:17 PM
i know how to read the binaries
but, don't you have the same info under this value ?

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductId"="76477-OEM-1234567-12345"
Title: Re: OS Info Dump
Post by: dedndave on July 28, 2009, 04:36:57 PM
ok - i updated the program so it displays the first 2 parts of "ProductId"
the last 2 parts are X'ed out to hide the product key information
as always, i included the program source

My OS: Windows XP (Pro) Media Center Edition 2005, sp2

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_rtm.040803-2158"
"ProductId"="76487-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="4.0"

http://www.masm32.com/board/index.php?action=dlattach;topic=11963.0;id=6522
Title: Re: OS Info Dump
Post by: fearless on July 28, 2009, 05:11:07 PM
Yep, missed that in the reg, was looking at DigitalProductID by mistake. But you got the right one anyhows :D
Title: Re: OS Info Dump
Post by: bruce1948 on July 28, 2009, 06:51:38 PM

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 3"
"BuildLab"="2600.xpsp_sp3_gdr.090206-1234"
"ProductId"="76477-OEM-XXXXXXX-XXXXX"

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



Oriiginal install XP home SP2.
Title: Re: OS Info Dump
Post by: Slugsnack on July 28, 2009, 07:58:32 PM
MSDN server 2008 enterprise SP2 :


DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows Server (R) 2008 Enterprise"
"CurrentVersion"="6.0"
"CurrentBuildNumber"="6002"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 2"
"BuildLab"="6002.lh_sp2rtm.090410-1830"
"ProductId"="92516-082-XXXXXXX-XXXXX"

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

Press any key to exit
Title: Re: OS Info Dump
Post by: jj2007 on July 28, 2009, 09:47:21 PM
XP Home SP2

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_gdr.070227-2254"
"ProductId"="76434-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Key not found)
Title: Re: OS Info Dump
Post by: FORTRANS on July 28, 2009, 10:25:21 PM
Hi,

   Two older ones, Windows 2000 and 98 <g>.


DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows 2000"
"CurrentVersion"="5.0"
"CurrentBuildNumber"="2195"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 4"
"BuildLab"=(Value not found)
"ProductId"="51873-OEM-XXXXXXX-XXXXX"

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

Press any key to exit

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=(Value not found)
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"=(Value not found)

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

Press any key to exit


Cheers,

Steve N.
Title: Re: OS Info Dump
Post by: dedndave on July 28, 2009, 11:02:16 PM
uh oh - i am gonna hafta find something for win95/win98/win98se/winME
NT and OS2 are gonna be hard to ID also - lol
did anyone actually ever buy and use OS2 ?
Thank You, Everyone !   :U
keep em coming, guys
Title: Re: OS Info Dump
Post by: GregL on July 28, 2009, 11:08:32 PM
Windows 7 Ultimate x64 (RC)

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7100"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7100.winmain_win7rc.090421-1700"
"ProductId"=(Value not found)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"


ProductId actually does exist.


Title: Re: OS Info Dump
Post by: dsouza123 on July 28, 2009, 11:27:00 PM
XP Pro SP2 x86 32 bit

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_gdr.090206-1233"
"ProductId"="76487-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Key not found)
Title: Re: OS Info Dump
Post by: Wistrik on July 29, 2009, 05:36:01 AM
Hello,

My one and only installed OS: Windows Vista 64-bit Ultimate SP2


DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows (TM) Vista Ultimate"
"CurrentVersion"="6.0"
"CurrentBuildNumber"="6002"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="6002.lh_sp2rtm.090410-1830"
"ProductId"=(Value not found)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="5.0"

Press any key to exit


Some notes:
- I don't have "SubVersionNumber" in my registry so the display is correct for that line.
- My "CSDVersion" is actually "Service Pack 2"
- In addition to "BuildLab" there is also "BuildLabEx" which for me is "6002.18005.amd64fre.lh_sp2rtm.090410-1830"
- My "ProductId" exists with a 5-3-7-5 digit grouping starting with 89587. There is no "OEM" string embedded.
- There is an "EditionId" which for me is "Ultimate".
- There is a "CSDBuildNumber" which for me is "1621".

On an interesting note, when I run this from within the archive (7zip manager), rather than running the one I extracted to a folder as above, I get:

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="6002.lh_sp2rtm.090410-1830"
"ProductId"=(Value not found)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="5.0"

Press any key to exit

Title: Re: OS Info Dump
Post by: ToutEnMasm on July 29, 2009, 06:17:10 AM
Quote
DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 3"
"BuildLab"="2600.xpsp_sp3_gdr.090206-1234"
"ProductId"="55711-640-XXXXXXX-XXXXX"

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

Press any key to exit


Why not use the GetVersionEx function ?,result follow


Quote
Microsoft Windows XP Professional Build Service Pack 3 2600
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 11:30:48 AM
Wistrik,
with Vista 64, the registry we are interested in is located in another hive
i can't recall the name - wow64 or something like that
some of the values are not readable because of uac
if you run the program as the administrator, it may give different results
right-click on the command prompt - run as administrator - then, with that console opened, run the OSinfo.exe program

this info is for win 7, but much of it may apply for vista 64, as well

The Windows XP Service Pack 2 (SP2) compatibility mode allows an application to work as it did on Windows XP SP2. To run an application in this mode, right-click the application's executable file or icon and open the Properties property sheet. Click the Compatibility tab and select Run this program in compatibility mode for Windows XP (Service Pack 2).

Security restrictions enforced by User Account Control (UAC) might prevent applications that require administrative privileges from running properly, even if the user is a member of the Administrators group. To override UAC, a user with administrative privileges can run an application with elevated privileges by right-clicking the application's executable file or icon and clicking Run as administrator on the popup menu. The system displays a UAC dialog box, and the user can then click Allow to run the application with appropriate privileges.

of course, not all programs will be run with elevated privileges (or in compatibility mode, for that matter)
we may be able to use Yves' suggestion to get more info


Yves,
cool - i will add that to the program, as well
i see it is somewhat complicated (of course - lol)

http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx
Title: Re: OS Info Dump
Post by: sinsi on July 29, 2009, 11:53:42 AM
If you want OS info then yes, GetVersion/GetVersionEx is better, but still a real hassle if you're talking about win95+  :bdg
(just think how hard it is to get info from cpuid eh?).

The registry api behaves differently depending on your exe being 32-bit or 64-bit (same with file api's)
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 12:07:14 PM
i suppose that is another issue for GetVersionEx
a program that uses it won't run under OS's earlier that win2K
so - no need to ID them ? - lol
that is not what i wanted, really
i was hoping to write a routine that would run all the way back to win95

i guess it could be handled in a dll so that, once a minimum OS has been identified, the appropriate dll may be loaded
maybe there is a better way to select API's according to the current OS
i have already had a case where a program i wrote that uses AttachConsole would not function under win2K
it would be cool if i could selectively use that API call
Title: Re: OS Info Dump
Post by: UtillMasm on July 29, 2009, 12:41:02 PM
C:\>osinfo.exe

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7600.win7_rtm.090713-1255"
"ProductId"="00426-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"

Press any key to exit

C:\>
Title: Re: OS Info Dump
Post by: sinsi on July 29, 2009, 12:57:47 PM
>maybe there is a better way to select API's according to the current OS

Just use GetProcAddress to see if the function exists (GetDiskFreeSpace comes to mind, talking about 95).
You can fall back to a more primitive way (usually something without the 'Ex') or retire gracefully.
Title: Re: OS Info Dump
Post by: fearless on July 29, 2009, 12:59:41 PM
Looking at the API i think GetVersion will run on Win95. GetVersionEx is recommended for NT upwards it says in the old win32 api.hlp i have.

You could try GetProcAddress for 'GetVersionEx', if its there then use that, if not see if it has GetVersion, which is probably win95, 98, ME maybe? That combined with the reg keys will give you a good overview i think.

There is also the command VER, which i think goes back as far as DOS days. VER probably is a static exe that just lazily displays the version info when it was compiled, then again maybe MS werent that lazy and it actually goes off and fetches something, in WinXP etc it might just read the registry keys your program is reading. Could be another avenue to investigate.

Edit: just seen sinsi last post, sorry for duplicate idea/post.
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 01:06:15 PM
both GetVersion and GetProcAddress require win 2k minimum os
now, VER has some potential, i suppose
it is a console mode (internal) command - so no good for gui apps as it is
however, that gives me the thought of looking into command.com/command.exe/cmd.exe
i could have a look and see where they get the info
i have a machine set up for win98 (hafta knock the dust off it)
someplace, i have a win 95 cd, too - i can build a drive for that easy enough
i may even have win98se - seems logical, as i have another machine with that on it - lol
i never liked winME, so, if i had a cd for that, it was frisbee'd - lol - that'll teach me
i have never seen nor heard of anyone using os2 - lol
Title: Re: OS Info Dump
Post by: sinsi on July 29, 2009, 01:17:16 PM
>both GetVersion and GetProcAddress require win 2k minimum os

Don't believe msdn or the vista sdk - a whole slew of functions are now "2000 pro or better".
See if you can find the win32.hlp file - it used to come with the free version of delphi  :8)

Look at ReadFile - even now, the minimum is 2000! Suddenly, 95 can't ReadFile.

To run all of the windows versions on one computer, look at vmware (fast-ish, costs money) or even bochs (slow, free) and virtualpc (validation, free).
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 01:20:46 PM
i suppose that brings up the point - where is it that older os's are documented - lol
damn ms - i know they aren't going to give you any info on win 95
Title: Re: OS Info Dump
Post by: sinsi on July 29, 2009, 01:44:06 PM
Windows® Server 2003 SP1 Platform SDK Web Install (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en)
That was pre-vista (I think) but had some 64-bit stuff for xppro and none of this 'minimum 2000' stuff.
I've got it backed up somewhere, so I'll dig it up tomorrow and have a squizz.
Title: Re: OS Info Dump
Post by: FORTRANS on July 29, 2009, 01:48:51 PM
Quote from: dedndave on July 29, 2009, 01:06:15 PM
i have never seen nor heard of anyone using os2 - lol

Hi Dave,

  Well, I use(d) OS/2 in various versions.  Currently, mostly to read
newsgroups.

  BTW Win 3.11/Win32S did not like your program at all.  (Not at
all surprising though.)

Steve
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 02:09:00 PM
sinsi - cool - i got the 2003 sdk - i will put it on a diff machine, though
i dont want to screw this one up - lol - i got it working great with all the right stuff

FORTRANS
Steve - your house must be a museum like mine - lol
i have never even heard of win32s
Title: Re: OS Info Dump
Post by: sinsi on July 29, 2009, 02:27:21 PM
win32s? that was the only way you could edit/listen to all of the voices in Warcraft 2 (and make maps). DOS game but win32 tools - blizzard wizards, ahead of their time.
That win32.hlp is full of references to win32s.
Title: Re: OS Info Dump
Post by: dedndave on July 29, 2009, 02:38:24 PM
i remember warcraft, i think - maybe i am thinking of "world of warcraft" - my nephew plays that
i was always amazed by Starflight, if you remember those (electronic arts, i think)
they crammed a lot of stuff onto 2 360K floppies - lol

as for ID'ing different OS's:
notice that some information is gained from the fact that certain keys/values are NOT present
i.e. there is information present in its' absence

XP media center (mine)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_rtm.040803-2158"
"ProductId"="76487-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="4.0"

XP pro (dsouza123)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_gdr.090206-1233"
"ProductId"="76487-OEM-XXXXXXX-XXXXX"

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

they even have the same ProductId footprint
the absence of [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center] tells me it is XP pro
Title: Re: OS Info Dump
Post by: FORTRANS on July 29, 2009, 03:42:14 PM
Quote from: dedndave on July 29, 2009, 02:09:00 PM
Steve - your house must be a museum like mine - lol
i have never even heard of win32s

   Well, museum is a bit polite.  Win32s was an add-on to Windows
3.1x that was to be a lead into Windows 95, which was "supposed"
to be 32-bit.  Gave a 32-bit API (sorta) to run the new win 95 programs.

Steve
Title: Re: OS Info Dump
Post by: Wistrik on July 30, 2009, 12:03:42 AM
Thanks dedndave, I'm still trying to tame Vista; I've only had it since spring. My second output was because 7zip put itself into compatibility mode by default. I disabled that and now the output matches the first one. However, Administrator Rights has no effect on the first output I provided, so it could be UAC doing something in the background (I get no popups - and I don't have it disabled). Thanks for the other info, though I've already figured that out by trying to get various games to run (and later to modify them).
Title: Re: OS Info Dump
Post by: dedndave on July 30, 2009, 12:45:38 AM
have you looked at the wow64 hive ?
vista 64 ultimate seems to "virtualize" that part of the registry as it appears to external programs
i do not have a vista 64 machine to play with, so the details are a little unclear to me
Title: Re: OS Info Dump
Post by: fearless on July 30, 2009, 10:32:09 AM
Looking at the GetVersionEx api, in my old .hlp version it shows information for OSVERSIONINFO structure

typedef struct _OSVERSIONINFO{ 
    DWORD dwOSVersionInfoSize;
    DWORD dwMajorVersion;
    DWORD dwMinorVersion;
    DWORD dwBuildNumber;
    DWORD dwPlatformId;
    TCHAR szCSDVersion[ 128 ];
} OSVERSIONINFO;


Members

dwOSVersionInfoSize

Specifies the size, in bytes, of this data structure. Set this member to sizeof(OSVERSIONINFO) before calling the GetVersionEx function.

dwMajorVersion

Identifies the major version number of the operating system. For example, for Windows NT version 3.51, the major version number is 3; and for Windows NT version 4.0, the major version number is 4.

dwMinorVersion

Identifies the minor version number of the operating system. For example, for Windows NT version 3.51, the minor version number is 51; and for Windows NT version 4.0, the minor version number is 0.

dwBuildNumber

Windows NT: Identifies the build number of the operating system.
Windows 95: Identifies the build number of the operating system in the low-order word. The high-order word contains the major and minor version numbers.

dwPlatformId

Identifies the operating system platform. This member can be one of the following values:

Value Platform
VER_PLATFORM_WIN32s Win32s on Windows 3.1.
VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95.
VER_PLATFORM_WIN32_NT Win32 on Windows NT.


szCSDVersion

Windows NT: Contains a null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty.
Windows 95: Contains a null-terminated string that provides arbitrary additional information about the operating system.



On the MSDN site, there is more information, including how to detect if running under WOW64: IsWow64Process. Between the two sources, there seems to be 'extra' information that could be useful to you.

http://msdn.microsoft.com/en-us/library/ms724833%28VS.85%29.aspx
Title: Re: OS Info Dump
Post by: dedndave on July 30, 2009, 10:34:18 AM
wow - thank you fearless - great info
now, let me suck it all in - lol
Title: Re: OS Info Dump
Post by: dedndave on July 30, 2009, 06:59:44 PM
ok - i added GetVersionEx
the d/l is added to the first post of the thread
here is a link to that d/l...
http://www.masm32.com/board/index.php?action=dlattach;topic=11963.0;id=6531

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_rtm.040803-2158"
"ProductId"="76487-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="4.0"

OSVERSIONINFOEX Structure:

       Version.Build: 5.1.2600
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 2
Service Pack Version: 2.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation
Title: Re: OS Info Dump
Post by: bruce1948 on July 30, 2009, 07:11:26 PM

DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 3"
"BuildLab"="2600.xpsp_sp3_gdr.090206-1234"
"ProductId"="76477-OEM-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 5.1.2600
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 3
Service Pack Version: 3.0
          Suite Mask: 0000001100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Press any key to exit
Title: Re: OS Info Dump
Post by: lingo on July 31, 2009, 01:24:27 AM
DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7600"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7600.win7_rtm.090713-1255"
"ProductId"="89580-014-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"

OSVERSIONINFOEX Structure:

       Version.Build: 6.1.7600
         Platform ID: Win32 on Windows NT
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Press any key to exit
Title: Re: OS Info Dump
Post by: rags on July 31, 2009, 01:29:01 AM
Here's my info from Win XP Home sp2:


DednDave OS Info Dump

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_gdr.070227-2254"
"ProductId"="55277-OEM-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"=(Key not found)
Title: Re: OS Info Dump
Post by: dedndave on July 31, 2009, 01:57:45 AM
thanks rags - there is a newer version, but i think i can guess the values for XP Home Edition
the OSVERSIONINFOEX Structure info will probably be identical to Bruce's (except for sp2/sp3)
Title: Re: OS Info Dump
Post by: sinsi on July 31, 2009, 02:35:56 AM
Fired up the trusty vmware just for you dave...

95 OSR2 ------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=(Key not found)
"CurrentVersion"=(Key not found)
"CurrentBuildNumber"=(Key not found)
"SubVersionNumber"=(Key not found)
"CSDVersion"=(Key not found)
"BuildLab"=(Key not found)
"ProductId"=(Key not found)

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

OSVERSIONINFOEX Structure:

       Version.Build: 0.0.0
         Platform ID: Win32s on Windows 3.1
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000000000000
        Product Type: 0


98SE   ------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=(Value not found)
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"=(Value not found)

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

OSVERSIONINFOEX Structure:

       Version.Build: 4.10.67766446
         Platform ID: Win32 on Windows 95
         CSD Version:  A
Service Pack Version: 0.0
          Suite Mask: 0000000000000000
        Product Type: 0


NT4WS  ------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=(Value not found)
"CurrentVersion"="4.0"
"CurrentBuildNumber"="1381"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 6"
"BuildLab"=(Value not found)
"ProductId"="31097OEM002667761855"

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

OSVERSIONINFOEX Structure:

       Version.Build: 4.0.1381
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 6
Service Pack Version: 6.0
          Suite Mask: 0000000000000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation


2000PRO  ------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows 2000"
"CurrentVersion"="5.0"
"CurrentBuildNumber"="2195"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 4"
"BuildLab"=(Value not found)
"ProductId"="51873-OEM-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 5.0.2195
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 4
Service Pack Version: 4.0
          Suite Mask: 0000000000000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

WIN7 x64 ------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7100"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7100.winmain_win7rc.090421-1700"
"ProductId"="00447-321-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"

OSVERSIONINFOEX Structure:

       Version.Build: 6.1.7100
         Platform ID: Win32 on Windows NT
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Title: Re: OS Info Dump
Post by: dedndave on July 31, 2009, 02:58:27 AM
thanks, sinsi - that is a lot of good poop
i wonder what regsitry values i should look at to ID win 95/98/98se/ME
any suggestions ?
Title: Re: OS Info Dump
Post by: sinsi on July 31, 2009, 07:20:49 AM
A quick look at the 95 registry

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"ProductId"="24264-XXX-XXXXXXX-13217"
"SubVersionNumber"=" B"
"ProductName"="Microsoft Windows 95"
"Version"="Windows 95"
"VersionNumber"="4.00.1111"

heh, the X's are in the registry, not me.
Title: Re: OS Info Dump
Post by: dedndave on July 31, 2009, 08:38:24 AM
thanks sinsi
let me play with that one - i may do a conditional display so it only shows one set...
Title: Re: OS Info Dump
Post by: fearless on July 31, 2009, 01:34:14 PM
Couple more titbits of info i found that could be useful:


Determining NT 4.0 SP6 versus SP6a. To detect whether Service Pack 6a is installed if SP6 is detected, you can check to see if the following registry value is set to 1:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009\Installed


http://www.codeproject.com/KB/winsdk/osdetect.aspx - similar info as before but might be useful.


http://blogs.msdn.com/pusu/archive/2009/06/19/how-do-you-detect-if-running-os-is-windows-7-or-not.aspx
http://msdn.microsoft.com/en-us/library/ms725491%28VS.85%29.aspx (overview of use of VerifyVersionInfo())

http://msdn.microsoft.com/en-us/library/ms724429%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx
Title: Re: OS Info Dump
Post by: dedndave on July 31, 2009, 02:30:12 PM
thanks again, fearless
the version number almost does the job for us
i may use that as the basic value, then append it with additional information
as always, ms leaves out just enough information to make us work for it - lol
Title: Re: OS Info Dump
Post by: dedndave on August 01, 2009, 02:13:27 AM
i have again updated the program (ver 2.01)
this time, i added preliminary support for win95/98/98se/ME as per sinsi
if you are running win 2K or later, you will see no difference from previous runs
if you are running win95/98/98se/ME, a different Key name is used
that is, if it works - lol - it will be interesting to see it run on 95/98/ME (maybe even win 3.1 and OS/2)

i have updated the first post of the thread with the new d/l
the source file is included
here is a shortcut to the version 2.01 d/l
http://www.masm32.com/board/index.php?action=dlattach;topic=11963.0;id=6534
Title: Re: OS Info Dump
Post by: sinsi on August 01, 2009, 06:38:55 AM
95 OSR2 again

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"Version"="Windows 95"
"VersionNumber"="4.00.1111"
"ProductName"="Microsoft Windows 95"
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"=" B"
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"="24264-XXX-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 0.0.0
         Platform ID: Win32s on Windows 3.1
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000000000000
        Product Type: 0

now it's more than 25 lines so your "DednDave OS Info Dump" doesn't show  :boohoo:


edit: I put an error check after GetVersionEx which returned 127 "ERROR_PROC_NOT_FOUND"
edit2: 95 (and win32s I assume) uses OSVERSION and fail when the struc size isn't 148.
Title: Re: OS Info Dump
Post by: sinsi on August 01, 2009, 07:25:22 AM
OK, forcing the struc size to 148 produces this

OSVERSIONINFOEX Structure:

       Version.Build: 4.0.67109975
         Platform ID: Win32 on Windows 95
         CSD Version:  B
Service Pack Version: 0.0
          Suite Mask: 0000000000000000
        Product Type: 0

The reason for the strange .Build number is
Quote from: Win32SDK.hlp
dwBuildNumber

Windows NT: Identifies the build number of the operating system.
Windows 95: Identifies the build number of the operating system in the low-order word. The high-order word contains the major and minor version numbers.

Title: Re: OS Info Dump
Post by: dedndave on August 01, 2009, 08:14:31 AM
ok - updated to version 2.02
the os version info structure size is set to 148 for older OS's
i would like to see the displayed values for 95, of course
i also noticed you have win98se
it would be greatly appreciated, sinsi
thanks for your help
http://www.masm32.com/board/index.php?action=dlattach;topic=11963.0;id=6535
Title: Re: OS Info Dump
Post by: sinsi on August 01, 2009, 08:36:22 AM

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"Version"="Windows 95"
"VersionNumber"="4.00.1111"
"ProductName"="Microsoft Windows 95"
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"=" B"
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"="24264-XXX-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 4.0.67109975
         Platform ID: Win32 on Windows 95
         CSD Version:  B



[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"Version"="Windows 98"
"VersionNumber"="4.10.2222"
"ProductName"="Microsoft Windows 98"
"CurrentVersion"=(Value not found)
"CurrentBuildNumber"=(Value not found)
"SubVersionNumber"=" A "
"CSDVersion"=(Value not found)
"BuildLab"=(Value not found)
"ProductId"="13909-OEM-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 4.10.67766446
         Platform ID: Win32 on Windows 95
         CSD Version:  A

Title: Re: OS Info Dump
Post by: dedndave on August 01, 2009, 09:04:51 AM
very cool sinsi - many thanks
that helped a lot
i bet noone in the forum has win ME
oh - maybe Steve (FORTRANS) does - he collects old stuff like me - lol (don't tell the wifee i said that)

i made a small update - added the version to the banner title
and i overwrite the "Press any key to exit" message at exit for a shorter screen
source included, as always.....
http://www.masm32.com/board/index.php?action=dlattach;topic=11963.0;id=6537
Title: Re: OS Info Dump
Post by: UtillMasm on August 01, 2009, 10:33:26 AM
Microsoft Windows Home Server 32bit Chinese simplified with Service Pack 2
DednDave OS Info Dump Ver 2.03

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows Server 2003"
"CurrentVersion"="5.2"
"CurrentBuildNumber"="3790"
"SubVersionNumber"=(Value not found)
"CSDVersion"="Service Pack 2"
"BuildLab"="3790.srv03_sp2_gdr.070926-1208"
"ProductId"="00182-OEM-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 5.2.3790
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 2
Service Pack Version: 2.0
          Suite Mask: 1000000100110001
        Product Type: Windows Server 2000/2003/2008

Press any key to exit
Title: Re: OS Info Dump
Post by: FORTRANS on August 01, 2009, 12:34:28 PM
Quote from: dedndave on August 01, 2009, 09:04:51 AM
i bet noone in the forum has win ME
oh - maybe Steve (FORTRANS) does

   Nope, I saw that one in use at work.  Had to help
restore that system way too many time.  Ick.  Plus
it wouldn't run some stuff that worked on 98.

   3.11, maybe 95, 98, 2000, XP, if needed.

Steve N.
Title: Re: OS Info Dump
Post by: dedndave on August 01, 2009, 02:29:01 PM
i would be interested in 3.1, Steve - out of curiosity

thanks UtillMasm - good to see a server run
if you would like an explaination of the Suite Mask pins...
http://msdn.microsoft.com/en-us/library/ms724833(VS.85).aspx
Title: Re: OS Info Dump
Post by: sinsi on August 01, 2009, 10:34:02 PM
Tried it in win311 with win32s, but it crashed windows - actually it rebooted the system. I got a flash of an error message from emm386 but couldn't see it.

edit: sorry, that was the old version. The new version doesn't work  :( but doesn't crash win311  :bg

Here are the screenshots of the errors.

[attachment deleted by admin]
Title: Re: OS Info Dump
Post by: dedndave on August 01, 2009, 11:43:00 PM
thanks again sinsi - lol
i didn't expect it to work, actually
if i knew how to detect win3 early, i would avoid making the GetVersionEx call or, at least, get the structure size right
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 12:50:13 AM
i found the following 3 tables for older OS's, and for media center\ident

Windows 95 retail, OEM     4.00.950                     7/11/95
Windows 95 retail SP1      4.00.950A                    7/11/95-12/31/95
OEM Service Release 2      4.00.1111* (4.00.950B)       8/24/96
OEM Service Release 2.1    4.03.1212-1214* (4.00.950B)  8/24/96-8/27/97 
OEM Service Release 2.5    4.03.1214* (4.00.950C)       8/24/96-11/18/97
Windows 98 retail, OEM     4.10.1998                    5/11/98
Windows 98, Security CD    4.10.1998A
Windows 98 Second Edition  4.10.2222A                   4/23/99
Windows 98 SE Security CD  4.10.2222B
Windows Me                 4.90.3000                    6/08/00
Windows Me Security CD     4.90.3000A
-------------------------------------------------------------------------------------------
   dwPlatformID dwMajorVersion dwMinorVersion dwBuildNumber
95       1             4              0            950
95 SP1   1             4              0      > 950 && <= 1080
95 OSR2  1             4            < 10         > 1080
98       1             4             10           1998
98 SP1   1             4             10      > 1998 && < 2183
98 SE    1             4             10         >= 2183
Me       1             4             90           3000

NT 3.51  2             3             51           1057
NT 4     2             4              0           1381
2000     2             5              0           2195
XP       2             5              1   

CE 1.0   3             1              0   
CE 2.0   3             2              0   
CE 2.1   3             2              1   
CE 3.0   3             3              0   
-------------------------------------------------------------------------------------------
Ident value v.s Windows Media Center version

< 2.7 = Windows XP Media Center Edition 2002
2.7 or 2.8 = Windows XP Media Center Edition 2004
3.0 = Windows XP Media Center Edition 2005
3.1 = Windows XP Media Center Edition 2005 with Update Rollup 1
4.0 = Windows XP Media Center Edition 2005 with Update Rollup 2
5.0 = Windows Vista
5.1 = Windows Vista with Media Center TV Pack 2008
6.0 = Windows 7
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 04:34:13 AM
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 ?
Title: Re: OS Info Dump
Post by: sinsi on August 02, 2009, 05:02:50 AM
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)
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 05:12:08 AM
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
Title: Re: OS Info Dump
Post by: FORTRANS on August 02, 2009, 02:42:49 PM
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.
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 03:44:41 PM
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
Title: Re: OS Info Dump
Post by: Slugsnack on August 02, 2009, 03:53:25 PM
that's what the dos stub tells you. probably something like "This program cannot be run in DOS mode"

see hex dump

(http://img7.imageshack.us/img7/7820/lalaooi.jpg)
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 03:59:16 PM
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
Title: Re: OS Info Dump
Post by: FORTRANS on August 02, 2009, 07:00:39 PM
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.
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 07:54:58 PM
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
Title: Re: OS Info Dump
Post by: MichaelW on August 02, 2009, 08:35:45 PM
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.
Title: Re: OS Info Dump
Post by: dedndave on August 02, 2009, 08:38:23 PM
good job
the crt is only used for things like "print" and "inkey"
it won't be part of the final routine
Title: Re: OS Info Dump
Post by: FORTRANS on August 03, 2009, 09:38:19 PM
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
Title: Re: OS Info Dump
Post by: dedndave on August 03, 2009, 11:03:29 PM
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]
Title: Re: OS Info Dump
Post by: FORTRANS on August 05, 2009, 12:36:31 PM
Hi Dave,

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

Regards,

Steve N.
Title: Re: OS Info Dump
Post by: dedndave on August 05, 2009, 02:50:18 PM
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
Title: Re: OS Info Dump
Post by: FORTRANS on August 06, 2009, 01:49:11 PM
Quote from: dedndave on August 05, 2009, 02:50:18 PM
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

   Checking for a "kernel32.dll", shows it among the missing.  Unless
it's hidden or somesuch.

Oh well,

Steve N.
Title: Re: OS Info Dump
Post by: sinsi on August 06, 2009, 02:08:54 PM
Well, they had to do some trickery to get win32s working on a 16-bit dos extender... :bdg

Look in the windows\system\win32s directory, that's where it lives - look at the exports for W32SCOMB.DLL (a 32-bit PE file).
Freecell works (32-bit PE which loads at 014B0000h or something (?)), but a simple program consisting of 'ret' gets the same 'invalid' error. Must be a linker/library problem.


[attachment deleted by admin]
Title: Re: OS Info Dump
Post by: dedndave on August 06, 2009, 02:59:06 PM
soooooo - it can work !
looks like i need to build a disk
(now, where did i put that DOS 6.22 disk set - lol)
thanks Sinsi
Title: Re: OS Info Dump
Post by: FORTRANS on August 06, 2009, 09:10:22 PM
Hi,

   I did a text search for "kernel32" in the \WINDOWS
directory and its subdirectories (plus the freecel directory).
Here is a list of the files that contain that string.

Steve

[attachment deleted by admin]
Title: Re: OS Info Dump
Post by: ChillyWilly on August 08, 2009, 11:25:15 PM

DednDave OS Info Dump Ver 2.03

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Windows 7 Ultimate"
"CurrentVersion"="6.1"
"CurrentBuildNumber"="7100"
"SubVersionNumber"=(Value not found)
"CSDVersion"=(Value not found)
"BuildLab"="7100.winmain_win7rc.090421-1700"
"ProductId"="00428-321-XXXXXXX-XXXXX"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center]
"Ident"="6.0"

OSVERSIONINFOEX Structure:

       Version.Build: 6.1.7100
         Platform ID: Win32 on Windows NT
         CSD Version:
Service Pack Version: 0.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Press any key to exit


by the way my way i was getting the product version for xp/2k was to read the produspec.ini

  ;a little trick to get the 2k/xp version from the produc.ini
  invoke  GetSystemDirectory, offset szSysDirFileName, MAX_PATH
  invoke wsprintf,addr inipath,addr iniglue,addr szSysDirFileName,CTEXT("prodspec.ini")
  invoke GetFileSize,addr inipath,NULL  ;if the ini file doesnt exist we get the product version from registry
    mov FileSize,eax
    inc eax
.IF eax >= 1
    invoke GetPrivateProfileString,CTEXT("Product Specification"),CTEXT("Product"),CTEXT("Product Version Not Found"), ADDR WinVersion , 64,addr inipath
                         invoke MessageBox,0,CTEXT("Product Version"),ADDR WinVersion,0
    invoke SetDlgItemText,hWin,IDC_EDITWINVER, ADDR WinVersion
    .else
                    invoke MessageBox,0,CTEXT("Not Xp/2k"),CTEXT("prodspec.ini not found"),0
                  .endif
Title: Re: OS Info Dump
Post by: zenggongfu on August 11, 2009, 01:34:29 AM
From China
DednDave OS Info Dump Ver 2.03

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"="Microsoft Windows XP"
"CurrentVersion"="5.1"
"CurrentBuildNumber"="2600"
"SubVersionNumber"=""
"CSDVersion"="Service Pack 2"
"BuildLab"="2600.xpsp_sp2_qfe.090206-1239"
"ProductId"="76481-640-XXXXXXX-XXXXX"

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

OSVERSIONINFOEX Structure:

       Version.Build: 5.1.2600
         Platform ID: Win32 on Windows NT
         CSD Version: Service Pack 2
Service Pack Version: 2.0
          Suite Mask: 0000000100000000
        Product Type: Windows 2000 Pro/XP/Vista Workstation

Press any key to exit
Title: Re: OS Info Dump
Post by: dedndave on August 11, 2009, 01:35:59 AM
thanks guys every little bit helps   :U
Title: Re: OS Info Dump
Post by: BATSoftware on August 12, 2009, 06:36:46 AM
PE programs will never run on a straight 3.1 system (without WIN32S). Why, simple, the loader cant read a PE image. A PE image is VERY different than an NE image. I know, I wrote a 16/32 resource hacker. Check the web for the number of 16bit resource editors/hackers....I found none...well there is 1 now!!!

http://home.comcast.net/~batsoftware/RES2RC/htm/RES2RC.htm
Title: Re: OS Info Dump
Post by: sinsi on August 23, 2009, 04:25:09 AM
I was looking at the discussion about functions and errors and thought about fasm (where you can build your own import section).
Anyway, looking at an example (pedemo) and right down the bottom is the line
section '.reloc' fixups data readable discardable       ; needed for Win32s
Here's the proof:
(http://i51.photobucket.com/albums/f395/sinsithedog/MS-DOS-2009-08-23-13-48-14.png)
Title: Re: OS Info Dump
Post by: dedndave on August 23, 2009, 04:30:44 AM
hiya Sinsi
i know they're in there - lol
but the tables are made backwards for error reporting (they are made for loading, of course)
it wouldn't be hard to find them, though
Title: Re: OS Info Dump
Post by: sinsi on August 23, 2009, 05:31:17 AM
OK, to get a PE working under win32s you need a .reloc section, which means adding "/fixed:no" to the link command line.
I can't get your win3test to work - I'm not sure that win32s supports console-mode apps.
Title: Re: OS Info Dump
Post by: dedndave on August 23, 2009, 11:06:49 AM
ok Sinsi - thank you for playing with it
that tells me that most modern software will not run under win 3.11
unless the programmer specifically targets that platform
and - yes - i had neve thought of it, but i never saw a "console" in win 3.11
that's because they didn't need one
you can exit the windows shell back out to DOS if you want to run a DOS-mode program