Showing posts with label stickies. Show all posts
Showing posts with label stickies. Show all posts

05 January 2022

C++ standard, Runtime and XP

C++ standard has been evolving much more like Java, or rather no more like C evolution, C++20 module remind me of Java 11 it make C++ "appreance" no more like what it used to be... I wonder how far Windows XP could get the lastest C++ standard toolchain. Lets revisit C++ standard progression

C++98 (formally C++03) has been what XP supported by Microsoft (with its peculiarity and quirks) from the free VS2005 to 2010 express editon.

C++11: GCC 5 (2015) Clang 3.8 and Embarcadero BCC 10.1 (2016) MSVC 2015
C++14: GCC 5 (2015) Clang 3.4 (2014) MSVC 2017
C++17: GCC 11 (2021) still missing from_chars FP mode because Win32 has no uselocale()
             MSVC 2019 16.4 shared_mutex (not available in XP target, only C++14 shared_timed_mutex)
C++20: MSVC 2019 16.10 (2021) since 16.8 its runtime breaks XP for the first time (last: 14.27.29114)

While those compilers arrive at the same state around 2015, now we see Clang lagged behind, GCC is struggling and MSVC is geting faster and faster.

In Windows XP context though, GCC seems the only hope for any "sort of" C++20 support considering they have the principle of having as cross-platform as possible rather than as native as possible codebase. Clang libc++already break XP when implementing C++17FS.

How about C runtime?
Now called UCRT, apparently it also strangely break XP too. Being versioned as Windows SDK's the last XP compatible is 10.1.18362.1, starting with 10.1.19041 ucrtbase.dll through api-ms-win-core-memory-l1-1-0.dll redirector is asking dll.VirtualAlloc, dll.VirtualQuery and dll.VirtualProtect from kernel32.dll which previously not prefixed with "dll." weird... Note that Visual C++ runtime installer usually bundled with much older 10.0.10586 UCRT (from Windows 10 1511).

30 March 2021

The state of Java 8 support for Windows XP

Java 8 has complex situation on the unsupported XP. Back in early versions, the installer will warn user that it require newer windows and may not functioning as specified if user proceed. Indeed things start to break one by one, as a software platform runtime it might not obvious when it works or not that's until we ask specific broken component otherwise JVM continue on happily.

These are several component that I notice breaks on XP.

U111: the last version where JavaFX component works

U241 and U242: the last version where crypto API works (sunmscapi), newer version require NCrypt (part of MS CNG alongside BCrypt)

U261/U262: add TLS 1.3 support (jsse) and since it is related to sunmscapi it's pointless for XP, also in this version java executables no longer runnable on XP as their PE header set against NT6. It can be fixed to run on XP but doing so will break digital signature.

In my experiment we could mix newer java binary with older working component e.g. JavaFX or Crypto API, as long as they replaced as whole (dlls and jars).

Another complication, U151/U152 is the last installable version and U201/U202 is the last Oracle version which allow commercial works. On recent non-installable version user can opt to use tar.gz format (manual install) which need manual java -jar invocation from cmd prompt.

The alternative openjdk aren't that good either, so far only AdoptOpenJDK provide 32-bit binary and they dont bundle brower plugin or JavaFX furthermore all version has PE header set to NT6 so they are not runnable on XP.

Java 8 scheduled to be supported until 2026 for openjdk and 2030 according Oracle. Too bad XP version ended too soon.

AFAIK now the only still updated Java that works on XP 32-bit is IBM J9 Java 7 which can be downloaded separately from Websphere albeit not as installer (need free account login) and this will last until 2022. Not much I would say.

18 December 2020

Windows XP on the limit

 What is the maximum processor XP support?

XP support up to 2-way SMP (2 sockets), with a maximum 32 logical processor cores in total or with HT/SMT disabled up to 32 physical processor cores. XP can fully utilise SSE processor such as Intel Westmere or AMD K10 and will/may run under newer processor but wont be able to use AVX/FMA.


