Have vmwinst add back the registry entries which were so brutally removed.
authorGé van Geldorp <ge@gse.nl>
Sun, 14 Aug 2005 21:44:58 +0000 (21:44 +0000)
committerGé van Geldorp <ge@gse.nl>
Sun, 14 Aug 2005 21:44:58 +0000 (21:44 +0000)
This doesn't fix the problem completely though, blocked by the problem
described here:
http://reactos.com:8080/archives/public/ros-dev/2005-August/004558.html

svn path=/trunk/; revision=17389

reactos/subsys/system/vmwinst/En.rc
reactos/subsys/system/vmwinst/vmware.inf [new file with mode: 0755]
reactos/subsys/system/vmwinst/vmwinst.c
reactos/subsys/system/vmwinst/vmwinst.h
reactos/subsys/system/vmwinst/vmwinst.rc
reactos/subsys/system/vmwinst/vmwinst.xml

index f923d72..cc98fac 100644 (file)
@@ -95,6 +95,7 @@ BEGIN
   IDS_FAILEDTOSELVGADRIVER "Failed to activate the ReactOS VGA driver!"
   IDS_FAILEDTOSELVBEDRIVER "Failed to activate the ReactOS VBE driver!"
   IDS_UNINSTNOTICE "The VMware(r) SVGA driver files have not yet been deleted.\nPlease delete them manually after a system reboot."
   IDS_FAILEDTOSELVGADRIVER "Failed to activate the ReactOS VGA driver!"
   IDS_FAILEDTOSELVBEDRIVER "Failed to activate the ReactOS VBE driver!"
   IDS_UNINSTNOTICE "The VMware(r) SVGA driver files have not yet been deleted.\nPlease delete them manually after a system reboot."
+  IDS_FAILEDTOADDREGENTRIES "Failed to create registry entries for the VMware(r) SVGA driver!"
 END
 
 STRINGTABLE
 END
 
 STRINGTABLE
diff --git a/reactos/subsys/system/vmwinst/vmware.inf b/reactos/subsys/system/vmwinst/vmware.inf
new file mode 100755 (executable)
index 0000000..429408b
--- /dev/null
@@ -0,0 +1,32 @@
+[version]\r
+signature="$CHICAGO$"\r
+\r
+[DefaultInstall]\r
+AddReg=VMXReg\r
+\r
+[VMXReg]\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","ErrorControl",0x00010001,0x00000000\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","Group",0x00000000,"Video"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","ImagePath",0x00020000,"system32\drivers\vmx_svga.sys"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","Start",0x00010001,0x00000004\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","Type",0x00010001,0x00000001\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","InstalledDisplayDrivers",0x00010000,"vmx_fb"\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.0",0x00000001,36,34,30,78,34,38,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.1",0x00000001,38,30,30,78,36,30,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.2",0x00000001,31,30,32,34,78,37,36,38,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.3",0x00000001,31,31,35,32,78,38,36,34,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.4",0x00000001,31,32,38,30,78,39,36,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.5",0x00000001,31,32,38,30,78,31,30,32,34,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.6",0x00000001,31,34,30,30,78,31,30,35,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.7",0x00000001,31,36,30,30,78,31,32,30,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.8",0x00000001,31,37,39,32,78,31,33,34,34,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.9",0x00000001,31,38,35,36,78,31,33,39,32,00\r
+HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga\Device0","Resolution.10",0x00000001,31,39,32,30,78,31,34,34,30,00\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.Flags",0x00010001,0\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.VRefresh",0x00010001,85\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.XPanning",0x00010001,0\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.YPanning",0x00010001,0\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.BitsPerPel",0x00010001,16\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.XResolution",0x00010001,800\r
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\vmx_svga\Device0","DefaultSettings.YResolution",0x00010001,600\r
+HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00\0000","Service",0x00000000,"vmx_svga"\r
index 74add94..f31d141 100644 (file)
 #include <string.h>
 #include "vmwinst.h"
 
 #include <string.h>
 #include "vmwinst.h"
 
