[INCLUDEs:ARC]: Fix some structure members of LOADER_PARAMETER_EXTENSION and SETUP_LOADER_BLOCK. Add some documentation & links regarded these structures to document which members change/disappear starting some NT version.

Also, turn some Win32 LPSTR into NT' PSTR or PCHAR types.

    • -12
    • +22
    /trunk/reactos/sdk/include/reactos/arc/arc.h
[SETUPLIB]: Add a new module "bldrsup.c" (WIP) where I place all the NT boot loaders (i.e. ntldr, freeldr, and possibly bootmgr in the future) management functions. So far we only have:

- a function FindNTOSBootLoader() that detects the existence of a given boot loader;

- a function EnumerateNTOSBootEntries() (and corresponding helpers) that enumerate the different boot entries in the configuration file(s) for a given boot loader, and for each entry, calls a user-provided callback.

Only supported at the moment: ntldr and freeldr.

Doing that allows me to simplify large portions of the NT-OS detection code so that it becomes more bootloader-agnostic, and this will help me for simplifying some parts of usetup/bootsup.c too, later...

    • -0
    • +60
    /branches/setup_improvements/base/setup/lib/bldrsup.h
    • -0
    • +353
    /branches/setup_improvements/base/setup/lib/bldrsup.c
And nope, USetup is not a DLL!
[SETUPLIB]: Update the code file headers. Note that Eric & Casper did write the functions that remained in the usetup/filesup.c file; the ones in lib/filesup.c were all added by me.

[USETUP]: Update the version resource: USetup.exe is the "ReactOS Text-Mode Setup".

[SYSDM]: Fix a SendDlgItemMessage(LB_GETITEMDATA) call that missed the index of the list item being selected. This fixes setting the page file for the actual selected disk.

Caught by "cagey45" contributor on the forums: https://reactos.org/forum/viewtopic.php?f=9&t=16439 ; see also CORE-1151.

    • -1
    • +1
    /trunk/reactos/dll/cpl/sysdm/virtmem.c
Code styling:

[NDK]: Make a #define value look less "magical".

[ARC]: Write "BaseDllName" using the regular case used in other parts of ReactOS' code.

    • -1
    • +1
    /trunk/reactos/sdk/include/ndk/cmtypes.h
[FSLIB]: Minor fixes:

- Stub and export VfatxChkdsk();

- Sync and fix the file code headers;

- In the libs, use NTAPI instead of WINAPI;

- Use 4-space indentation (instead of tabs).

    • -9
    • +7
    /trunk/reactos/dll/win32/uext2/uext2.c
    • -8
    • +7
    /trunk/reactos/dll/win32/ubtrfs/ubtrfs.c
    • -8
    • +7
    /trunk/reactos/dll/win32/untfs/untfs.c
    • -0
    • +22
    /trunk/reactos/dll/win32/ufatx/ufatx.c
    • -11
    • +10
    /trunk/reactos/dll/win32/ureiserfs/ureiserfs.c
    • -1
    • +1
    /trunk/reactos/sdk/lib/fslib/ext2lib/Mke2fs.c
    • -2
    • +2
    /trunk/reactos/dll/win32/ufatx/CMakeLists.txt
    • -1
    • +1
    /trunk/reactos/sdk/lib/fslib/ffslib/ffslib.c
    • -10
    • +9
    /trunk/reactos/dll/win32/ufat/ufat.c
    • -0
    • +1
    /trunk/reactos/dll/win32/ufatx/ufatx.spec
[USETUP]: Refactor the DoesFileExist() function so that it now looks closer to DoesPathExist() and use it almost everywhere. Adjust also its callers, adjust OpenAndMapFile() parameters.

Related to that, simplify IsValidNTOSInstallation() parameters & introduce a IsValidNTOSInstallation_UStr that does the same but takes a UNICODE_STRING instead. Simplify CheckForValidPEAndVendor().

Now only exactly 5 calls use the "old" 'DoesFileExist' syntax, using a temporarily auxiliary function "DoesFileExist_2"...

[USETUP]: Use the newly-introduced CombinePaths and ConcatPaths functions.

Fix also few comments, and place some UNICODE_NULLs here & there.