What is the maximum memory XP support?

Since 1995 32-bit i686 Pentium Pro 150Mhz has 36-bit PAE to access up to 64GB, in 1998 Intel provide PSE-36 driver (similar to Gavotte Ramdisk) for Windows NT 4.0 to access upper memory as pagefile. Windows 2000 has PAE built-in, original XP/2003 support 37-bit PAE (a maximum of 128GB physical memory in accordance to 32-bit Xeon processor spec at the time) and fully enabled in Server 2003 datacenter at the cost of "bad" bundled driver removal, but then "revised" to 64GB because 32-bit Server 2008 can't do 128GB, meanwhile XP SP2 restricted to 4GB with all bundled driver preserved. These limits are artificial switch based on marketing or to reflect testing result. However within 128GB only up to 16GB can be normally used, the rest addresses need AWE. Regardless each 32-bit process still limited to a maximum 4GB address space or from user perspective it is more like 2GB maximum. x86_64 CPU PAE has been varied depends on timeline and target market such 39, 40, 46, 48, and 52-bit. Fully 37-bit PAE need 980MB (for address translation) within system VAS (1024-2048MB), in this case if /3GB (4GT) or /USERVA=3072 is set then nothing is left for system, so Windows limit PAE to 16GB furthermore /3GB may negate addressable memory by AWE.

At processes level additional memory tricks available for user VAS such PE large address aware flag (in conjunction with /3GB) and AWE which is similar to PAE at user VAS level. The PE's IMAGE_FILE_LARGE_ADDRESS_AWARE flag may allow a user process to use up to 3GB, an AWE capable program can claim chunks (each less than USERVA value, up to <128GB in total) of PAE memory and get each needed chunk swapped in and out within its USERVA range (2048-3072MB). Example of AWE program is 32-bit MS SQL server, Oracle DB and MySQL 4.1-5.0 the latter capable of up to 64GB AWE memory. Another technique to overcome user VAS limit is to have multiple child processes such in Chrome browser and ABBY OCR or employ multithreaded batch processing such in ppx2, "make", etc.

Pagefile, a virtual memory that reside in storage device can be specified as 16 4GB pagefiles or 64GB in total, overall 192GB of maximum combined memory in XP. Imdisk can use AWE to create virtual disk that in turn can host all possible pagefiles and/or as mountpoint/target for %TEMP%. Just because a system has a lot of RAM (>4GB) that doesn't mean pagefile can be turned off, in fact there can only be one usable <=2GB system VAS at any time which instanced together with user VAS in every 32-bit process, thus system resource could be depleted if it cut by huge PAE mapping. Pagefile will allow system to expand some cache and pool out of the confined system VAS which at worst is about <1GB in >4GB system with /3GB. This is contrast with 64-bit Windows situation at the scale of TB VAs which more than current average size of installed system memory.

32-bit processor which has 32-bit instruction is not necessarily also has 32-bit addressing (i386-i586) it can be more such as i686 or maybe less like some i286 variant including all current x86_64 processors. Memory limit has been a moot point when talking about 32-bit OS like XP, but workaround those limitations is what make it fun.


What is the maximum disk storage XP support?

While NTFS 3.1 can go up to 256TB, other limiters make a 256TB disk impossible. XP only support MBR disk which maxed at 2TB for 512b sector or 16TB for 4k sector which need proper 4Kn controller. Dynamic disk (stripe/span mode) support up to 32 512b sector MBR disk of total 64TB agregated disk storage. Note that BIOS/NTLDR do not support booting 4Kn disk neither GPT disk (accessible through third party driver such Paragon GPT). NTFS however allow mountpoint other NTFS volume as directory to combine space though it wont change the root volume size. The fastest non-raid disk on XP is SSD either through ahci m.2 pcie 3.0 such as Samsung SM951 or through dual port SAS12G such as Seagate Nytro, both up to 2.2GB/s transfer rate.