+extern VOID CALLBACK InstallHinfSectionW(HWND hwnd, HINSTANCE ModuleHandle,
+                                         PCWSTR CmdLineBuffer, INT nCmdShow);
+
+
 HINSTANCE hAppInstance;
 BOOL StartVMwConfigWizard, DriverFilesFound, ActivateVBE = FALSE, UninstallDriver = FALSE;
 
 HINSTANCE hAppInstance;
 BOOL StartVMwConfigWizard, DriverFilesFound, ActivateVBE = FALSE, UninstallDriver = FALSE;
 
@@ -382,6 +386,79 @@ EnableVmwareDriver(BOOL VBE, BOOL VGA, BOOL VMX)
   return TRUE;
 }
 
   return TRUE;
 }
 
+/* Make sure the required registry entries are present */
+BOOL
+AddVmwareRegistryEntries()
+{
+  HRSRC VmwareInfResource;
+  HGLOBAL VmwareInfMem;
+  PVOID VmwareInfLocked;
+  DWORD Size;
+  WCHAR TempPath[MAX_PATH];
+  WCHAR BufferSize;
+  WCHAR TempFileName[MAX_PATH];
+  HANDLE TempFile;
+  DWORD Written;
+  WCHAR CmdLine[19 + MAX_PATH];
+
+  VmwareInfResource = FindResourceW(hAppInstance,
+                                    MAKEINTRESOURCE(IDR_VMWARE_INF),
+                                    L"RT_INF");
+  if (NULL == VmwareInfResource)
+  {
+    return FALSE;
+  }
+  Size = SizeofResource(hAppInstance, VmwareInfResource);
+  if (0 == Size)
+  {
+    return FALSE;
+  }
+  VmwareInfMem = LoadResource(hAppInstance, VmwareInfResource);
+  if (NULL == VmwareInfMem)
+  {
+    return FALSE;
+  }
+  VmwareInfLocked = LockResource(VmwareInfMem);
+  if (NULL == VmwareInfLocked)
+  {
+    return FALSE;
+  }
+
+  BufferSize = GetTempPathW(sizeof(TempPath) / sizeof(TempPath[0]), TempPath);
+  if (0 == BufferSize || sizeof(TempPath) / sizeof(TempPath[0]) < BufferSize)
+  {
+    return FALSE;
+  }
+  if (0 == GetTempFileNameW(TempPath, L"vmx", 0, TempFileName))
+  {
+    return FALSE;
+  }
+
+  TempFile = CreateFileW(TempFileName, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+                         FILE_ATTRIBUTE_NORMAL, NULL);
+  if (INVALID_HANDLE_VALUE == TempFile)
+  {
+    DeleteFile(TempFileName);
+    return FALSE;
+  }
+  if (! WriteFile(TempFile, VmwareInfLocked, Size, &Written, NULL) ||
+      Written != Size)
+  {
+    CloseHandle(TempFile);
+    DeleteFile(TempFileName);
+    return FALSE;
+  }
+  CloseHandle(TempFile);
+
+  wcscpy(CmdLine, L"DefaultInstall 128 ");
+  wcscat(CmdLine, TempFileName);
+  InstallHinfSectionW(NULL, NULL, CmdLine, 0);
+
+  DeleteFile(TempFileName);
+
+  return TRUE;
+}
+
 /* GUI */
 
 void
 /* GUI */
 
 void