Addendum to r74636: whitespace fixes only.
[USETUP]: Fix the file headers.
[USETUP]: Transform the existing ConcatPaths() function into a variadic function, and derive a CombinePaths() from it (plus their equivalent taking va_list). This allows building concatenated paths with an arbitrary number of separated components (as done in the rest of the code). Will be used soon.
[USETUP]: Whitespace fixes only.
[USETUP]: Flatten out the "native/" directory, and introduce the host_native.c from the original console.c so that the directory makes more sense.
[USETUP]: Move some code to the SetupLib:

- filesup.c's functions ConcatPaths(), Does[Path|File]Exist(), NtPathToDiskPartComponents(), OpenAndMapFile(), UnMapFile();

- move the inicache library to setuplib as it'll be used for the 1st stage GUI setup too (indeed, there is no good INI file API under Win32; the Win32 profile "stuff" is just good enough to manipulate the win16 ini files, and are here anyways for backward compatibility purposes only);

- move the OS detector too.

- Remove the duplicated ConcatPaths() code in arcname.c.

[USETUP]: Further improve the OS detection code.

- Improve FindExistingNTOSInstall() so that we can find an existing installation either by system root ARC path or NT path; this is used when enumerating available installations from the boot.ini/freeldr.ini and checking whether we have to resolve the ARC paths into NT paths, and whether we have to really check for the existence & validity of such an installation (or whether it was previously checked for).

- Improve AddNTOSInstallation() so that we can save the system root ARC path and NT path of the installation, as well as its partition entry structure pointer, for caching & later retrieval purposes.

- Remove some deprecated comments & todos, and implement other todos.

- Improve the output of some DPRINTs.

- Fix the return value of FindSubStrI.

[USETUP]: arcname_tests.c: remove an unneeded function prototype.
[USETUP]: Some fixes/improvements suggested by Thomas:

- isspace('\0') returns FALSE anyways so no need to separately test for a NULL character;

- The (str/wcs)toul function cannot return a NULL pointer from its second paramter;

- VersionInfo32_FindChild(): the third argument is indeed a number of characters (not bytes), so rename the parameter to make this fact clear. The function is however correctly used within this module.

- In the partlist.c disk getters: Remove useless "IsListEmpty(&List->DiskListHead)" checks, because this is actually the kind of check the while() loop does just after...

- Fix few DPRINTs.

[USETUP]: Improve the NTOS installations detector. In all the disks/partitions available, it searches for the presence of freeldr.ini / boot.ini, open & parse them, and enumerates the available boot entries (as candidates for installations). For each of them, it maps their ARC paths into the NT namespace (hence the ARC 2 NT path resolver committed in r74621), then attempts to detect in these paths the existence of NTOS installations.

The code needs some cleaning (and factoring out redundancies, etc...) but works: http://i.imgur.com/cSDN3La.png

In this example, there is a ReactOS installation on the second primary partition "D:" formatted in FAT32, and a Windows installation on the logical partition "F:" and they are correctly recognized as such (the ARC paths in the freeldr.ini/boot.ini are mapped to NT paths from which we can recognize the presence of an installation, then the hard-disk & partition numbers are mapped back to the correct partition, and from there the partition letters are retrieved correctly and displayed in the installations list on the left in the screenshot).

NOTE: If you try to compile the usetup branch, it won't (yet), because I don't commit yet some local changes I have regarding how the functions DoesPathExist() and DoesFileExist() are used (I'm trying to stabilize their interface).

[USETUP]: SetupLib: Add an ARC path to (and from) NT path resolver. It allows mapping between an ARC path as specified in freeldr.ini / boot.ini , to its corresponding NT path, if possible.

Currently, only the mapping direction "ARC to NT" is implemented. It will be used wherever such mappings are needed, for example when identifying the ReactOS / Windows installations from the available freeldr.ini / boot.ini entries (for upgrading / repair purposes).

The resolver supports the usual ARC paths: multi()disk()[r|f]disk()[partition()] ; eisa()disk()[r|f]disk()[partition()] ; multi()disk()cdrom() ; scsi()disk()[r|f]disk()[partition()] ; scsi()cdrom()fdisk() ; ramdisk(x) ; net(x) (actually reported as "unsupported" since it would map to some path on some network), and the newly-introduced Win2k signature()disk()rdisk()[partition()].

Code is in progress, I need to clean up the references list.

I also add some validation tests I used during implementing the resolver.

    • -0
    • +861
    /branches/setup_improvements/base/setup/lib/arcname.c
    • -0
    • +22
    /branches/setup_improvements/base/setup/lib/arcname.h
    • -0
    • +142
    /branches/setup_improvements/base/setup/lib/arcname_tests.c
[USETUP]: inicache module: From the existing IniCacheLoad() function, introduce a IniCacheLoadFromMemory() function that just does the same (initialize an INI file cache and parse the INI file), but takes the input from a memory buffer. Then, rewrite the IniCacheLoad() function to just open the file given in input, and then fall back to calling IniCacheLoadFromMemory.

The IniCacheLoadFromMemory() function will be used later.

[USETUP]: filesup module:

- Add a NtPathToDiskPartComponents helper, that takes in input a fully qualified NT path to a file on hard disk, e.g.: \Device\Harddisk1\Partition2\foo\bar, and returns in output the disk number ('1'), the partition number ('2'), and the the path component "\foo\bar" that is after the device-harddisk-partition stuff.

- Make the OpenAndMapFile return the file size of the opened file.

Both of these additions will be used soon.

- Turn a 'isspace' into a 'iswspace'.

[USETUP]: Move all the code that retrieves the version resources from PE executable, out of osdetect.c, and place it in its own module inside the setuplib.

Remove also some commented headers in precomp.h.

    • -0
    • +24
    /branches/setup_improvements/base/setup/lib/ntverrsrc.h
    • -0
    • +194
    /branches/setup_improvements/base/setup/lib/ntverrsrc.c
[USETUP]: PartList module: Add a couple of disk/partition getters: GetDiskByBiosNumber, GetDiskByNumber, GetDiskBySCSI, GetDiskBySignature, GetPartition, GetDiskOrPartition.

They will be used in the subsequent commits.

[USETUP]: Use secure "StringCchPrintfW" function instead of swprintf.
[USETUP]: Addendum to r74614: Code adaptations for the "STRING_HDDINFOUNKx" string labels renaming. The extra slot added to some of the strings is to indicate whether the disk is MBR or GPT.

As attentive readers will notice, the code that "determines" whether the disk is either MBR or GPT is of course wrong: it's just a temporary placeholder code that should currently just show "MBR".

Having the NoMbr flag mostly signifies that the disk is uninitialized. A GPT disk also has a MBR but it's for "backcompatibility" / "protective" reasons (so that MBR-only tools would see the disk as just a big 1-partitioned only disk with which they could barely do anything). A real involved test for the nature of the disk should involve calling the correct IOCTLs in the disk detection code in partlist.c . This is for the future (and when ReactOS will better support GPT disks).

[USETUP]: Rename some of the uninformative "STRING_HDDINFOUNKx" string labels into more informative ones (actually, when they are versions of others strings, with the disk driver name displayed, I just reuse their string labels and add a "_1" or "_2" in accordance). Also, reserve a new field to display whether the disk is MBR or GPT-initialized.

The code adaptations in usetup.c will follow in a subsequent commit.

  1. … 11 more files in changeset.
[SCSIPORT]: Fixes:

- In SpiScanAdapter(), after an SCSI INQUIRY command has succeeded and we are setting up a LUN extension structure,

cache in its InquiryData member the inquiry data retrieved from the INQUIRY command (alternatively we might just cache

a pointer to a valid "LunInfo" since the latter are also cached elsewhere).

- This allows SpiBuildDeviceMap(), which is called just after SpiScanAdapter(), to correctly report in the registry SCSI tree

the correct Identifier and DeviceType values for the enumerated logical units.

- Use ExFreePoolWithTag in SpiScanAdapter().

[SCSIPORT]: Code formatting only.
[SCSIPORT]: Fixes + documentation:

- In SpiSendInquiry():

* use ExFreePoolWithTag;

* if IoBuildDeviceIoControlRequest() fails, exit correctly the loop so that the allocated buffers are cleaned up;

- In SpiBuildDeviceMap():

* support new peripheral type names, as documented in the links in the comments;

* fix the "CommunicationsPeripheral" name (communication'S') as documented, and as done in windows' scsiport driver.