ReactOS 0.4.16-dev-598-gc07fba4
osdetect.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _NTOS_INSTALLATION
 

Macros

#define VENDOR_REACTOS   L"ReactOS"
 
#define VENDOR_MICROSOFT   L"Microsoft"
 

Typedefs

typedef struct _NTOS_INSTALLATION NTOS_INSTALLATION
 
typedef struct _NTOS_INSTALLATIONPNTOS_INSTALLATION
 

Functions

PGENERIC_LIST NTAPI CreateNTOSInstallationsList (_In_ PPARTLIST PartList)
 Create a list of available NT OS installations on the computer, by searching for recognized ones on each recognized storage volume.
 
PCWSTR NTAPI FindSubStrI (_In_ PCWSTR str, _In_ PCWSTR strSearch)
 Finds the first occurrence of a sub-string 'strSearch' inside 'str', using case-insensitive comparisons.
 

Macro Definition Documentation

◆ VENDOR_MICROSOFT

#define VENDOR_MICROSOFT   L"Microsoft"

Definition at line 13 of file osdetect.h.

◆ VENDOR_REACTOS

#define VENDOR_REACTOS   L"ReactOS"

Definition at line 12 of file osdetect.h.

Typedef Documentation

◆ NTOS_INSTALLATION

◆ PNTOS_INSTALLATION

Function Documentation

◆ CreateNTOSInstallationsList()

PGENERIC_LIST NTAPI CreateNTOSInstallationsList ( _In_ PPARTLIST  PartList)

Create a list of available NT OS installations on the computer, by searching for recognized ones on each recognized storage volume.

Definition at line 768 of file osdetect.c.

770{
775
777 if (!List)
778 return NULL;
779
780 /* Loop each available volume */
781 for (Entry = PartList->VolumesList.Flink;
782 Entry != &PartList->VolumesList;
783 Entry = Entry->Flink)
784 {
785 Volume = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
786 /* Valid OS installations can be found only on basic volumes */
787 if (!Volume->PartEntry) // TODO: In the future: (!Volume->IsSimpleVolume)
788 continue;
789
790 CheckVolume = (!Volume->New && (Volume->FormatState == Formatted));
791
792#ifndef NDEBUG
793 {
794 PPARTENTRY PartEntry = Volume->PartEntry;
795 ASSERT(PartEntry->Volume == Volume);
796 DPRINT("Volume %S (%c%c) on Disk #%d, Partition #%d (%s), "
797 "index %d - Type 0x%02x, IsVolNew = %s, FormatState = %lu -- Should I check it? %s\n",
798 Volume->Info.DeviceName,
799 !Volume->Info.DriveLetter ? '-' : (CHAR)Volume->Info.DriveLetter,
800 !Volume->Info.DriveLetter ? '-' : ':',
801 PartEntry->DiskEntry->DiskNumber,
802 PartEntry->PartitionNumber,
803 PartEntry->LogicalPartition ? "Logical" : "Primary",
804 PartEntry->PartitionIndex,
805 PartEntry->PartitionType,
806 Volume->New ? "Yes" : "No",
807 Volume->FormatState,
808 CheckVolume ? "YES!" : "NO!");
809 }
810#endif
811
812 if (CheckVolume)
814 }
815
816#ifndef NDEBUG
817 /**** Debugging: List all the collected installations ****/
818 DumpNTOSInstalls(List);
819#endif
820
821 return List;
822}
unsigned char BOOLEAN
static NTSTATUS CheckVolume(IN PCWSTR VolumePath, IN LONG TimeOut, IN BOOLEAN CheckOnlyIfDirty)
Definition: autochk.c:391
#define NULL
Definition: types.h:112
PGENERIC_LIST NTAPI CreateGenericList(VOID)
Definition: genlist.c:21
@ Formatted
Definition: partlist.h:37
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
static VOID FindNTOSInstallations(_Inout_ PGENERIC_LIST List, _In_ PPARTLIST PartList, _In_ PVOLENTRY Volume)
Definition: osdetect.c:683
#define DPRINT
Definition: sndvol32.h:73
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
UCHAR PartitionType
Definition: partlist.h:73
PVOLENTRY Volume
Definition: partlist.h:95
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
BOOLEAN LogicalPartition
Definition: partlist.h:79
ULONG PartitionNumber
Definition: partlist.h:75
ULONG PartitionIndex
Definition: partlist.h:76
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
char CHAR
Definition: xmlstorage.h:175

Referenced by LoadSetupData(), and UpgradeRepairPage().

◆ FindSubStrI()

PCWSTR NTAPI FindSubStrI ( _In_ PCWSTR  str,
_In_ PCWSTR  strSearch 
)

Finds the first occurrence of a sub-string 'strSearch' inside 'str', using case-insensitive comparisons.

Definition at line 219 of file osdetect.c.

222{
223 PCWSTR cp = str;
224 PCWSTR s1, s2;
225
226 if (!*strSearch)
227 return str;
228
229 while (*cp)
230 {
231 s1 = cp;
232 s2 = strSearch;
233
234 while (*s1 && *s2 && (towupper(*s1) == towupper(*s2)))
235 ++s1, ++s2;
236
237 if (!*s2)
238 return cp;
239
240 ++cp;
241 }
242
243 return NULL;
244}
POINT cp
Definition: magnifier.c:59
struct S1 s1
struct S2 s2
const WCHAR * str
#define towupper(c)
Definition: wctype.h:99
const uint16_t * PCWSTR
Definition: typedefs.h:57

Referenced by IsValidNTOSInstallationByHandle().