@@ -426,7 +503,15 @@ PageWelcomeProc(
         {
           if(DriverFilesFound)
           {
         {
           if(DriverFilesFound)
           {
-            if(!EnableVmwareDriver(FALSE, FALSE, TRUE))
+            if(!AddVmwareRegistryEntries())
+            {
+              WCHAR Msg[1024];
+              LoadString(hAppInstance, IDS_FAILEDTOADDREGENTRIES, Msg, sizeof(Msg) / sizeof(WCHAR));
+              MessageBox(GetParent(hwndDlg), Msg, NULL, MB_ICONWARNING);
+              SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_WELCOMEPAGE);
+              return TRUE;
+            }
+            if(!EnableVmwareDriver(TRUE, TRUE, TRUE))
             {
 
               WCHAR Msg[1024];
             {
 
               WCHAR Msg[1024];
@@ -548,7 +633,7 @@ InstInstallationThread(LPVOID lpParameter)
 
   if(AbortInstall != 0) goto done;
   PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_ENABLINGDRIVER, 0);
 
   if(AbortInstall != 0) goto done;
   PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_ENABLINGDRIVER, 0);
-  if(!EnableVmwareDriver(FALSE, FALSE, TRUE))
+  if(!EnableVmwareDriver(TRUE, TRUE, TRUE))
   {
     PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOACTIVATEDRIVER, 0);
     goto cleanup;
   {
     PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOACTIVATEDRIVER, 0);
     goto cleanup;
@@ -935,7 +1020,7 @@ PageSelectDriverProc(
           }
           ActivateVBE = (SendDlgItemMessage(hwndDlg, IDC_VBE, BM_GETCHECK, 0, 0) == BST_CHECKED);
           if(!EnableVmwareDriver(ActivateVBE,
           }
           ActivateVBE = (SendDlgItemMessage(hwndDlg, IDC_VBE, BM_GETCHECK, 0, 0) == BST_CHECKED);
           if(!EnableVmwareDriver(ActivateVBE,
-                                 !ActivateVBE,
+                                 TRUE,
                                  FALSE))
           {
             WCHAR Msg[1024];
                                  FALSE))
           {
             WCHAR Msg[1024];
@@ -984,7 +1069,7 @@ PageDoUninstallProc(
           if(UninstallDriver)
           {
             if(!EnableVmwareDriver(ActivateVBE,
           if(UninstallDriver)
           {
             if(!EnableVmwareDriver(ActivateVBE,
-                                   !ActivateVBE,
+                                   TRUE,
                                    FALSE))
             {
               WCHAR Msg[1024];
                                    FALSE))
             {
               WCHAR Msg[1024];
index 15d8cca..3466453 100644 (file)
@@ -26,6 +26,7 @@
 #define IDS_FAILEDTOSELVGADRIVER       104
 #define IDS_FAILEDTOSELVBEDRIVER       105
 #define IDS_UNINSTNOTICE               106
 #define IDS_FAILEDTOSELVGADRIVER       104
 #define IDS_FAILEDTOSELVBEDRIVER       105
 #define IDS_UNINSTNOTICE               106
+#define IDS_FAILEDTOADDREGENTRIES       107
 
 #define IDS_SEARCHINGFORCDROM  201
 #define IDS_COPYINGFILES       202
 
 #define IDS_SEARCHINGFORCDROM  201
 #define IDS_COPYINGFILES       202
@@ -67,4 +68,6 @@
 #define IDD_DOUNINSTALLTITLE                   361
 #define IDD_DOUNINSTALLSUBTITLE                        362
 
 #define IDD_DOUNINSTALLTITLE                   361
 #define IDD_DOUNINSTALLSUBTITLE                        362
 
+#define IDR_VMWARE_INF 400
+
 #endif /* __VMWINST_H */
 #endif /* __VMWINST_H */
index f26baa3..a704d7b 100644 (file)
@@ -16,6 +16,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 IDB_WATERMARK BITMAP "resources/watermark.bmp"
 IDB_HEADER    BITMAP "resources/header.bmp"
 
 IDB_WATERMARK BITMAP "resources/watermark.bmp"
 IDB_HEADER    BITMAP "resources/header.bmp"
 
+/* The vmware.inf file */
+IDR_VMWARE_INF RT_INF "vmware.inf"
+
 
 /*
  * Everything specific to any language goes in one of the specific
 
 /*
  * Everything specific to any language goes in one of the specific
index a46fbe8..5c873b0 100644 (file)
@@ -8,6 +8,7 @@
        <library>advapi32</library>
        <library>comctl32</library>
        <library>comdlg32</library>
        <library>advapi32</library>
        <library>comctl32</library>
        <library>comdlg32</library>
+       <library>setupapi</library>
        <library>shell32</library>
        <file>vmwinst.c</file>
        <file>vmwinst.rc</file>
        <library>shell32</library>
        <file>vmwinst.c</file>
        <file>vmwinst.rc</file>