2 * ReactOS VMware(r) driver installation utility
3 * Copyright (C) 2004 ReactOS Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * VMware is a registered trademark of VMware, Inc.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS VMware(r) driver installation utility
23 * FILE: subsys/system/vmwinst/vmwinst.c
24 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
25 * Klemens Friedl (frik85@hotmail.com)
32 #include <pseh/pseh2.h>
36 extern VOID CALLBACK
InstallHinfSectionW(HWND hwnd
, HINSTANCE ModuleHandle
,
37 PCWSTR CmdLineBuffer
, INT nCmdShow
);
40 HINSTANCE hAppInstance
;
41 BOOL StartVMwConfigWizard
, DriverFilesFound
, ActivateVBE
= FALSE
, UninstallDriver
= FALSE
;
43 static WCHAR DestinationDriversPath
[MAX_PATH
+1];
44 static WCHAR CDDrive
= L
'\0';
45 static WCHAR PathToVideoDrivers60
[MAX_PATH
+1] = L
"X:\\program files\\VMWare\\VMWare Tools\\Drivers\\video\\2k\\32bit\\";
46 static WCHAR PathToVideoDrivers55
[MAX_PATH
+1] = L
"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\32Bit\\";
47 static WCHAR PathToVideoDrivers45
[MAX_PATH
+1] = L
"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\";
48 static WCHAR PathToVideoDrivers40
[MAX_PATH
+1] = L
"X:\\video\\winnt2k\\";
49 static WCHAR DestinationPath
[MAX_PATH
+1];
50 static WCHAR
*vmx_fb
= L
"vmx_fb.dll";
51 static WCHAR
*vmx_mode
= L
"vmx_mode.dll";
52 static WCHAR
*vmx_mode_v6
= L
"vmx mode.dll";
53 static WCHAR
*vmx_svga
= L
"vmx_svga.sys";
55 static WCHAR
*SrcPath
= PathToVideoDrivers45
;
57 static HANDLE hInstallationThread
= NULL
;
58 static HWND hInstallationNotifyWnd
= NULL
;
59 static LONG AbortInstall
= 0;
60 #define WM_INSTABORT (WM_USER + 2)
61 #define WM_INSTCOMPLETE (WM_USER + 3)
62 #define WM_INSTSTATUSUPDATE (WM_USER + 4)
64 /* Helper functions */
66 DetectVMware(int *Version
)
75 /* Try using a VMware I/O port. If not running in VMware this'll throw an
78 __asm__
__volatile__("inl %%dx, %%eax"
79 : "=a" (ver
), "=b" (magic
)
80 : "0" (0x564d5868), "d" (0x5658), "c" (0xa));
81 #elif defined(_MSC_VER) && defined(_M_IX86)
93 #elif defined(_MSC_VER) && defined(_M_AMD64)
94 DPRINT1("DetectVMware stub\n");
100 _SEH2_EXCEPT(_SEH2_GetExceptionCode() == EXCEPTION_PRIV_INSTRUCTION
? EXCEPTION_EXECUTE_HANDLER
: EXCEPTION_CONTINUE_SEARCH
)
106 if(magic
== 0x564d5868)
115 /* try to open the file */
117 DoesFileExist(WCHAR
*Path
, WCHAR
*File
)
119 WCHAR FileName
[MAX_PATH
+ 1];
123 wcscat(FileName
, Path
);
124 wcscat(FileName
, File
);
126 FileHandle
= CreateFile(FileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
128 if(FileHandle
== INVALID_HANDLE_VALUE
)
130 /* If it was a sharing violation the file must already exist */
131 return GetLastError() == ERROR_SHARING_VIOLATION
;
134 if(GetFileSize(FileHandle
, NULL
) <= 0)
136 CloseHandle(FileHandle
);
140 CloseHandle(FileHandle
);
145 CenterWindow(HWND hWnd
)
151 hWndParent
= GetParent(hWnd
);
152 if (hWndParent
== NULL
)
153 hWndParent
= GetDesktopWindow();
155 GetWindowRect(hWndParent
, &rcParent
);
156 GetWindowRect(hWnd
, &rcWindow
);
160 ((rcParent
.right
- rcParent
.left
) - (rcWindow
.right
- rcWindow
.left
)) / 2,
161 ((rcParent
.bottom
- rcParent
.top
) - (rcWindow
.bottom
- rcWindow
.top
)) / 2,
168 /* Find the drive with the inserted VMware cd-rom */
170 IsVMwareCDInDrive(WCHAR
*Drv
)
172 static WCHAR Drive
[4] = L
"X:\\";
176 for(Current
= 'C'; Current
<= 'Z'; Current
++)
180 if(GetDriveType(Drive
) == DRIVE_CDROM
)
183 PathToVideoDrivers60
[0] = Current
;
184 PathToVideoDrivers55
[0] = Current
;
185 PathToVideoDrivers40
[0] = Current
;
186 PathToVideoDrivers45
[0] = Current
;
187 if(SetCurrentDirectory(PathToVideoDrivers60
))
188 SrcPath
= PathToVideoDrivers60
;
189 else if(SetCurrentDirectory(PathToVideoDrivers55
))
190 SrcPath
= PathToVideoDrivers55
;
191 else if(SetCurrentDirectory(PathToVideoDrivers45
))
192 SrcPath
= PathToVideoDrivers45
;
193 else if(SetCurrentDirectory(PathToVideoDrivers40
))
194 SrcPath
= PathToVideoDrivers40
;
197 SetCurrentDirectory(DestinationPath
);
201 if(DoesFileExist(SrcPath
, vmx_fb
) &&
202 (DoesFileExist(SrcPath
, vmx_mode
) || DoesFileExist(SrcPath
, vmx_mode_v6
)) &&
203 DoesFileExist(SrcPath
, vmx_svga
))
217 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
220 DWORD Type
, Size
= sizeof(DWORD
);
222 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
223 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
224 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
226 DEVMODE CurrentDevMode
;
228 /* If this key is absent, just get current settings */
229 memset(&CurrentDevMode
, 0, sizeof(CurrentDevMode
));
230 CurrentDevMode
.dmSize
= sizeof(CurrentDevMode
);
231 if (EnumDisplaySettings(NULL
, ENUM_CURRENT_SETTINGS
, &CurrentDevMode
) == TRUE
)
233 *ColDepth
= CurrentDevMode
.dmBitsPerPel
;
234 *ResX
= CurrentDevMode
.dmPelsWidth
;
235 *ResY
= CurrentDevMode
.dmPelsHeight
;
241 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
245 Size
= sizeof(DWORD
);
248 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
252 Size
= sizeof(DWORD
);
255 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
266 IsVmwSVGAEnabled(VOID
)
269 DWORD Type
, Size
, Value
;
271 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
272 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
273 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
277 Size
= sizeof(DWORD
);
278 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
292 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
297 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
298 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
299 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
303 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
309 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
315 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
321 if(RegSetValueEx(hReg
, L
"DefaultSettings.VRefresh", 0, REG_DWORD
, (BYTE
*)&VFreq
, sizeof(DWORD
)) != ERROR_SUCCESS
)
332 EnableDriver(WCHAR
*Key
, BOOL Enable
)
337 Value
= (Enable
? 1 : 4);
339 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
343 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
353 /* Activate the vmware driver and deactivate the others */
355 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
357 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
361 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
365 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
376 /* Property page dialog callback */
377 static INT_PTR CALLBACK
385 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
392 /* Center the wizard window */
393 hwndControl
= GetParent(hwndDlg
);
394 CenterWindow (hwndControl
);
400 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
407 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
419 /* Property page dialog callback */
420 static INT_PTR CALLBACK
432 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
436 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
439 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
449 InstTerminateInstaller(BOOL Wait
)
451 if(hInstallationThread
!= NULL
)
455 InterlockedExchange((LONG
*)&AbortInstall
, 2);
456 WaitForSingleObject(hInstallationThread
, INFINITE
);
460 InterlockedExchange((LONG
*)&AbortInstall
, 1);
466 InstInstallationThread(LPVOID lpParameter
)
469 WCHAR InfFileName
[1024];
471 int DrivesTested
= 0;
473 if(AbortInstall
!= 0) goto done
;
474 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
476 while(AbortInstall
== 0)
479 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
482 if(DrivesTested
++ > 20)
484 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
489 if(AbortInstall
!= 0) goto done
;
490 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
492 wcscpy(InfFileName
, SrcPath
);
493 wcscat(InfFileName
, L
"vmx_svga.inf");
494 DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
495 if (!UpdateDriverForPlugAndPlayDevices(
496 hInstallationNotifyWnd
,
497 L
"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
513 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
516 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
521 hThread
= InterlockedExchangePointer((PVOID
*)&hInstallationThread
, 0);
524 CloseHandle(hThread
);
530 InstStartInstallationThread(HWND hwndNotify
)
532 if(hInstallationThread
== NULL
)
535 hInstallationNotifyWnd
= hwndNotify
;
537 hInstallationThread
= CreateThread(NULL
,
539 InstInstallationThread
,
543 if(hInstallationThread
== NULL
)
548 ResumeThread(hInstallationThread
);
555 /* Property page dialog callback */
556 static INT_PTR CALLBACK
568 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
572 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, L
"");
573 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
574 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
575 InstStartInstallationThread(hwndDlg
);
578 InstTerminateInstaller(TRUE
);
581 if(hInstallationThread
!= NULL
)
583 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
584 InstTerminateInstaller(FALSE
);
585 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, -1);
590 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
591 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
598 /* go back in case we aborted the installation thread */
599 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
600 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
604 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
605 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
608 case WM_INSTCOMPLETE
:
609 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
610 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
611 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
613 case WM_INSTSTATUSUPDATE
:
616 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
617 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
624 /* Property page dialog callback */
625 static INT_PTR CALLBACK
626 PageInstallFailedProc(
637 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
641 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
651 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
656 for(i
= From
; i
<= To
; i
++)
658 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
660 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
672 /* Property page dialog callback */
673 static INT_PTR CALLBACK
681 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
686 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
689 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
690 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
692 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
708 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
716 /* Center the wizard window */
717 hwndControl
= GetParent(hwndDlg
);
718 CenterWindow (hwndControl
);
724 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
729 if(StartVMwConfigWizard
)
731 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
736 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
743 DWORD rx
= 800, ry
= 600, cd
= 32;
745 static MAPCTLRES Resolutions
[11] = {
758 for(i
= 0; i
< 11; i
++)
760 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
762 rx
= Resolutions
[i
].ResX
;
763 ry
= Resolutions
[i
].ResY
;
768 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
781 SaveResolutionSettings(rx
, ry
, cd
);
791 /* Property page dialog callback */
792 static INT_PTR CALLBACK
793 PageChooseActionProc(
803 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
807 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
811 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
815 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
820 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
823 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
825 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
831 UninstallDriver
= (i
== IDC_UNINSTALL
);
833 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
843 /* Property page dialog callback */
844 static INT_PTR CALLBACK
845 PageSelectDriverProc(
855 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
859 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
863 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
867 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
872 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
886 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
887 if(!EnableVmwareDriver(ActivateVBE
,
892 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
893 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
894 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
907 ShowUninstNotice(HWND Owner
)
910 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
911 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
914 static INT_PTR CALLBACK
926 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
930 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
936 if(!EnableVmwareDriver(ActivateVBE
,
941 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
942 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
943 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
946 ShowUninstNotice(GetParent(hwndDlg
));
961 HPROPSHEETPAGE ahpsp
[8];
965 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
967 /* Create the Welcome page */
968 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
969 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
970 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
971 psp
.hInstance
= hAppInstance
;
972 psp
.pfnDlgProc
= PageWelcomeProc
;
973 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
974 ahpsp
[0] = CreatePropertySheetPage(&psp
);
976 /* Create the INSERT_VMWARE_TOOLS page */
977 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
978 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSTITLE
);
979 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSSUBTITLE
);
980 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLS
);
981 psp
.pfnDlgProc
= PageInsertDiscProc
;
982 ahpsp
[1] = CreatePropertySheetPage(&psp
);
984 /* Create the INSTALLING_VMWARE_TOOLS page */
985 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
986 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSTITLE
);
987 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSSUBTITLE
);
988 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLS
);
989 psp
.pfnDlgProc
= PageInstallingProc
;
990 ahpsp
[2] = CreatePropertySheetPage(&psp
);
992 /* Create the CONFIG page */
993 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
994 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CONFIGTITLE
);
995 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CONFIGSUBTITLE
);
996 psp
.pfnDlgProc
= PageConfigProc
;
997 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CONFIG
);
998 ahpsp
[3] = CreatePropertySheetPage(&psp
);
1000 /* Create the INSTALLATION_FAILED page */
1001 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1002 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDTITLE
);
1003 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDSUBTITLE
);
1004 psp
.pfnDlgProc
= PageInstallFailedProc
;
1005 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILED
);
1006 ahpsp
[4] = CreatePropertySheetPage(&psp
);
1008 /* Create the CHOOSEACTION page */
1009 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1010 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONTITLE
);
1011 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONSUBTITLE
);
1012 psp
.pfnDlgProc
= PageChooseActionProc
;
1013 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CHOOSEACTION
);
1014 ahpsp
[5] = CreatePropertySheetPage(&psp
);
1016 /* Create the SELECTDRIVER page */
1017 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1018 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERTITLE
);
1019 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE
);
1020 psp
.pfnDlgProc
= PageSelectDriverProc
;
1021 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTDRIVER
);
1022 ahpsp
[6] = CreatePropertySheetPage(&psp
);
1024 /* Create the DOUNINSTALL page */
1025 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1026 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLTITLE
);
1027 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE
);
1028 psp
.pfnDlgProc
= PageDoUninstallProc
;
1029 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_DOUNINSTALL
);
1030 ahpsp
[7] = CreatePropertySheetPage(&psp
);
1032 /* Create the property sheet */
1033 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
1034 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
1035 psh
.hInstance
= hAppInstance
;
1036 psh
.hwndParent
= NULL
;
1038 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
1040 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
1041 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
1043 /* Display the wizard */
1044 return (LONG
)(PropertySheet(&psh
) != -1);
1048 wWinMain(HINSTANCE hInstance
,
1049 HINSTANCE hPrevInstance
,
1057 hAppInstance
= hInstance
;
1059 if(!DetectVMware(&Version
))
1064 lc
= DestinationPath
;
1065 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1066 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1068 wcscat(DestinationPath
, L
"\\");
1070 DestinationDriversPath
[0] = L
'\0';
1071 wcscat(DestinationDriversPath
, DestinationPath
);
1072 wcscat(DestinationDriversPath
, L
"drivers\\");
1074 SetCurrentDirectory(DestinationPath
);
1076 DriverFilesFound
= DoesFileExist(DestinationPath
, vmx_fb
) &&
1077 DoesFileExist(DestinationPath
, vmx_mode
) &&
1078 DoesFileExist(DestinationDriversPath
, vmx_svga
);
1080 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1082 /* Show the wizard */