@@ -3081,6 +3081,7 @@ struct VM {
30813081
30823082 // KVM
30833083 key (brands::KVM, " HKLM\\ SYSTEM\\ CurrentControlSet\\ Enum\\ PCI\\ VEN_1AF4*" );
3084+ key (brands::KVM, " HKLM\\ SYSTEM\\ CurrentControlSet\\ Enum\\ PCI\\ VEN_1B36*" );
30843085 key (brands::KVM, " HKLM\\ SYSTEM\\ ControlSet001\\ Services\\ vioscsi" );
30853086 key (brands::KVM, " HKLM\\ SYSTEM\\ ControlSet001\\ Services\\ viostor" );
30863087 key (brands::KVM, " HKLM\\ SYSTEM\\ ControlSet001\\ Services\\ VirtIO-FS Service" );
@@ -9460,7 +9461,7 @@ struct VM {
94609461 constexpr const char * targets[] = {
94619462 " Parallels Software International" , " Parallels(R)" , " innotek" ,
94629463 " Oracle" , " VirtualBox" , " VS2005R2" , " VMware, Inc." ,
9463- " VMware" , " S3 Corp." , " Virtual Machine" , " Qemu" , " vbox" ,
9464+ " VMware" , " VMWARE " , " S3 Corp." , " Virtual Machine" , " Qemu" , " vbox" ,
94649465 " WAET" , " BOCHS" , " BXPC"
94659466 };
94669467
@@ -9515,14 +9516,17 @@ struct VM {
95159516 else if (strcmp (target, " innotek" ) == 0 ||
95169517 strcmp (target, " VirtualBox" ) == 0 ||
95179518 strcmp (target, " vbox" ) == 0 ||
9519+ strcmp (target, " VBOX" ) == 0 ||
95189520 strcmp (target, " Oracle" ) == 0 )
95199521 brand = brands::VBOX;
95209522 else if (strcmp (target, " VMware, Inc." ) == 0 ||
9521- strcmp (target, " VMware" ) == 0 )
9523+ strcmp (target, " VMware" ) == 0 ||
9524+ strcmp (target, " VMWARE" ) == 0 )
95229525 brand = brands::VMWARE;
95239526 else if (strcmp (target, " Qemu" ) == 0 )
95249527 brand = brands::QEMU;
9525- else if (strcmp (target, " BOCHS" ) == 0 )
9528+ else if (strcmp (target, " BOCHS" ) == 0 ||
9529+ strcmp (target, " BXPC" ) == 0 )
95269530 brand = brands::BOCHS;
95279531 else {
95289532 free (info);
@@ -9652,117 +9656,112 @@ struct VM {
96529656
96539657 return false ;
96549658#elif (LINUX)
9655- // Author: dmfrpro
9656- if (!util::is_admin ()) {
9657- return false ;
9658- }
9659-
9660- DIR* dir = opendir (" /sys/firmware/acpi/tables/" );
9661- if (!dir) {
9662- debug (" FIRMWARE: could not open ACPI tables directory" );
9663- return false ;
9664- }
9659+ // Author: dmfrpro
9660+ if (!util::is_admin ()) {
9661+ return false ;
9662+ }
96659663
9666- // Same targets as the Windows branch but without "WAET"
9667- constexpr const char * targets[] = {
9668- " Parallels Software International" , " Parallels(R)" , " innotek" ,
9669- " Oracle" , " VirtualBox" , " VS2005R2" , " VMware, Inc." ,
9670- " VMware" , " S3 Corp." , " Virtual Machine" , " Qemu" , " vbox" , " BOCHS" , " BXPC"
9671- };
9664+ DIR* dir = opendir (" /sys/firmware/acpi/tables/" );
9665+ if (!dir) {
9666+ debug (" FIRMWARE: could not open ACPI tables directory" );
9667+ return false ;
9668+ }
96729669
9673- struct dirent * entry;
9674- while ((entry = readdir (dir)) != nullptr ) {
9675- // Skip "." and ".."
9676- if (strcmp (entry->d_name , " ." ) == 0 || strcmp (entry->d_name , " .." ) == 0 )
9677- continue ;
9670+ // Same targets as the Windows branch but without "WAET"
9671+ constexpr const char * targets[] = {
9672+ " Parallels Software International" , " Parallels(R)" , " innotek" ,
9673+ " Oracle" , " VirtualBox" , " VS2005R2" , " VMware, Inc." ,
9674+ " VMware" , " S3 Corp." , " Virtual Machine" , " Qemu" , " vbox" , " BOCHS" , " BXPC"
9675+ };
96789676
9679- char path[PATH_MAX];
9680- snprintf (path, sizeof (path), " /sys/firmware/acpi/tables/%s" , entry->d_name );
9677+ struct dirent * entry;
9678+ while ((entry = readdir (dir)) != nullptr ) {
9679+ // Skip "." and ".."
9680+ if (strcmp (entry->d_name , " ." ) == 0 || strcmp (entry->d_name , " .." ) == 0 )
9681+ continue ;
96819682
9682- int fd = open (path, O_RDONLY);
9683- if (fd == -1 ) {
9684- debug (" FIRMWARE: could not open ACPI table " , entry->d_name );
9685- continue ;
9686- }
9683+ char path[PATH_MAX];
9684+ snprintf (path, sizeof (path), " /sys/firmware/acpi/tables/%s" , entry->d_name );
96879685
9688- struct stat statbuf;
9689- if (fstat (fd, &statbuf) != 0 ) {
9690- debug (" FIRMWARE: skipped " , entry->d_name );
9691- close (fd);
9692- continue ;
9693- }
9694- if (S_ISDIR (statbuf.st_mode )) {
9695- debug (" FIRMWARE: skipped directory " , entry->d_name );
9696- close (fd);
9697- continue ;
9698- }
9686+ int fd = open (path, O_RDONLY);
9687+ if (fd == -1 ) {
9688+ debug (" FIRMWARE: could not open ACPI table " , entry->d_name );
9689+ continue ;
9690+ }
96999691
9700- long file_size = statbuf.st_size ;
9701- if (file_size <= 0 ) {
9702- debug (" FIRMWARE: file empty or error " , entry->d_name );
9703- close (fd);
9704- continue ;
9705- }
9692+ struct stat statbuf;
9693+ if (fstat (fd, &statbuf) != 0 ) {
9694+ debug (" FIRMWARE: skipped " , entry->d_name );
9695+ close (fd);
9696+ continue ;
9697+ }
9698+ if (S_ISDIR (statbuf.st_mode )) {
9699+ debug (" FIRMWARE: skipped directory " , entry->d_name );
9700+ close (fd);
9701+ continue ;
9702+ }
97069703
9707- char * buffer = static_cast < char *>( malloc ( file_size)) ;
9708- if (!buffer ) {
9709- debug (" FIRMWARE: failed to allocate memory for buffer " );
9710- close (fd);
9711- continue ;
9712- }
9704+ long file_size = statbuf. st_size ;
9705+ if (file_size <= 0 ) {
9706+ debug (" FIRMWARE: file empty or error " , entry-> d_name );
9707+ close (fd);
9708+ continue ;
9709+ }
97139710
9714- ssize_t bytesRead = read (fd, buffer, file_size);
9715- if (bytesRead != file_size) {
9716- debug (" FIRMWARE: failed to read ACPI table " , entry->d_name );
9717- free (buffer);
9711+ char * buffer = static_cast <char *>(malloc (file_size));
9712+ if (!buffer) {
9713+ debug (" FIRMWARE: failed to allocate memory for buffer" );
9714+ close (fd);
9715+ continue ;
9716+ }
97189717 close (fd);
9719- continue ;
9720- }
9721- close (fd);
97229718
9723- for (const char * target : targets) {
9724- size_t targetLen = strlen (target);
9725- if (targetLen == 0 || file_size < static_cast <long >(targetLen))
9726- continue ;
9727- for (long j = 0 ; j <= file_size - static_cast <long >(targetLen); ++j) {
9728- if (memcmp (buffer + j, target, targetLen) == 0 ) {
9729- const char * brand = nullptr ;
9730- if (strcmp (target, " Parallels Software International" ) == 0 ||
9731- strcmp (target, " Parallels(R)" ) == 0 ) {
9732- brand = brands::PARALLELS;
9733- }
9734- else if (strcmp (target, " innotek" ) == 0 ||
9735- strcmp (target, " Oracle" ) == 0 ||
9736- strcmp (target, " VirtualBox" ) == 0 ||
9737- strcmp (target, " vbox" ) == 0 ) {
9738- brand = brands::VBOX;
9739- }
9740- else if (strcmp (target, " VMware, Inc." ) == 0 ||
9741- strcmp (target, " VMware" ) == 0 ) {
9742- brand = brands::VMWARE;
9743- }
9744- else if (strcmp (target, " Qemu" ) == 0 ) {
9745- brand = brands::QEMU;
9746- }
9747- else if (strcmp (target, " BOCHS" ) == 0 ) {
9748- brand = brands::BOCHS;
9719+ for (const char * target : targets) {
9720+ size_t targetLen = strlen (target);
9721+ if (targetLen == 0 || file_size < static_cast <long >(targetLen))
9722+ continue ;
9723+ for (long j = 0 ; j <= file_size - static_cast <long >(targetLen); ++j) {
9724+ if (memcmp (buffer + j, target, targetLen) == 0 ) {
9725+ const char * brand = nullptr ;
9726+ if (strcmp (target, " Parallels Software International" ) == 0 ||
9727+ strcmp (target, " Parallels(R)" ) == 0 ) {
9728+ brand = brands::PARALLELS;
9729+ }
9730+ else if (strcmp (target, " innotek" ) == 0 ||
9731+ strcmp (target, " Oracle" ) == 0 ||
9732+ strcmp (target, " VirtualBox" ) == 0 ||
9733+ strcmp (target, " vbox" ) == 0 ||
9734+ strcmp (target, " VBOX" ) == 0 ) {
9735+ brand = brands::VBOX;
9736+ }
9737+ else if (strcmp (target, " VMware, Inc." ) == 0 ||
9738+ strcmp (target, " VMware" ) == 0 ||
9739+ strcmp (target, " VMWARE" ) == 0 ) {
9740+ brand = brands::VMWARE;
9741+ }
9742+ else if (strcmp (target, " Qemu" ) == 0 ) {
9743+ brand = brands::QEMU;
9744+ }
9745+ else if (strcmp (target, " BOCHS" ) == 0 ||
9746+ strcmp (target, " BXPC" ) == 0 ) {
9747+ brand = brands::BOCHS;
9748+ }
9749+ free (buffer);
9750+ closedir (dir);
9751+ if (brand)
9752+ return core::add (brand);
9753+ else
9754+ return true ;
97499755 }
9750- free (buffer);
9751- closedir (dir);
9752- if (brand)
9753- return core::add (brand);
9754- else
9755- return true ;
97569756 }
97579757 }
9758+ free (buffer);
97589759 }
9759- free (buffer);
9760- }
97619760
9762- closedir (dir);
9763- return false ;
9761+ closedir (dir);
9762+ return false ;
97649763#else
9765- return false ;
9764+ return false ;
97669765#endif
97679766 }
97689767
0 commit comments