diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-08-11 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-08-12 16:50:32 +0500 |
commit | e008ce3976c087bfd21344af8f00a23cf69d4174 (patch) | |
tree | 17e556c773ed443dba6c659ec6ea1556f955d169 /CPP/Windows | |
parent | a7a1d4a241492e81f659a920f7379c193593ebc6 (diff) | |
download | 7zip-e008ce3976c087bfd21344af8f00a23cf69d4174.tar.gz 7zip-e008ce3976c087bfd21344af8f00a23cf69d4174.tar.bz2 7zip-e008ce3976c087bfd21344af8f00a23cf69d4174.zip |
24.0824.08
Diffstat (limited to 'CPP/Windows')
-rw-r--r-- | CPP/Windows/FileSystem.cpp | 25 | ||||
-rw-r--r-- | CPP/Windows/SystemInfo.cpp | 105 |
2 files changed, 76 insertions, 54 deletions
diff --git a/CPP/Windows/FileSystem.cpp b/CPP/Windows/FileSystem.cpp index d11f02e..b402306 100644 --- a/CPP/Windows/FileSystem.cpp +++ b/CPP/Windows/FileSystem.cpp | |||
@@ -157,6 +157,31 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize, | |||
157 | 157 | ||
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | /* | ||
161 | bool Is_File_LimitedBy_4GB(CFSTR _path, bool &isFsDetected) | ||
162 | { | ||
163 | isFsDetected = false; | ||
164 | FString path (_path); | ||
165 | path.DeleteFrom(NName::GetRootPrefixSize(path)); | ||
166 | // GetVolumeInformation supports super paths. | ||
167 | // NName::If_IsSuperPath_RemoveSuperPrefix(path); | ||
168 | if (!path.IsEmpty()) | ||
169 | { | ||
170 | DWORD volumeSerialNumber, maximumComponentLength, fileSystemFlags; | ||
171 | UString volName, fileSystemName; | ||
172 | if (MyGetVolumeInformation(path, volName, | ||
173 | &volumeSerialNumber, &maximumComponentLength, &fileSystemFlags, | ||
174 | fileSystemName)) | ||
175 | { | ||
176 | isFsDetected = true; | ||
177 | if (fileSystemName.IsPrefixedBy_Ascii_NoCase("fat")) | ||
178 | return true; | ||
179 | } | ||
180 | } | ||
181 | return false; | ||
182 | } | ||
183 | */ | ||
184 | |||
160 | }}} | 185 | }}} |
161 | 186 | ||
162 | #endif | 187 | #endif |
diff --git a/CPP/Windows/SystemInfo.cpp b/CPP/Windows/SystemInfo.cpp index d23e84b..cfc6a90 100644 --- a/CPP/Windows/SystemInfo.cpp +++ b/CPP/Windows/SystemInfo.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "../../C/CpuArch.h" | 5 | #include "../../C/CpuArch.h" |
6 | 6 | ||
7 | #include "../Common/IntToString.h" | 7 | #include "../Common/IntToString.h" |
8 | #include "../Common/StringConvert.h" | ||
8 | 9 | ||
9 | #ifdef _WIN32 | 10 | #ifdef _WIN32 |
10 | 11 | ||
@@ -511,8 +512,6 @@ void GetSysInfo(AString &s1, AString &s2) | |||
511 | } | 512 | } |
512 | 513 | ||
513 | 514 | ||
514 | void GetCpuName(AString &s); | ||
515 | |||
516 | static void AddBracedString(AString &dest, AString &src) | 515 | static void AddBracedString(AString &dest, AString &src) |
517 | { | 516 | { |
518 | if (!src.IsEmpty()) | 517 | if (!src.IsEmpty()) |
@@ -554,9 +553,7 @@ void CCpuName::Fill() | |||
554 | #ifdef MY_CPU_X86_OR_AMD64 | 553 | #ifdef MY_CPU_X86_OR_AMD64 |
555 | { | 554 | { |
556 | #if !defined(MY_CPU_AMD64) | 555 | #if !defined(MY_CPU_AMD64) |
557 | if (!z7_x86_cpuid_GetMaxFunc()) | 556 | if (z7_x86_cpuid_GetMaxFunc()) |
558 | s += "x86"; | ||
559 | else | ||
560 | #endif | 557 | #endif |
561 | { | 558 | { |
562 | x86cpuid_to_String(s); | 559 | x86cpuid_to_String(s); |
@@ -583,43 +580,26 @@ void CCpuName::Fill() | |||
583 | #endif | 580 | #endif |
584 | 581 | ||
585 | 582 | ||
586 | if (s.IsEmpty()) | 583 | #ifdef _WIN32 |
587 | { | ||
588 | #ifdef MY_CPU_LE | ||
589 | s += "LE"; | ||
590 | #elif defined(MY_CPU_BE) | ||
591 | s += "BE"; | ||
592 | #endif | ||
593 | } | ||
594 | |||
595 | #ifdef __APPLE__ | ||
596 | { | ||
597 | AString s2; | ||
598 | UInt32 v = 0; | ||
599 | if (z7_sysctlbyname_Get_UInt32("machdep.cpu.core_count", &v) == 0) | ||
600 | { | ||
601 | s2.Add_UInt32(v); | ||
602 | s2 += 'C'; | ||
603 | } | ||
604 | if (z7_sysctlbyname_Get_UInt32("machdep.cpu.thread_count", &v) == 0) | ||
605 | { | ||
606 | s2.Add_UInt32(v); | ||
607 | s2 += 'T'; | ||
608 | } | ||
609 | if (!s2.IsEmpty()) | ||
610 | { | ||
611 | s.Add_Space_if_NotEmpty(); | ||
612 | s += s2; | ||
613 | } | ||
614 | } | ||
615 | #endif | ||
616 | |||
617 | |||
618 | #ifdef _WIN32 | ||
619 | { | 584 | { |
620 | NRegistry::CKey key; | 585 | NRegistry::CKey key; |
621 | if (key.Open(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), KEY_READ) == ERROR_SUCCESS) | 586 | if (key.Open(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), KEY_READ) == ERROR_SUCCESS) |
622 | { | 587 | { |
588 | // s.Empty(); // for debug | ||
589 | { | ||
590 | CSysString name; | ||
591 | if (s.IsEmpty()) | ||
592 | if (key.QueryValue(TEXT("ProcessorNameString"), name) == ERROR_SUCCESS) | ||
593 | { | ||
594 | s += GetAnsiString(name); | ||
595 | } | ||
596 | if (key.QueryValue(TEXT("Identifier"), name) == ERROR_SUCCESS) | ||
597 | { | ||
598 | if (!Revision.IsEmpty()) | ||
599 | Revision += " : "; | ||
600 | Revision += GetAnsiString(name); | ||
601 | } | ||
602 | } | ||
623 | LONG res[2]; | 603 | LONG res[2]; |
624 | CByteBuffer bufs[2]; | 604 | CByteBuffer bufs[2]; |
625 | { | 605 | { |
@@ -627,8 +607,9 @@ void CCpuName::Fill() | |||
627 | { | 607 | { |
628 | UInt32 size = 0; | 608 | UInt32 size = 0; |
629 | res[i] = key.QueryValue(i == 0 ? | 609 | res[i] = key.QueryValue(i == 0 ? |
630 | TEXT("Previous Update Revision") : | 610 | TEXT("Previous Update Revision") : |
631 | TEXT("Update Revision"), bufs[i], size); | 611 | TEXT("Update Revision"), |
612 | bufs[i], size); | ||
632 | if (res[i] == ERROR_SUCCESS) | 613 | if (res[i] == ERROR_SUCCESS) |
633 | if (size != bufs[i].Size()) | 614 | if (size != bufs[i].Size()) |
634 | res[i] = ERROR_SUCCESS + 1; | 615 | res[i] = ERROR_SUCCESS + 1; |
@@ -657,8 +638,36 @@ void CCpuName::Fill() | |||
657 | } | 638 | } |
658 | } | 639 | } |
659 | } | 640 | } |
660 | #endif | 641 | #endif |
661 | 642 | ||
643 | if (s.IsEmpty()) | ||
644 | { | ||
645 | #ifdef MY_CPU_NAME | ||
646 | s += MY_CPU_NAME; | ||
647 | #endif | ||
648 | } | ||
649 | |||
650 | #ifdef __APPLE__ | ||
651 | { | ||
652 | AString s2; | ||
653 | UInt32 v = 0; | ||
654 | if (z7_sysctlbyname_Get_UInt32("machdep.cpu.core_count", &v) == 0) | ||
655 | { | ||
656 | s2.Add_UInt32(v); | ||
657 | s2.Add_Char('C'); | ||
658 | } | ||
659 | if (z7_sysctlbyname_Get_UInt32("machdep.cpu.thread_count", &v) == 0) | ||
660 | { | ||
661 | s2.Add_UInt32(v); | ||
662 | s2.Add_Char('T'); | ||
663 | } | ||
664 | if (!s2.IsEmpty()) | ||
665 | { | ||
666 | s.Add_Space_if_NotEmpty(); | ||
667 | s += s2; | ||
668 | } | ||
669 | } | ||
670 | #endif | ||
662 | 671 | ||
663 | #ifdef Z7_LARGE_PAGES | 672 | #ifdef Z7_LARGE_PAGES |
664 | Add_LargePages_String(LargePages); | 673 | Add_LargePages_String(LargePages); |
@@ -900,7 +909,7 @@ void GetSystemInfoText(AString &sRes) | |||
900 | } | 909 | } |
901 | { | 910 | { |
902 | AString s; | 911 | AString s; |
903 | GetCpuName(s); | 912 | GetCpuName_MultiLine(s); |
904 | if (!s.IsEmpty()) | 913 | if (!s.IsEmpty()) |
905 | { | 914 | { |
906 | sRes += s; | 915 | sRes += s; |
@@ -923,18 +932,6 @@ void GetSystemInfoText(AString &sRes) | |||
923 | } | 932 | } |
924 | 933 | ||
925 | 934 | ||
926 | void GetCpuName(AString &s); | ||
927 | void GetCpuName(AString &s) | ||
928 | { | ||
929 | CCpuName cpuName; | ||
930 | cpuName.Fill(); | ||
931 | s = cpuName.CpuName; | ||
932 | AString s2; | ||
933 | cpuName.Get_Revision_Microcode_LargePages(s2); | ||
934 | s.Add_OptSpaced(s2); | ||
935 | } | ||
936 | |||
937 | |||
938 | void GetCpuName_MultiLine(AString &s); | 935 | void GetCpuName_MultiLine(AString &s); |
939 | void GetCpuName_MultiLine(AString &s) | 936 | void GetCpuName_MultiLine(AString &s) |
940 | { | 937 | { |