News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Assembler in Windows OS

Started by Biterider, March 10, 2024, 01:12:02 AM

Previous topic - Next topic

Biterider

Hi
Discussing WinOS sources with a friend of mine, I remembered that some years ago the NT5 (~WinXP) sources were leaked. Today they can be legally downloaded from Microsoft's repository here https://github.com/tongzx/nt5src

If you download it and search for dir .asm files, you will find a ton of gems. Granted, they are from older times, but still very interesting.

There are whole chunks of code that our greedy specialists will dissect and analyse to finally give their verdict.

Some things I found are the implementation of critical sections, GDI procedures, x87 emulation, the cruntime memcpy, memcmp, etc. etc.

You could spend hours reading this fascinating stuff.  :biggrin:


Biterider


fearless

That and the ReactOS are good sources of information related to all things win32 api related: https://github.com/reactos/reactos

How the various standard and common controls are created: edit, listbox, combo, listview, treeview, richedit etc.

Could be that the richedit control is of particular interest to jj2007 - who could take the source and adapt it further or fix some issues?

jj2007

Quote from: fearless on March 10, 2024, 02:18:10 AMCould be that the richedit control is of particular interest to jj2007 - who could take the source and adapt it further or fix some issues?

Guess what? I already looked at it... :biggrin:

But my C is rusty, and I can't find assembler files in the RichEdit section. That archive is huge, over 2GB compressed. I wanted to search for *.asm files inside nt5src-master.zip, but UnzipInit gives me HeapAlloc error. One of the pretty rare occasions where 32-bit applications meet their limits :cool: 

My 7-zip does not have a search function, strange. In the end I had to extract everything, and found some files (sorted with largest files on top - 96027 bytes for ntfsn98.asm):
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\ntfs\i386\ntfsn98.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\ntfs\i386\ntfsboot.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\etfs\i386\etfsboot.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\fat\i386\fat32nec.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\fat\i386\fat32bt.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\fat\i386\fatboot.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\fat\i386\fatnec98.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\mbr\i386\x86mboot.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bd\i386\trap.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bootcode\etfs\i386\bootfix.asm
D:\WinXpSource\Source\XPSP1\NT\base\boot\bd\i386\state.asm
D:\WinXpSource\Source\XPSP1\NT\admin\wmi\wbem\providers\smbios\smbdpmi\startup.asm

NoCforMe

Wow. A treasure trove for sure. Haven't looked yet but will for sure.
Assembly language programming should be fun. That's why I do it.

LiaoMi

Quote from: Biterider on March 10, 2024, 01:12:02 AMToday they can be legally downloaded from Microsoft's repository here https://github.com/tongzx/nt5src
Hi Biterider,

I don't think it's legal, they're just tired of deleting it :)

NoCforMe

I wonder about that. Seems to me that Micro$oft is pretty aggressive in protecting its intellectual property, so if they know it's there, they're probably OK with it, since it's legacy code.

My guess, anyhow.
Assembly language programming should be fun. That's why I do it.

sinsi

Quote from: jj2007 on March 10, 2024, 06:13:39 AMMy 7-zip does not have a search function, strange.
View -> Flat View then View -> Type will sorta sort them.

1430 / 302535 are .asm

jj2007

Quote from: sinsi on March 10, 2024, 12:57:36 PM1430 / 302535 are .asm

That is a bit more than the handful found after extracting everything (reply #3). I had the feeling that 7-zip had some problems; my XPSP1 folder is "only" about 530MB... oh well :cool:

Biterider

Hi
Still looking at some interesting assembler code :biggrin:
I found a syntax that I had never seen before

  lea r10, 8[rax]
Did you know that this is equivalent to
  lea r10, [rax+8]
Biterider

greenozon

For those who look for assembler - it's possible to explore it right on the GH repo
how?
press '/' then type in .asm
it'll give you 2K+ files :)

2.4k files
 (103 ms)
2.4k files
in
tongzx/nt5src
(press backspace or delete to remove)


NoCforMe

Nifty, I'm sure, but it looks as if you have to be signed up with GitHub for that to work.
Assembly language programming should be fun. That's why I do it.

Biterider

Hi
For those of you who remember the old fdiv pentium bug (Pentium_FDIV_bug), here's a historical gem: https://github.com/tongzx/nt5src/blob/master/Source/XPSP1/NT/base/crts/fpw32/tran/i386/adj_fdiv.asm

The file contains references to the intended course of action that MS intended to take to resolve the problem. Microsoft software developer James "Jamie" Warren MacCalman was responsible for implementing Intel's workaround.

Biterider

FORTRANS

Hi,

Quote from: Biterider on March 17, 2024, 01:15:03 AMFor those of you who remember the old fdiv pentium bug (Pentium_FDIV_bug), here's a historical gem:

  Well the assembly code that points to is rather beyond me.
But I did take a look because I own (owned?) one of those
Pentiums.

Regards,

Steve N.

zedd151

Two of my favorite programs from Windows xp that I still use to this day are mspaint.exe and freecell.exe.
I occasionally use sol.exe as well.

Very simple programs that perform as expected without a lot of bells and whistles.   :azn:

So of course, I had to look at the sources for those. Thanks for posting this.

zedd151

Quote from: Biterider on March 11, 2024, 04:43:24 AMI found a syntax that I had never seen before

  lea r10, 8[rax]
Did you know that this is equivalent to
  lea r10, [rax+8]
I just noticed this. We often have new members posting in rather odd syntax. I usually attributed it to them coming from another language (which might use different syntax).
It really goes against my grain to see sources like that. I am so set in the 'usual' Masm32/64 way of doing things.  :tongue: