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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * VMware is a registered trademark of VMware, Inc.
22 * COPYRIGHT: See COPYING in the top level directory
23 * PROJECT: ReactOS VMware(r) driver installation utility
24 * FILE: subsys/system/vmwinst/vmwinst.c
25 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
26 * Klemens Friedl (frik85@hotmail.com)
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 LONG CALLBACK
VectoredExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo
)
68 /* we're not running in VMware, just terminate the process */
69 ExitProcess(ExceptionInfo
->ExceptionRecord
->ExceptionCode
== EXCEPTION_PRIV_INSTRUCTION
);
70 return EXCEPTION_CONTINUE_EXECUTION
;
74 DetectVMware(int *Version
)
81 /* Try using a VMware I/O port. If not running in VMware this'll throw an
84 __asm__
__volatile__("inl %%dx, %%eax"
85 : "=a" (ver
), "=b" (magic
)
86 : "0" (0x564d5868), "d" (0x5658), "c" (0xa));
88 #error PLEASE WRITE THIS IN ASSEMBLY
92 if(magic
== 0x564d5868)
101 /* try to open the file */
103 FileExists(WCHAR
*Path
, WCHAR
*File
)
105 WCHAR FileName
[MAX_PATH
+ 1];
109 wcscat(FileName
, Path
);
110 wcscat(FileName
, File
);
112 FileHandle
= CreateFile(FileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
114 if(FileHandle
== INVALID_HANDLE_VALUE
)
116 /* If it was a sharing violation the file must already exist */
117 return GetLastError() == ERROR_SHARING_VIOLATION
;
120 if(GetFileSize(FileHandle
, NULL
) <= 0)
122 CloseHandle(FileHandle
);
126 CloseHandle(FileHandle
);
131 CenterWindow(HWND hWnd
)
137 hWndParent
= GetParent(hWnd
);
138 if (hWndParent
== NULL
)
139 hWndParent
= GetDesktopWindow();
141 GetWindowRect(hWndParent
, &rcParent
);
142 GetWindowRect(hWnd
, &rcWindow
);
146 ((rcParent
.right
- rcParent
.left
) - (rcWindow
.right
- rcWindow
.left
)) / 2,
147 ((rcParent
.bottom
- rcParent
.top
) - (rcWindow
.bottom
- rcWindow
.top
)) / 2,
154 /* Find the drive with the inserted VMware cd-rom */
156 IsVMwareCDInDrive(WCHAR
*Drv
)
158 static WCHAR Drive
[4] = L
"X:\\";
162 for(Current
= 'C'; Current
<= 'Z'; Current
++)
166 if(GetDriveType(Drive
) == DRIVE_CDROM
)
169 PathToVideoDrivers60
[0] = Current
;
170 PathToVideoDrivers55
[0] = Current
;
171 PathToVideoDrivers40
[0] = Current
;
172 PathToVideoDrivers45
[0] = Current
;
173 if(SetCurrentDirectory(PathToVideoDrivers60
))
174 SrcPath
= PathToVideoDrivers60
;
175 else if(SetCurrentDirectory(PathToVideoDrivers55
))
176 SrcPath
= PathToVideoDrivers55
;
177 else if(SetCurrentDirectory(PathToVideoDrivers45
))
178 SrcPath
= PathToVideoDrivers45
;
179 else if(SetCurrentDirectory(PathToVideoDrivers40
))
180 SrcPath
= PathToVideoDrivers40
;
183 SetCurrentDirectory(DestinationPath
);
187 if(FileExists(SrcPath
, vmx_fb
) &&
188 (FileExists(SrcPath
, vmx_mode
) || FileExists(SrcPath
, vmx_mode_v6
)) &&
189 FileExists(SrcPath
, vmx_svga
))
203 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
208 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
209 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
210 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
214 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
220 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
226 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
237 IsVmwSVGAEnabled(VOID
)
240 DWORD Type
, Size
, Value
;
242 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
243 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
244 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
248 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
262 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
266 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
267 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
268 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
272 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
278 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
284 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
295 EnableDriver(WCHAR
*Key
, BOOL Enable
)
300 Value
= (Enable
? 1 : 4);
302 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
306 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
316 /* Activate the vmware driver and deactivate the others */
318 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
320 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
324 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
328 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
339 /* Property page dialog callback */
340 static INT_PTR CALLBACK
348 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
355 /* Center the wizard window */
356 hwndControl
= GetParent(hwndDlg
);
357 CenterWindow (hwndControl
);
363 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
370 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
382 /* Property page dialog callback */
383 static INT_PTR CALLBACK
395 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
399 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
402 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
412 InstTerminateInstaller(BOOL Wait
)
414 if(hInstallationThread
!= NULL
)
418 InterlockedExchange((LONG
*)&AbortInstall
, 2);
419 WaitForSingleObject(hInstallationThread
, INFINITE
);
423 InterlockedExchange((LONG
*)&AbortInstall
, 1);
429 InstInstallationThread(LPVOID lpParameter
)
432 WCHAR InfFileName
[1024];
434 int DrivesTested
= 0;
436 if(AbortInstall
!= 0) goto done
;
437 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
439 while(AbortInstall
== 0)
442 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
445 if(DrivesTested
++ > 20)
447 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
452 if(AbortInstall
!= 0) goto done
;
453 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
455 wcscpy(InfFileName
, SrcPath
);
456 wcscat(InfFileName
, L
"vmx_svga.inf");
457 DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
458 if (!UpdateDriverForPlugAndPlayDevices(
459 hInstallationNotifyWnd
,
460 L
"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
476 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
479 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
484 hThread
= (HANDLE
)InterlockedExchange((LONG
*)&hInstallationThread
, 0);
487 CloseHandle(hThread
);
493 InstStartInstallationThread(HWND hwndNotify
)
495 if(hInstallationThread
== NULL
)
498 hInstallationNotifyWnd
= hwndNotify
;
500 hInstallationThread
= CreateThread(NULL
,
502 InstInstallationThread
,
506 if(hInstallationThread
== NULL
)
511 ResumeThread(hInstallationThread
);
518 /* Property page dialog callback */
519 static INT_PTR CALLBACK
531 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
535 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, NULL
);
536 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
537 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
538 InstStartInstallationThread(hwndDlg
);
541 InstTerminateInstaller(TRUE
);
544 if(hInstallationThread
!= NULL
)
546 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
547 InstTerminateInstaller(FALSE
);
548 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, -1);
553 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
554 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
561 /* go back in case we aborted the installation thread */
562 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
563 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
567 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
568 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
571 case WM_INSTCOMPLETE
:
572 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
573 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
574 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
576 case WM_INSTSTATUSUPDATE
:
579 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
580 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
587 /* Property page dialog callback */
588 static INT_PTR CALLBACK
589 PageInstallFailedProc(
600 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
604 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
614 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
619 for(i
= From
; i
<= To
; i
++)
621 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
623 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
635 /* Property page dialog callback */
636 static INT_PTR CALLBACK
644 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
649 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
652 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
653 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
655 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
671 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
679 /* Center the wizard window */
680 hwndControl
= GetParent(hwndDlg
);
681 CenterWindow (hwndControl
);
687 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
692 if(StartVMwConfigWizard
)
694 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
699 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
706 DWORD rx
= 800, ry
= 600, cd
= 32;
708 static MAPCTLRES Resolutions
[11] = {
721 for(i
= 0; i
< 11; i
++)
723 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
725 rx
= Resolutions
[i
].ResX
;
726 ry
= Resolutions
[i
].ResY
;
731 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
744 SaveResolutionSettings(rx
, ry
, cd
);
754 /* Property page dialog callback */
755 static INT_PTR CALLBACK
756 PageChooseActionProc(
766 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
770 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
774 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
778 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
783 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
786 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
788 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
794 UninstallDriver
= (i
== IDC_UNINSTALL
);
796 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
806 /* Property page dialog callback */
807 static INT_PTR CALLBACK
808 PageSelectDriverProc(
818 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
822 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
826 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
830 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
835 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
849 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
850 if(!EnableVmwareDriver(ActivateVBE
,
855 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
856 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
857 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
870 ShowUninstNotice(HWND Owner
)
873 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
874 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
877 static INT_PTR CALLBACK
889 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
893 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
899 if(!EnableVmwareDriver(ActivateVBE
,
904 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
905 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
906 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
909 ShowUninstNotice(GetParent(hwndDlg
));
924 HPROPSHEETPAGE ahpsp
[8];
928 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
930 /* Create the Welcome page */
931 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
932 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
933 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
934 psp
.hInstance
= hAppInstance
;
935 psp
.pfnDlgProc
= PageWelcomeProc
;
936 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
937 ahpsp
[0] = CreatePropertySheetPage(&psp
);
939 /* Create the INSERT_VMWARE_TOOLS page */
940 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
941 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSTITLE
);
942 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSSUBTITLE
);
943 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLS
);
944 psp
.pfnDlgProc
= PageInsertDiscProc
;
945 ahpsp
[1] = CreatePropertySheetPage(&psp
);
947 /* Create the INSTALLING_VMWARE_TOOLS page */
948 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
949 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSTITLE
);
950 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSSUBTITLE
);
951 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLS
);
952 psp
.pfnDlgProc
= PageInstallingProc
;
953 ahpsp
[2] = CreatePropertySheetPage(&psp
);
955 /* Create the CONFIG page */
956 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
957 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CONFIGTITLE
);
958 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CONFIGSUBTITLE
);
959 psp
.pfnDlgProc
= PageConfigProc
;
960 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CONFIG
);
961 ahpsp
[3] = CreatePropertySheetPage(&psp
);
963 /* Create the INSTALLATION_FAILED page */
964 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
965 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDTITLE
);
966 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDSUBTITLE
);
967 psp
.pfnDlgProc
= PageInstallFailedProc
;
968 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILED
);
969 ahpsp
[4] = CreatePropertySheetPage(&psp
);
971 /* Create the CHOOSEACTION page */
972 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
973 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONTITLE
);
974 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONSUBTITLE
);
975 psp
.pfnDlgProc
= PageChooseActionProc
;
976 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CHOOSEACTION
);
977 ahpsp
[5] = CreatePropertySheetPage(&psp
);
979 /* Create the SELECTDRIVER page */
980 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
981 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERTITLE
);
982 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE
);
983 psp
.pfnDlgProc
= PageSelectDriverProc
;
984 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTDRIVER
);
985 ahpsp
[6] = CreatePropertySheetPage(&psp
);
987 /* Create the DOUNINSTALL page */
988 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
989 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLTITLE
);
990 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE
);
991 psp
.pfnDlgProc
= PageDoUninstallProc
;
992 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_DOUNINSTALL
);
993 ahpsp
[7] = CreatePropertySheetPage(&psp
);
995 /* Create the property sheet */
996 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
997 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
998 psh
.hInstance
= hAppInstance
;
999 psh
.hwndParent
= NULL
;
1001 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
1003 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
1004 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
1006 /* Display the wizard */
1007 return (LONG
)(PropertySheet(&psh
) != -1);
1011 WinMain(HINSTANCE hInstance
,
1012 HINSTANCE hPrevInstance
,
1017 PVOID ExceptionHandler
;
1021 hAppInstance
= hInstance
;
1023 /* Setup a vectored exception handler to protect the detection. Don't use SEH
1024 here so we notice the next time someone removes support for vectored
1025 exception handling from ros... */
1026 if (!(ExceptionHandler
= AddVectoredExceptionHandler(0,
1027 VectoredExceptionHandler
)))
1032 if(!DetectVMware(&Version
))
1037 /* unregister the handler */
1038 RemoveVectoredExceptionHandler(ExceptionHandler
);
1040 lc
= DestinationPath
;
1041 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1042 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1044 wcscat(DestinationPath
, L
"\\");
1046 DestinationDriversPath
[0] = L
'\0';
1047 wcscat(DestinationDriversPath
, DestinationPath
);
1048 wcscat(DestinationDriversPath
, L
"drivers\\");
1050 SetCurrentDirectory(DestinationPath
);
1052 DriverFilesFound
= FileExists(DestinationPath
, vmx_fb
) &&
1053 FileExists(DestinationPath
, vmx_mode
) &&
1054 FileExists(DestinationDriversPath
, vmx_svga
);
1056 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1058 /* Show the wizard */