Author: fireball
Date: Thu Jul 19 22:53:33 2007
New Revision: 27737
URL:
http://svn.reactos.org/svn/reactos?rev=27737&view=rev
Log:
- Apply 25963 hack (reverting vmwinst to an earlier version). Now it's possible to set
resolution in vmwinst for VMWare video driver (including VMWare 6 version too).
Added:
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Cz.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Cz.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/De.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/De.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Dk.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Dk.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/En.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/En.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Es.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Es.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Hu.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Hu.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Ja.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Ja.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Ru.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Ru.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/Uk.rc
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/Uk.rc
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmware.inf
- copied unchanged from r25963,
branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/vmware.inf
Removed:
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/lang/
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/rsrc.rc
Modified:
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.c
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.h
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rbuild
branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rc
Removed: branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_3/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/rsrc.rc (original)
+++ branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/rsrc.rc (removed)
@@ -1,31 +1,0 @@
-#include <windows.h>
-#include "vmwinst.h"
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-
-1 24 DISCARDABLE "manifest.xml"
-
-/* Bitmaps */
-IDB_WATERMARK BITMAP "resources/watermark.bmp"
-IDB_HEADER BITMAP "resources/header.bmp"
-
-/*
- * Everything specific to any language goes in one of the specific
- * files. Note that you can and may override resources which also have
- * a neutral version. This is to get localized bitmaps for example.
- */
-#include "lang/cs-CZ.rc"
-#include "lang/da-DK.rc"
-#include "lang/de-DE.rc"
-#include "lang/en-US.rc"
-#include "lang/es-ES.rc"
-#include "lang/hu-HU.rc"
-#include "lang/id-ID.rc"
-#include "lang/it-IT.rc"
-#include "lang/ja-JP.rc"
-#include "lang/lt-LT.rc"
-#include "lang/nb-NO.rc"
-#include "lang/pl-PL.rc"
-#include "lang/ru-RU.rc"
-#include "lang/uk-UA.rc"
-#include "lang/zh-CN.rc"
Modified: branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_3/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.c (original)
+++ branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.c Thu Jul 19 22:53:33
2007
@@ -18,7 +18,8 @@
*
* VMware is a registered trademark of VMware, Inc.
*/
-/*
+/* $Id$
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VMware(r) driver installation utility
* FILE: subsys/system/vmwinst/vmwinst.c
@@ -27,11 +28,9 @@
*/
#include <windows.h>
#include <commctrl.h>
-#include <newdev.h>
#include <stdio.h>
#include <string.h>
#include "vmwinst.h"
-#include <debug.h>
extern VOID CALLBACK InstallHinfSectionW(HWND hwnd, HINSTANCE ModuleHandle,
PCWSTR CmdLineBuffer, INT nCmdShow);
@@ -98,8 +97,27 @@
return FALSE;
}
+BOOL
+ProcessMessage(void)
+{
+ MSG msg;
+ if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void
+ProcessMessages(void)
+{
+ while(ProcessMessage());
+}
+
/* try to open the file */
-static BOOL
+BOOL
FileExists(WCHAR *Path, WCHAR *File)
{
WCHAR FileName[MAX_PATH + 1];
@@ -151,8 +169,54 @@
}
+/* Copy file */
+BOOL
+InstallFile(WCHAR *Destination, WCHAR *File)
+{
+ static char Buffer[1024];
+ WCHAR SourceFileName[MAX_PATH + 1];
+ WCHAR DestFileName[MAX_PATH + 1];
+ HANDLE SourceFileHandle, DestFileHandle;
+ DWORD DataRead, DataWritten;
+
+ SourceFileName[0] = L'\0';
+ DestFileName[0] = L'\0';
+ wcscat(SourceFileName, SrcPath);
+ wcscat(SourceFileName, File);
+ wcscat(DestFileName, Destination);
+ wcscat(DestFileName, File);
+
+ SourceFileHandle = CreateFile(SourceFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
+ if(SourceFileHandle == INVALID_HANDLE_VALUE)
+ {
+ return FALSE;
+ }
+ DestFileHandle = CreateFile(DestFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
+ if(DestFileHandle == INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(SourceFileHandle);
+ return FALSE;
+ }
+
+ while(ReadFile(SourceFileHandle, Buffer, sizeof(Buffer), &DataRead, NULL)
&& DataRead > 0)
+ {
+ if(!WriteFile(DestFileHandle, Buffer, DataRead, &DataWritten, NULL) ||
+ DataRead != DataWritten)
+ {
+ CloseHandle(SourceFileHandle);
+ CloseHandle(DestFileHandle);
+ DeleteFile(DestFileName);
+ return FALSE;
+ }
+ }
+
+ CloseHandle(SourceFileHandle);
+ CloseHandle(DestFileHandle);
+ return TRUE;
+}
+
/* Find the drive with the inserted VMware cd-rom */
-static BOOL
+BOOL
IsVMwareCDInDrive(WCHAR *Drv)
{
static WCHAR Drive[4] = L"X:\\";
@@ -199,14 +263,14 @@
return FALSE;
}
-static BOOL
+BOOL
LoadResolutionSettings(DWORD *ResX, DWORD *ResY, DWORD *ColDepth)
{
HKEY hReg;
DWORD Type, Size;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
+ L"SYSTEM\\CurrentControlSet\\Hardware
Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
0, KEY_QUERY_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
@@ -214,26 +278,29 @@
if(RegQueryValueEx(hReg, L"DefaultSettings.BitsPerPel", 0, &Type,
(BYTE*)ColDepth, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
- *ColDepth = 8;
+ RegCloseKey(hReg);
+ return FALSE;
}
if(RegQueryValueEx(hReg, L"DefaultSettings.XResolution", 0, &Type,
(BYTE*)ResX, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
- *ResX = 640;
+ RegCloseKey(hReg);
+ return FALSE;
}
if(RegQueryValueEx(hReg, L"DefaultSettings.YResolution", 0, &Type,
(BYTE*)ResY, &Size) != ERROR_SUCCESS ||
Type != REG_DWORD)
{
- *ResY = 480;
+ RegCloseKey(hReg);
+ return FALSE;
}
RegCloseKey(hReg);
return TRUE;
}
-static BOOL
+BOOL
IsVmwSVGAEnabled(VOID)
{
HKEY hReg;
@@ -258,13 +325,13 @@
-static BOOL
+BOOL
SaveResolutionSettings(DWORD ResX, DWORD ResY, DWORD ColDepth)
{
HKEY hReg;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- L"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
+ L"SYSTEM\\CurrentControlSet\\Hardware
Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
0, KEY_SET_VALUE, &hReg) != ERROR_SUCCESS)
{
return FALSE;
@@ -291,7 +358,7 @@
return TRUE;
}
-static BOOL
+BOOL
EnableDriver(WCHAR *Key, BOOL Enable)
{
DWORD Value;
@@ -314,7 +381,7 @@
}
/* Activate the vmware driver and deactivate the others */
-static BOOL
+BOOL
EnableVmwareDriver(BOOL VBE, BOOL VGA, BOOL VMX)
{
if(!EnableDriver(L"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE))
@@ -333,11 +400,94 @@
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
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DWORD Flags, DLGPROC DlgProc)
+{
+ ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+ psp->dwSize = sizeof(PROPSHEETPAGE);
+ psp->dwFlags = PSP_DEFAULT | Flags;
+ psp->hInstance = hAppInstance;
+ psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+ psp->pfnDlgProc = DlgProc;
+}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageWelcomeProc(
HWND hwndDlg,
UINT uMsg,
@@ -367,6 +517,23 @@
{
if(DriverFilesFound)
{
+ 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];
+ LoadString(hAppInstance, IDS_FAILEDTOACTIVATEDRIVER, Msg, sizeof(Msg) /
sizeof(WCHAR));
+ MessageBox(GetParent(hwndDlg), Msg, NULL, MB_ICONWARNING);
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_WELCOMEPAGE);
+ return TRUE;
+ }
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CONFIG);
return TRUE;
}
@@ -380,7 +547,7 @@
}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageInsertDiscProc(
HWND hwndDlg,
UINT uMsg,
@@ -408,7 +575,7 @@
return FALSE;
}
-static VOID
+VOID
InstTerminateInstaller(BOOL Wait)
{
if(hInstallationThread != NULL)
@@ -425,11 +592,10 @@
}
}
-static DWORD STDCALL
+DWORD STDCALL
InstInstallationThread(LPVOID lpParameter)
{
HANDLE hThread;
- WCHAR InfFileName[1024];
BOOL DriveAvailable;
int DrivesTested = 0;
@@ -452,22 +618,47 @@
if(AbortInstall != 0) goto done;
PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_COPYINGFILES, 0);
- wcscpy(InfFileName, SrcPath);
- wcscat(InfFileName, L"vmx_svga.inf");
- DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
- if (!UpdateDriverForPlugAndPlayDevices(
- hInstallationNotifyWnd,
- L"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
- InfFileName,
- 0,
- NULL))
- {
- AbortInstall = 1;
- }
- else
- {
- AbortInstall = 0;
- }
+ if(AbortInstall != 0) goto done;
+ if(!InstallFile(DestinationPath, vmx_fb))
+ {
+ PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
+ goto cleanup;
+ }
+
+ Sleep(250);
+
+ if(AbortInstall != 0) goto done;
+ if(!InstallFile(DestinationPath, vmx_mode))
+ {
+ PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
+ goto cleanup;
+ }
+
+ Sleep(250);
+
+ if(AbortInstall != 0) goto done;
+ if(!InstallFile(DestinationDriversPath, vmx_svga))
+ {
+ PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOCOPYFILES, 0);
+ goto cleanup;
+ }
+
+ Sleep(250);
+
+ if(AbortInstall != 0) goto done;
+ PostMessage(hInstallationNotifyWnd, WM_INSTSTATUSUPDATE, IDS_ENABLINGDRIVER, 0);
+ if(!AddVmwareRegistryEntries())
+ {
+ PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOADDREGENTRIES, 0);
+ goto cleanup;
+ }
+ if(!EnableVmwareDriver(TRUE, TRUE, TRUE))
+ {
+ PostMessage(hInstallationNotifyWnd, WM_INSTABORT, IDS_FAILEDTOACTIVATEDRIVER, 0);
+ goto cleanup;
+ }
+
+ Sleep(500);
done:
switch(AbortInstall)
@@ -489,7 +680,7 @@
return 0;
}
-static BOOL
+BOOL
InstStartInstallationThread(HWND hwndNotify)
{
if(hInstallationThread == NULL)
@@ -516,7 +707,7 @@
}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageInstallingProc(
HWND hwndDlg,
UINT uMsg,
@@ -585,7 +776,7 @@
}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageInstallFailedProc(
HWND hwndDlg,
UINT uMsg,
@@ -610,7 +801,7 @@
return FALSE;
}
-static void
+void
FillComboBox(HWND Dlg, int idComboBox, int From, int To)
{
int i;
@@ -633,7 +824,7 @@
} MAPCTLRES;
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageConfigProc(
HWND hwndDlg,
UINT uMsg,
@@ -752,7 +943,7 @@
}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageChooseActionProc(
HWND hwndDlg,
UINT uMsg,
@@ -804,7 +995,7 @@
}
/* Property page dialog callback */
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageSelectDriverProc(
HWND hwndDlg,
UINT uMsg,
@@ -866,7 +1057,7 @@
return FALSE;
}
-static VOID
+VOID
ShowUninstNotice(HWND Owner)
{
WCHAR Msg[1024];
@@ -874,7 +1065,7 @@
MessageBox(Owner, Msg, NULL, MB_ICONINFORMATION);
}
-static INT_PTR CALLBACK
+INT_PTR CALLBACK
PageDoUninstallProc(
HWND hwndDlg,
UINT uMsg,
Modified: branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_3/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.h (original)
+++ branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.h Thu Jul 19 22:53:33
2007
@@ -68,4 +68,6 @@
#define IDD_DOUNINSTALLTITLE 361
#define IDD_DOUNINSTALLSUBTITLE 362
+#define IDR_VMWARE_INF 400
+
#endif /* __VMWINST_H */
Modified: branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_3/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rbuild (original)
+++ branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rbuild Thu Jul 19
22:53:33 2007
@@ -8,11 +8,9 @@
<library>advapi32</library>
<library>comctl32</library>
<library>comdlg32</library>
- <library>newdev</library>
<library>user32</library>
<library>setupapi</library>
<library>shell32</library>
- <library>ntdll</library>
<file>vmwinst.c</file>
<file>vmwinst.rc</file>
</module>
Modified: branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rc
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_3/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rc (original)
+++ branches/ros-branch-0_3_3/reactos/base/setup/vmwinst/vmwinst.rc Thu Jul 19 22:53:33
2007
@@ -1,3 +1,5 @@
+/* $Id$ */
+
#include <windows.h>
#include "vmwinst.h"
@@ -6,4 +8,29 @@
#define REACTOS_STR_ORIGINAL_FILENAME "vmwinst.exe\0"
#include <reactos/version.rc>
-#include "rsrc.rc"
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+1 24 DISCARDABLE "manifest.xml"
+
+/* Bitmaps */
+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
+ * files. Note that you can and may override resources which also have
+ * a neutral version. This is to get localized bitmaps for example.
+ */
+#include "Cz.rc"
+#include "En.rc"
+#include "De.rc"
+#include "Dk.rc"
+#include "Es.rc"
+#include "Ja.rc"
+#include "Hu.rc"
+#include "Ru.rc"
+#include "Uk.rc"