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
)
173 static WCHAR Drive
[4] = L
"X:\\";
178 for(Current
= 'C'; Current
<= 'Z'; Current
++)
182 if(GetDriveType(Drive
) == DRIVE_CDROM
)
185 PathToVideoDrivers60
[0] = Current
;
186 PathToVideoDrivers55
[0] = Current
;
187 PathToVideoDrivers40
[0] = Current
;
188 PathToVideoDrivers45
[0] = Current
;
189 if(SetCurrentDirectory(PathToVideoDrivers60
))
190 SrcPath
= PathToVideoDrivers60
;
191 else if(SetCurrentDirectory(PathToVideoDrivers55
))
192 SrcPath
= PathToVideoDrivers55
;
193 else if(SetCurrentDirectory(PathToVideoDrivers45
))
194 SrcPath
= PathToVideoDrivers45
;
195 else if(SetCurrentDirectory(PathToVideoDrivers40
))
196 SrcPath
= PathToVideoDrivers40
;
199 SetCurrentDirectory(DestinationPath
);
203 if(DoesFileExist(SrcPath
, vmx_fb
) &&
204 (DoesFileExist(SrcPath
, vmx_mode
) || DoesFileExist(SrcPath
, vmx_mode_v6
)) &&
205 DoesFileExist(SrcPath
, vmx_svga
))
219 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
222 DWORD Type
, Size
= sizeof(DWORD
);
224 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
225 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
226 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
228 DEVMODE CurrentDevMode
;
230 /* If this key is absent, just get current settings */
231 memset(&CurrentDevMode
, 0, sizeof(CurrentDevMode
));
232 CurrentDevMode
.dmSize
= sizeof(CurrentDevMode
);
233 if (EnumDisplaySettings(NULL
, ENUM_CURRENT_SETTINGS
, &CurrentDevMode
) == TRUE
)
235 *ColDepth
= CurrentDevMode
.dmBitsPerPel
;
236 *ResX
= CurrentDevMode
.dmPelsWidth
;
237 *ResY
= CurrentDevMode
.dmPelsHeight
;
243 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
247 Size
= sizeof(DWORD
);
250 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
254 Size
= sizeof(DWORD
);
257 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
268 IsVmwSVGAEnabled(VOID
)
271 DWORD Type
, Size
, Value
;
273 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
274 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
275 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
279 Size
= sizeof(DWORD
);
280 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
294 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
299 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
300 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
301 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
305 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
311 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
317 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
323 if(RegSetValueEx(hReg
, L
"DefaultSettings.VRefresh", 0, REG_DWORD
, (BYTE
*)&VFreq
, sizeof(DWORD
)) != ERROR_SUCCESS
)
334 EnableDriver(WCHAR
*Key
, BOOL Enable
)
339 Value
= (Enable
? 1 : 4);
341 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
345 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
355 /* Activate the vmware driver and deactivate the others */
357 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
359 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
363 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
367 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
378 /* Property page dialog callback */
379 static INT_PTR CALLBACK
387 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
394 /* Center the wizard window */
395 hwndControl
= GetParent(hwndDlg
);
396 CenterWindow (hwndControl
);
402 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
409 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
421 /* Property page dialog callback */
422 static INT_PTR CALLBACK
434 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
438 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
441 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
451 InstTerminateInstaller(BOOL Wait
)
453 if(hInstallationThread
!= NULL
)
457 InterlockedExchange((LONG
*)&AbortInstall
, 2);
458 WaitForSingleObject(hInstallationThread
, INFINITE
);
462 InterlockedExchange((LONG
*)&AbortInstall
, 1);
468 InstInstallationThread(LPVOID lpParameter
)
471 WCHAR InfFileName
[1024];
473 int DrivesTested
= 0;
475 if(AbortInstall
!= 0) goto done
;
476 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
478 while(AbortInstall
== 0)
481 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
484 if(DrivesTested
++ > 20)
486 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
491 if(AbortInstall
!= 0) goto done
;
492 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
494 wcscpy(InfFileName
, SrcPath
);
495 wcscat(InfFileName
, L
"vmx_svga.inf");
496 DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
497 if (!UpdateDriverForPlugAndPlayDevices(
498 hInstallationNotifyWnd
,
499 L
"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
515 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
518 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
523 hThread
= InterlockedExchangePointer((PVOID
*)&hInstallationThread
, 0);
526 CloseHandle(hThread
);
532 InstStartInstallationThread(HWND hwndNotify
)
534 if(hInstallationThread
== NULL
)
537 hInstallationNotifyWnd
= hwndNotify
;
539 hInstallationThread
= CreateThread(NULL
,
541 InstInstallationThread
,
545 if(hInstallationThread
== NULL
)
550 ResumeThread(hInstallationThread
);
557 /* Property page dialog callback */
558 static INT_PTR CALLBACK
570 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
574 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, L
"");
575 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
576 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
577 InstStartInstallationThread(hwndDlg
);
580 InstTerminateInstaller(TRUE
);
583 if(hInstallationThread
!= NULL
)
585 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
586 InstTerminateInstaller(FALSE
);
587 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, -1);
592 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
593 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
600 /* go back in case we aborted the installation thread */
601 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
602 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
606 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
607 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
610 case WM_INSTCOMPLETE
:
611 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
612 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
613 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
615 case WM_INSTSTATUSUPDATE
:
618 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
619 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
626 /* Property page dialog callback */
627 static INT_PTR CALLBACK
628 PageInstallFailedProc(
639 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
643 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
653 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
658 for(i
= From
; i
<= To
; i
++)
660 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
662 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
674 /* Property page dialog callback */
675 static INT_PTR CALLBACK
683 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
688 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
691 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
692 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
694 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
710 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
718 /* Center the wizard window */
719 hwndControl
= GetParent(hwndDlg
);
720 CenterWindow (hwndControl
);
726 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
731 if(StartVMwConfigWizard
)
733 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
738 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
745 DWORD rx
= 800, ry
= 600, cd
= 32;
747 static MAPCTLRES Resolutions
[11] = {
760 for(i
= 0; i
< 11; i
++)
762 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
764 rx
= Resolutions
[i
].ResX
;
765 ry
= Resolutions
[i
].ResY
;
770 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
783 SaveResolutionSettings(rx
, ry
, cd
);
793 /* Property page dialog callback */
794 static INT_PTR CALLBACK
795 PageChooseActionProc(
805 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
809 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
813 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
817 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
822 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
825 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
827 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
833 UninstallDriver
= (i
== IDC_UNINSTALL
);
835 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
845 /* Property page dialog callback */
846 static INT_PTR CALLBACK
847 PageSelectDriverProc(
857 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
861 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
865 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
869 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
874 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
888 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
889 if(!EnableVmwareDriver(ActivateVBE
,
894 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
895 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
896 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
909 ShowUninstNotice(HWND Owner
)
912 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
913 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
916 static INT_PTR CALLBACK
928 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
932 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
938 if(!EnableVmwareDriver(ActivateVBE
,
943 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
944 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
945 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
948 ShowUninstNotice(GetParent(hwndDlg
));
963 HPROPSHEETPAGE ahpsp
[8];
967 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
969 /* Create the Welcome page */
970 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
971 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
972 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
973 psp
.hInstance
= hAppInstance
;
974 psp
.pfnDlgProc
= PageWelcomeProc
;
975 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
976 ahpsp
[0] = CreatePropertySheetPage(&psp
);
978 /* Create the INSERT_VMWARE_TOOLS page */
979 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
980 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSTITLE
);
981 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSSUBTITLE
);
982 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLS
);
983 psp
.pfnDlgProc
= PageInsertDiscProc
;
984 ahpsp
[1] = CreatePropertySheetPage(&psp
);
986 /* Create the INSTALLING_VMWARE_TOOLS page */
987 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
988 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSTITLE
);
989 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSSUBTITLE
);
990 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLS
);
991 psp
.pfnDlgProc
= PageInstallingProc
;
992 ahpsp
[2] = CreatePropertySheetPage(&psp
);
994 /* Create the CONFIG page */
995 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
996 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CONFIGTITLE
);
997 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CONFIGSUBTITLE
);
998 psp
.pfnDlgProc
= PageConfigProc
;
999 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CONFIG
);
1000 ahpsp
[3] = CreatePropertySheetPage(&psp
);
1002 /* Create the INSTALLATION_FAILED page */
1003 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1004 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDTITLE
);
1005 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDSUBTITLE
);
1006 psp
.pfnDlgProc
= PageInstallFailedProc
;
1007 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILED
);
1008 ahpsp
[4] = CreatePropertySheetPage(&psp
);
1010 /* Create the CHOOSEACTION page */
1011 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1012 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONTITLE
);
1013 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONSUBTITLE
);
1014 psp
.pfnDlgProc
= PageChooseActionProc
;
1015 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CHOOSEACTION
);
1016 ahpsp
[5] = CreatePropertySheetPage(&psp
);
1018 /* Create the SELECTDRIVER page */
1019 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1020 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERTITLE
);
1021 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE
);
1022 psp
.pfnDlgProc
= PageSelectDriverProc
;
1023 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTDRIVER
);
1024 ahpsp
[6] = CreatePropertySheetPage(&psp
);
1026 /* Create the DOUNINSTALL page */
1027 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1028 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLTITLE
);
1029 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE
);
1030 psp
.pfnDlgProc
= PageDoUninstallProc
;
1031 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_DOUNINSTALL
);
1032 ahpsp
[7] = CreatePropertySheetPage(&psp
);
1034 /* Create the property sheet */
1035 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
1036 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
1037 psh
.hInstance
= hAppInstance
;
1038 psh
.hwndParent
= NULL
;
1040 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
1042 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
1043 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
1045 /* Display the wizard */
1046 return (LONG
)(PropertySheet(&psh
) != -1);
1050 wWinMain(HINSTANCE hInstance
,
1051 HINSTANCE hPrevInstance
,
1059 hAppInstance
= hInstance
;
1061 if(!DetectVMware(&Version
))
1066 lc
= DestinationPath
;
1067 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1068 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1070 wcscat(DestinationPath
, L
"\\");
1072 DestinationDriversPath
[0] = L
'\0';
1073 wcscat(DestinationDriversPath
, DestinationPath
);
1074 wcscat(DestinationDriversPath
, L
"drivers\\");
1076 SetCurrentDirectory(DestinationPath
);
1078 DriverFilesFound
= DoesFileExist(DestinationPath
, vmx_fb
) &&
1079 DoesFileExist(DestinationPath
, vmx_mode
) &&
1080 DoesFileExist(DestinationDriversPath
, vmx_svga
);
1082 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1084 /* Show the wizard */