What is the maximum XP desktop/display can be?

XP desktop is a virtual screen at 32000*32000 size with maximum exposeable area of 128 Megapixel which make it somewhat "bigger" but also smaller than GPU limit of 16k*16k. A monitor is an inset that panning over that area. The 32K limit may come from DIB format limit which is signed 2^16 integer, not sure what 128 Megapixel limit is all about as such area at 32-bit color would "only" need half GB memory however many 32-bit image viewer known to have problem displaying >100MP image, Windows Picture and Fax viewer for example could display (full size) up to 131MP. There is little freeware called sdesk that allow you to "stroll" over entire virtual screen without extra monitors.

XP can manage/arrange up to 10 monitors some say 10 is also the limit of display adapter numbers (dual-GPU card is counted as 2). Because of this dual-head display driver often capable of abstract larger monitor by pre-joining (span mode) the two before reporting to Windows thus counted as one. XP allowed different vendor driver to coexist thus enabling non-accelerated "non-sync'ed" mosaic setup of heterogenous GPUs and monitors. VGA, DVI-DL (7.92Gb/s), HDMI1.4 (8.16Gb/s) and DisplayPort1.1 (8.64Gb/s) are supported in XP, with all digital ones should be capable of 32-bit color UHD @30hz (4*3840*2160*30) or 4k @24Hz or 2560x1600 @60hz.


What latest hardware technology that XP support?

(This info compiled from driver files and not necessarily tested)

10Gbps Ethernet: Intel 82598, x520, x540; Qlogic 8140/2, 8150/2; Emulex OneConnect 1010x, 1110x; Mellanox ConnectX I (all pcie 2.0)

10Gbps SATAe: ASMedia 106se

10Gbps USB3: ASMedia 1142-3142

12G SAS3: Areca 1226, 1883 (support 4Kn)

OpenGL 4.x, OpenCL 1.x: Intel HD/Iris Gen3-Gen4 (no OpenCL driver); AMD Terascale 2 - GCN 2 (Bonaire); Nvidia Fermi - Maxwell

Wifi 802.11ac, Bluetooth 4.2: Broadcom 43xx; Realtek 88xx

25 August 2012

Static library attempt for GTK

In my previous post when I had to make rsvg-view a static build, a complete set of static GTK libraries needed. GTK known to refuse being build as static library on Windows. Obviously there is lot good reason (be it Windows or not), GTK is a library with lots of addons (theoretically a GLib based one) so a modular/extensible approach chosen, then if I recall internationalization won't work unless in dll mode, then GTK is known using lot of settings files and modules scattered in etc-lib-share folder, then in version 3 there is DBus stuff which all of these make it almost a deal breaker for static build mode. Although some modules (found in pango, gdk-pixbuf, gtk) can be statically linked to main library, others are not (need modification) such as wimp theme engine.

For this minimalistic use case (rsvg-view) where basically a window with just 2 zoom buttons, a static build would be nice eh?

