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)
97 _SEH2_EXCEPT(_SEH2_GetExceptionCode() == EXCEPTION_PRIV_INSTRUCTION
? EXCEPTION_EXECUTE_HANDLER
: EXCEPTION_CONTINUE_SEARCH
)
103 if(magic
== 0x564d5868)
112 /* try to open the file */
114 DoesFileExist(WCHAR
*Path
, WCHAR
*File
)
116 WCHAR FileName
[MAX_PATH
+ 1];
120 wcscat(FileName
, Path
);
121 wcscat(FileName
, File
);
123 FileHandle
= CreateFile(FileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
125 if(FileHandle
== INVALID_HANDLE_VALUE
)
127 /* If it was a sharing violation the file must already exist */
128 return GetLastError() == ERROR_SHARING_VIOLATION
;
131 if(GetFileSize(FileHandle
, NULL
) <= 0)
133 CloseHandle(FileHandle
);
137 CloseHandle(FileHandle
);
142 CenterWindow(HWND hWnd
)
148 hWndParent
= GetParent(hWnd
);
149 if (hWndParent
== NULL
)
150 hWndParent
= GetDesktopWindow();
152 GetWindowRect(hWndParent
, &rcParent
);
153 GetWindowRect(hWnd
, &rcWindow
);
157 ((rcParent
.right
- rcParent
.left
) - (rcWindow
.right
- rcWindow
.left
)) / 2,
158 ((rcParent
.bottom
- rcParent
.top
) - (rcWindow
.bottom
- rcWindow
.top
)) / 2,
165 /* Find the drive with the inserted VMware cd-rom */
167 IsVMwareCDInDrive(WCHAR
*Drv
)
169 static WCHAR Drive
[4] = L
"X:\\";
173 for(Current
= 'C'; Current
<= 'Z'; Current
++)
177 if(GetDriveType(Drive
) == DRIVE_CDROM
)
180 PathToVideoDrivers60
[0] = Current
;
181 PathToVideoDrivers55
[0] = Current
;
182 PathToVideoDrivers40
[0] = Current
;
183 PathToVideoDrivers45
[0] = Current
;
184 if(SetCurrentDirectory(PathToVideoDrivers60
))
185 SrcPath
= PathToVideoDrivers60
;
186 else if(SetCurrentDirectory(PathToVideoDrivers55
))
187 SrcPath
= PathToVideoDrivers55
;
188 else if(SetCurrentDirectory(PathToVideoDrivers45
))
189 SrcPath
= PathToVideoDrivers45
;
190 else if(SetCurrentDirectory(PathToVideoDrivers40
))
191 SrcPath
= PathToVideoDrivers40
;
194 SetCurrentDirectory(DestinationPath
);
198 if(DoesFileExist(SrcPath
, vmx_fb
) &&
199 (DoesFileExist(SrcPath
, vmx_mode
) || DoesFileExist(SrcPath
, vmx_mode_v6
)) &&
200 DoesFileExist(SrcPath
, vmx_svga
))
214 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
217 DWORD Type
, Size
= sizeof(DWORD
);
219 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
220 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
221 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
223 DEVMODE CurrentDevMode
;
225 /* If this key is absent, just get current settings */
226 memset(&CurrentDevMode
, 0, sizeof(CurrentDevMode
));
227 CurrentDevMode
.dmSize
= sizeof(CurrentDevMode
);
228 if (EnumDisplaySettings(NULL
, ENUM_CURRENT_SETTINGS
, &CurrentDevMode
) == TRUE
)
230 *ColDepth
= CurrentDevMode
.dmBitsPerPel
;
231 *ResX
= CurrentDevMode
.dmPelsWidth
;
232 *ResY
= CurrentDevMode
.dmPelsHeight
;
238 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
242 Size
= sizeof(DWORD
);
245 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
249 Size
= sizeof(DWORD
);
252 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
263 IsVmwSVGAEnabled(VOID
)
266 DWORD Type
, Size
, Value
;
268 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
269 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
270 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
274 Size
= sizeof(DWORD
);
275 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
289 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
294 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
295 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
296 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
300 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
306 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
312 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
318 if(RegSetValueEx(hReg
, L
"DefaultSettings.VRefresh", 0, REG_DWORD
, (BYTE
*)&VFreq
, sizeof(DWORD
)) != ERROR_SUCCESS
)
329 EnableDriver(WCHAR
*Key
, BOOL Enable
)
334 Value
= (Enable
? 1 : 4);
336 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
340 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
350 /* Activate the vmware driver and deactivate the others */
352 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
354 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
358 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
362 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
373 /* Property page dialog callback */
374 static INT_PTR CALLBACK
382 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
389 /* Center the wizard window */
390 hwndControl
= GetParent(hwndDlg
);
391 CenterWindow (hwndControl
);
397 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
404 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
416 /* Property page dialog callback */
417 static INT_PTR CALLBACK
429 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
433 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
436 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
446 InstTerminateInstaller(BOOL Wait
)
448 if(hInstallationThread
!= NULL
)
452 InterlockedExchange((LONG
*)&AbortInstall
, 2);
453 WaitForSingleObject(hInstallationThread
, INFINITE
);
457 InterlockedExchange((LONG
*)&AbortInstall
, 1);
463 InstInstallationThread(LPVOID lpParameter
)
466 WCHAR InfFileName
[1024];
468 int DrivesTested
= 0;
470 if(AbortInstall
!= 0) goto done
;
471 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
473 while(AbortInstall
== 0)
476 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
479 if(DrivesTested
++ > 20)
481 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
486 if(AbortInstall
!= 0) goto done
;
487 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
489 wcscpy(InfFileName
, SrcPath
);
490 wcscat(InfFileName
, L
"vmx_svga.inf");
491 DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
492 if (!UpdateDriverForPlugAndPlayDevices(
493 hInstallationNotifyWnd
,
494 L
"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
510 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
513 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
518 hThread
= InterlockedExchangePointer((PVOID
*)&hInstallationThread
, 0);
521 CloseHandle(hThread
);
527 InstStartInstallationThread(HWND hwndNotify
)
529 if(hInstallationThread
== NULL
)
532 hInstallationNotifyWnd
= hwndNotify
;
534 hInstallationThread
= CreateThread(NULL
,
536 InstInstallationThread
,
540 if(hInstallationThread
== NULL
)
545 ResumeThread(hInstallationThread
);
552 /* Property page dialog callback */
553 static INT_PTR CALLBACK
565 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
569 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, L
"");
570 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
571 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
572 InstStartInstallationThread(hwndDlg
);
575 InstTerminateInstaller(TRUE
);
578 if(hInstallationThread
!= NULL
)
580 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
581 InstTerminateInstaller(FALSE
);
582 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, -1);
587 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
588 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
595 /* go back in case we aborted the installation thread */
596 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
597 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
601 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
602 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
605 case WM_INSTCOMPLETE
:
606 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
607 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
608 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
610 case WM_INSTSTATUSUPDATE
:
613 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
614 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
621 /* Property page dialog callback */
622 static INT_PTR CALLBACK
623 PageInstallFailedProc(
634 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
638 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
648 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
653 for(i
= From
; i
<= To
; i
++)
655 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
657 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
669 /* Property page dialog callback */
670 static INT_PTR CALLBACK
678 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
683 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
686 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
687 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
689 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
705 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
713 /* Center the wizard window */
714 hwndControl
= GetParent(hwndDlg
);
715 CenterWindow (hwndControl
);
721 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
726 if(StartVMwConfigWizard
)
728 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
733 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
740 DWORD rx
= 800, ry
= 600, cd
= 32;
742 static MAPCTLRES Resolutions
[11] = {
755 for(i
= 0; i
< 11; i
++)
757 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
759 rx
= Resolutions
[i
].ResX
;
760 ry
= Resolutions
[i
].ResY
;
765 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
778 SaveResolutionSettings(rx
, ry
, cd
);
788 /* Property page dialog callback */
789 static INT_PTR CALLBACK
790 PageChooseActionProc(
800 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
804 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
808 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
812 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
817 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
820 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
822 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
828 UninstallDriver
= (i
== IDC_UNINSTALL
);
830 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
840 /* Property page dialog callback */
841 static INT_PTR CALLBACK
842 PageSelectDriverProc(
852 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
856 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
860 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
864 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
869 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
883 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
884 if(!EnableVmwareDriver(ActivateVBE
,
889 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
890 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
891 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
904 ShowUninstNotice(HWND Owner
)
907 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
908 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
911 static INT_PTR CALLBACK
923 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
927 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
933 if(!EnableVmwareDriver(ActivateVBE
,
938 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
939 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
940 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
943 ShowUninstNotice(GetParent(hwndDlg
));
958 HPROPSHEETPAGE ahpsp
[8];
962 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
964 /* Create the Welcome page */
965 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
966 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
967 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
968 psp
.hInstance
= hAppInstance
;
969 psp
.pfnDlgProc
= PageWelcomeProc
;
970 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
971 ahpsp
[0] = CreatePropertySheetPage(&psp
);
973 /* Create the INSERT_VMWARE_TOOLS page */
974 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
975 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSTITLE
);
976 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSSUBTITLE
);
977 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLS
);
978 psp
.pfnDlgProc
= PageInsertDiscProc
;
979 ahpsp
[1] = CreatePropertySheetPage(&psp
);
981 /* Create the INSTALLING_VMWARE_TOOLS page */
982 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
983 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSTITLE
);
984 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSSUBTITLE
);
985 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLS
);
986 psp
.pfnDlgProc
= PageInstallingProc
;
987 ahpsp
[2] = CreatePropertySheetPage(&psp
);
989 /* Create the CONFIG page */
990 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
991 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CONFIGTITLE
);
992 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CONFIGSUBTITLE
);
993 psp
.pfnDlgProc
= PageConfigProc
;
994 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CONFIG
);
995 ahpsp
[3] = CreatePropertySheetPage(&psp
);
997 /* Create the INSTALLATION_FAILED page */
998 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
999 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDTITLE
);
1000 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDSUBTITLE
);
1001 psp
.pfnDlgProc
= PageInstallFailedProc
;
1002 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILED
);
1003 ahpsp
[4] = CreatePropertySheetPage(&psp
);
1005 /* Create the CHOOSEACTION page */
1006 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1007 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONTITLE
);
1008 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONSUBTITLE
);
1009 psp
.pfnDlgProc
= PageChooseActionProc
;
1010 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CHOOSEACTION
);
1011 ahpsp
[5] = CreatePropertySheetPage(&psp
);
1013 /* Create the SELECTDRIVER page */
1014 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1015 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERTITLE
);
1016 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE
);
1017 psp
.pfnDlgProc
= PageSelectDriverProc
;
1018 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTDRIVER
);
1019 ahpsp
[6] = CreatePropertySheetPage(&psp
);
1021 /* Create the DOUNINSTALL page */
1022 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1023 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLTITLE
);
1024 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE
);
1025 psp
.pfnDlgProc
= PageDoUninstallProc
;
1026 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_DOUNINSTALL
);
1027 ahpsp
[7] = CreatePropertySheetPage(&psp
);
1029 /* Create the property sheet */
1030 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
1031 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
1032 psh
.hInstance
= hAppInstance
;
1033 psh
.hwndParent
= NULL
;
1035 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
1037 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
1038 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
1040 /* Display the wizard */
1041 return (LONG
)(PropertySheet(&psh
) != -1);
1045 wWinMain(HINSTANCE hInstance
,
1046 HINSTANCE hPrevInstance
,
1054 hAppInstance
= hInstance
;
1056 if(!DetectVMware(&Version
))
1061 lc
= DestinationPath
;
1062 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1063 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1065 wcscat(DestinationPath
, L
"\\");
1067 DestinationDriversPath
[0] = L
'\0';
1068 wcscat(DestinationDriversPath
, DestinationPath
);
1069 wcscat(DestinationDriversPath
, L
"drivers\\");
1071 SetCurrentDirectory(DestinationPath
);
1073 DriverFilesFound
= DoesFileExist(DestinationPath
, vmx_fb
) &&
1074 DoesFileExist(DestinationPath
, vmx_mode
) &&
1075 DoesFileExist(DestinationDriversPath
, vmx_svga
);
1077 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1079 /* Show the wizard */