Oh well let's just get it on...
Firstly this is GTK-3 that I tried which should prompt a serious warning message about stability/maturity. Historically in version 2.x IMO there is only 3 stable, good or sane version for Windows: the last 2.12.x, 2.16.x and 2.24.x. I did try make static GTK-2 (2.24.10) however almost all but three tests mysteriously crashed during startup, here is one of that survived: testtreecolumns (unfortunately not LTO optimized so it's a bit too big)

The main thing that prevented static linking is multiple definition of dllmain. In case you're not aware, GLib starting with 2.30 support static build but broken in 2.32 since glib-init introduced but is trivial to fix. So based on how this static glib work we could also do the same to gdk-pixbuf, pango and lastly to gtk itself:

- override the Windows guard in configure script which prevent static build. hint: "DLL on Windows"
- make sure all possible and desired modules being "bundled" via configure
- initialize hmodule instances as null instead of uninitialized
- prevent dllmain from being compiled by adding #ifndef DLL_EXPORT
- assign declspec instances as nothing when #ifndef DLL_EXPORT (or create your own guard) instead of dllimport/dllexport (seems GTK-3 somehow omit this already)

note: DLL_EXPORT and PIC are common flags used by libtool during compilation, they are off when configured with: --enable-static --disable-shared

This way, path finding and internationalization still works as expected. Here is example of gtk3-demo in static binary: gtk3-demo.7z

It would great to bundling it in my MinGW distro... kinda rare to see C-based GUI library, not that C is good for GUI

07 July 2012

How to clean invalid clipboard data

Sometime for unknown reason suddenly I'm not able to do paste operation. It happening anywhere, in explorer (file content) or in editor (image/text content). It seems clipboard contained invalid data or sort of. Now I have to find a way to clear this data, naturally by copy (overwrite) new data into, but it doesn't work! Copy and cut operation also failed.

If I recall Windows have a clipboard viewer program which filename was abbreviated and I can't find that one either (probably available in Windows 98 only). Eventually found "clip.exe" which control clipboard content via command line.

Then invoke this command (from CMD):
echo off|clip

Yay clipboard content cleaned up :). So while GUI applications failed to cure it, clip.exe come to save... weird eh?

17 July 2010

Downloading huge file under slow dial-up modem

Today I'm progressing 70% of wikipedia download and I've found a good setting for downloading this 6GB monster of science. http://download.wikimedia.org/enwiki/20100622/enwiki-20100622-pages-articles.xml.bz2

When a download stuck for a long time it seems a sign that a corrupted data has take place. At least that what happen during the first 800MB download using Free Download Manager (FDM). I switch to curl after the prolonged glitches didn't stopped, and continue the unfinished download. After patching 10 corrupted areas, I found later that curl didn't hampered by the same issue. And here is how...

30 June 2010

How To Make Bootable DVD/CD with CDRTFE

This is a list of boot image file of Windows and several popular Linux along with how to re-mastered Bootable CD/DVD using ONLY opensource software 7zip and CDRTFE.



Windows Vista, XP, 2000, NT4?, ERD :
Boot image: Generic*
Filesystem: ISO Level 4
BootCD option: Check all except "create boot info table" (as this corrupting boot image), use sector count 4

24 June 2010

INF Path Variables and Values


These are complete translated value of predefined path variables taken from Windows XP that can be used in INF Packaging/Installation:

10=CSIDL_WINDOWS=C:\WINDOWS
11=CSIDL_SYSTEM=C:\WINDOWS\system32
12=C:\WINDOWS\system32\DRIVERS
17=C:\WINDOWS\INF
18=C:\WINDOWS\help
20=CSIDL_FONTS=C:\WINDOWS\fonts
21=C:\WINDOWS\system32\viewers
23=C:\WINDOWS\system32\spool\drivers\color
24=C:\
25=
CSIDL_WINDOWS=C:\WINDOWS
51=C:\WINDOWS\system32\spool
52=C:\WINDOWS\System32\spool\DRIVERS\W32X86
53=
CSIDL_PROFILE=C:\Documents and Settings\qwerty
54=C:\
55=C:\WINDOWS\System32\spool\PRTPROCS\W32X86

12 May 2010

Multiple Dropbox (Do It Yourself)

Great chance you know already how to run multiple dropbox... the very easy way
Yes, by using run as (that is right click on the dropbox shortcut choose "run as.." then select user other than current user) in XP, best candidate for "other user" is administrator because it's ghost user (not shown in login screen by default)

Or you can use dropboxen

But let me tell you another way, no need additional programs, no need to create another users, much flexible, portable and more DIYer :)

Right click on dropbox shortcut in startmenu, click properties, in target box look for where dropbox.exe installed in my case:

28 January 2010

Blogger Comment Deletion URL

Huh, I just realized that I lose the trash can on blogger's comment
http://www.blogger.com/delete-comment.g?blogID=xxxx&postID=yyyy
where yyyy is comment id (permalink)