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.
23 * COPYRIGHT: See COPYING in the top level directory
24 * PROJECT: ReactOS VMware(r) driver installation utility
25 * FILE: subsys/system/vmwinst/vmwinst.c
26 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
34 HINSTANCE hAppInstance
;
35 BOOL StartVMwConfigWizard
, DriverFilesFound
, ActivateVBE
= FALSE
, UninstallDriver
= FALSE
;
37 static WCHAR DestinationDriversPath
[MAX_PATH
+1];
38 static WCHAR CDDrive
= L
'\0';
39 static WCHAR PathToVideoDrivers45
[MAX_PATH
+1] = L
"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\";
40 static WCHAR PathToVideoDrivers40
[MAX_PATH
+1] = L
"X:\\video\\winnt2k\\";
41 static WCHAR DestinationPath
[MAX_PATH
+1];
42 static WCHAR
*vmx_fb
= L
"vmx_fb.dll";
43 static WCHAR
*vmx_mode
= L
"vmx_mode.dll";
44 static WCHAR
*vmx_svga
= L
"vmx_svga.sys";
46 static WCHAR
*SrcPath
= PathToVideoDrivers45
;
48 static HANDLE hInstallationThread
= NULL
;
49 static HWND hInstallationNotifyWnd
= NULL
;
50 static LONG AbortInstall
= 0;
51 #define WM_INSTABORT (WM_USER + 2)
52 #define WM_INSTCOMPLETE (WM_USER + 3)
53 #define WM_INSTSTATUSUPDATE (WM_USER + 4)
55 /* Helper functions */
57 LONG WINAPI
ExceptionHandler(LPEXCEPTION_POINTERS ExceptionInfo
)
59 /* This is rude, but i don't know how to continue execution properly, that's why
60 we just exit here when we're not running inside of VMware */
61 ExitProcess(ExceptionInfo
->ExceptionRecord
->ExceptionCode
== STATUS_PRIVILEGED_INSTRUCTION
);
62 return EXCEPTION_CONTINUE_EXECUTION
;
66 DetectVMware(int *Version
)
73 /* Try using a VMware I/O port. If not running in VMware this'll throw an
75 __asm__
__volatile__("inl %%dx, %%eax"
76 : "=a" (ver
), "=b" (magic
)
77 : "0" (0x564d5868), "d" (0x5658), "c" (0xa));
79 if(magic
== 0x564d5868)
92 if(PeekMessage(&msg
, 0, 0, 0, PM_REMOVE
))
94 TranslateMessage(&msg
);
95 DispatchMessage(&msg
);
102 ProcessMessages(void)
104 while(ProcessMessage());
107 /* try to open the file */
109 FileExists(WCHAR
*Path
, WCHAR
*File
)
111 WCHAR FileName
[MAX_PATH
+ 1];
115 wcscat(FileName
, Path
);
116 wcscat(FileName
, File
);
118 FileHandle
= CreateFile(FileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
120 if(FileHandle
== INVALID_HANDLE_VALUE
)
125 if(GetFileSize(FileHandle
, NULL
) <= 0)
127 CloseHandle(FileHandle
);
131 CloseHandle(FileHandle
);
137 InstallFile(WCHAR
*Destination
, WCHAR
*File
)
139 static char Buffer
[1024];
140 WCHAR SourceFileName
[MAX_PATH
+ 1];
141 WCHAR DestFileName
[MAX_PATH
+ 1];
142 HANDLE SourceFileHandle
, DestFileHandle
;
143 DWORD DataRead
, DataWritten
;
145 SourceFileName
[0] = L
'\0';
146 DestFileName
[0] = L
'\0';
147 wcscat(SourceFileName
, SrcPath
);
148 wcscat(SourceFileName
, File
);
149 wcscat(DestFileName
, Destination
);
150 wcscat(DestFileName
, File
);
152 SourceFileHandle
= CreateFile(SourceFileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
153 if(SourceFileHandle
== INVALID_HANDLE_VALUE
)
157 DestFileHandle
= CreateFile(DestFileName
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
158 if(DestFileHandle
== INVALID_HANDLE_VALUE
)
160 CloseHandle(SourceFileHandle
);
164 while(ReadFile(SourceFileHandle
, Buffer
, sizeof(Buffer
), &DataRead
, NULL
) && DataRead
> 0)
166 if(!WriteFile(DestFileHandle
, Buffer
, DataRead
, &DataWritten
, NULL
) ||
167 DataRead
!= DataWritten
)
169 CloseHandle(SourceFileHandle
);
170 CloseHandle(DestFileHandle
);
171 DeleteFile(DestFileName
);
176 CloseHandle(SourceFileHandle
);
177 CloseHandle(DestFileHandle
);
181 /* Find the drive with the inserted VMware cd-rom */
183 IsVMwareCDInDrive(WCHAR
*Drv
)
185 static WCHAR Drive
[4] = L
"X:\\";
189 for(Current
= 'C'; Current
<= 'Z'; Current
++)
193 if(GetDriveType(Drive
) == DRIVE_CDROM
)
196 PathToVideoDrivers40
[0] = Current
;
197 PathToVideoDrivers45
[0] = Current
;
198 if(SetCurrentDirectory(PathToVideoDrivers45
))
199 SrcPath
= PathToVideoDrivers45
;
200 else if(SetCurrentDirectory(PathToVideoDrivers40
))
201 SrcPath
= PathToVideoDrivers40
;
204 SetCurrentDirectory(DestinationPath
);
208 if(FileExists(SrcPath
, vmx_fb
) &&
209 FileExists(SrcPath
, vmx_mode
) &&
210 FileExists(SrcPath
, vmx_svga
))
224 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
229 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
230 L
"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
231 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
235 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
242 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
249 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
261 IsVmwSVGAEnabled(VOID
)
264 DWORD Type
, Size
, Value
;
266 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
267 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
268 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
272 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
286 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
290 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
291 L
"SYSTEM\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\vmx_svga\\Device0",
292 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
296 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
302 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
308 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
319 EnableDriver(WCHAR
*Key
, BOOL Enable
)
324 Value
= (Enable
? 1 : 4);
326 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
330 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
340 /* Activate the vmware driver and deactivate the others */
342 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
344 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
348 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
352 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
363 InitPropSheetPage(PROPSHEETPAGE
*psp
, WORD idDlg
, DWORD Flags
, DLGPROC DlgProc
)
365 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
366 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
367 psp
->dwFlags
= PSP_DEFAULT
| Flags
;
368 psp
->hInstance
= hAppInstance
;
369 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
370 psp
->pfnDlgProc
= DlgProc
;
373 /* Property page dialog callback */
386 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
391 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
398 if(!EnableVmwareDriver(FALSE
, FALSE
, TRUE
))
401 LoadString(hAppInstance
, IDS_FAILEDTOACTIVATEDRIVER
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
402 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
403 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
406 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
418 /* Property page dialog callback */
431 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
435 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
438 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
448 InstTerminateInstaller(BOOL Wait
)
450 if(hInstallationThread
!= NULL
)
454 InterlockedExchange((LONG
*)&AbortInstall
, 2);
455 WaitForSingleObject(hInstallationThread
, INFINITE
);
459 InterlockedExchange((LONG
*)&AbortInstall
, 1);
465 InstInstallationThread(LPVOID lpParameter
)
469 int DrivesTested
= 0;
471 if(AbortInstall
!= 0) goto done
;
472 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
474 while(AbortInstall
== 0)
477 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
480 if(DrivesTested
++ > 20)
482 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
487 if(AbortInstall
!= 0) goto done
;
488 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
490 if(AbortInstall
!= 0) goto done
;
491 if(!InstallFile(DestinationPath
, vmx_fb
))
493 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOCOPYFILES
, 0);
499 if(AbortInstall
!= 0) goto done
;
500 if(!InstallFile(DestinationPath
, vmx_mode
))
502 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOCOPYFILES
, 0);
508 if(AbortInstall
!= 0) goto done
;
509 if(!InstallFile(DestinationDriversPath
, vmx_svga
))
511 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOCOPYFILES
, 0);
517 if(AbortInstall
!= 0) goto done
;
518 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_ENABLINGDRIVER
, 0);
519 if(!EnableVmwareDriver(FALSE
, FALSE
, TRUE
))
521 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOACTIVATEDRIVER
, 0);
531 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
534 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
539 hThread
= (HANDLE
)InterlockedExchange((LONG
*)&hInstallationThread
, 0);
542 CloseHandle(hThread
);
548 InstStartInstallationThread(HWND hwndNotify
)
550 if(hInstallationThread
== NULL
)
553 hInstallationNotifyWnd
= hwndNotify
;
555 hInstallationThread
= CreateThread(NULL
,
557 InstInstallationThread
,
561 if(hInstallationThread
== NULL
)
566 ResumeThread(hInstallationThread
);
573 /* Property page dialog callback */
586 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
590 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, NULL
);
591 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
592 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
593 InstStartInstallationThread(hwndDlg
);
596 InstTerminateInstaller(TRUE
);
599 if(hInstallationThread
!= NULL
)
601 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
602 InstTerminateInstaller(FALSE
);
603 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, -1);
608 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
609 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
616 /* go back in case we aborted the installation thread */
617 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
618 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
622 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
623 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
626 case WM_INSTCOMPLETE
:
627 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
628 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
629 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
631 case WM_INSTSTATUSUPDATE
:
634 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
635 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
642 /* Property page dialog callback */
644 PageInstallFailedProc(
655 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
659 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
669 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
674 for(i
= From
; i
<= To
; i
++)
676 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
678 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
690 /* Property page dialog callback */
703 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
706 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
707 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
709 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
725 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
731 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
736 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
741 if(StartVMwConfigWizard
)
743 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
748 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
755 DWORD rx
= 800, ry
= 600, cd
= 32;
757 static MAPCTLRES Resolutions
[11] = {
770 for(i
= 0; i
< 11; i
++)
772 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
774 rx
= Resolutions
[i
].ResX
;
775 ry
= Resolutions
[i
].ResY
;
780 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
793 SaveResolutionSettings(rx
, ry
, cd
);
803 /* Property page dialog callback */
805 PageChooseActionProc(
815 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
819 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
823 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
827 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
832 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
835 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
837 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
843 UninstallDriver
= (i
== IDC_UNINSTALL
);
845 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
855 /* Property page dialog callback */
857 PageSelectDriverProc(
867 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
871 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
875 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
879 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
884 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
898 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
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
);
919 ShowUninstNotice(HWND Owner
)
922 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
923 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
938 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
942 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
948 if(!EnableVmwareDriver(ActivateVBE
,
953 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
954 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
955 SetWindowLong(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
958 ShowUninstNotice(GetParent(hwndDlg
));
972 PROPSHEETPAGE psp
[8];
976 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
978 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
979 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
980 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
981 psh
.hwndParent
= NULL
;
982 psh
.hInstance
= hAppInstance
;
984 psh
.pszCaption
= Caption
;
986 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
988 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
989 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
991 InitPropSheetPage(&psp
[0], IDD_WELCOMEPAGE
, PSP_HIDEHEADER
, PageWelcomeProc
);
992 InitPropSheetPage(&psp
[1], IDD_INSERT_VMWARE_TOOLS
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageInsertDiscProc
);
993 InitPropSheetPage(&psp
[2], IDD_INSTALLING_VMWARE_TOOLS
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageInstallingProc
);
994 InitPropSheetPage(&psp
[3], IDD_CONFIG
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageConfigProc
);
995 InitPropSheetPage(&psp
[4], IDD_INSTALLATION_FAILED
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageInstallFailedProc
);
996 InitPropSheetPage(&psp
[5], IDD_CHOOSEACTION
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageChooseActionProc
);
997 InitPropSheetPage(&psp
[6], IDD_SELECTDRIVER
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageSelectDriverProc
);
998 InitPropSheetPage(&psp
[7], IDD_DOUNINSTALL
, PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
, PageDoUninstallProc
);
1000 return (LONG
)(PropertySheet(&psh
) != -1);
1004 WinMain(HINSTANCE hInstance
,
1005 HINSTANCE hPrevInstance
,
1009 LPTOP_LEVEL_EXCEPTION_FILTER OldHandler
;
1013 hAppInstance
= hInstance
;
1015 /* Setup our exception "handler" ;-) */
1016 OldHandler
= SetUnhandledExceptionFilter(ExceptionHandler
);
1018 if(!DetectVMware(&Version
))
1024 /* restore the exception handler */
1025 SetUnhandledExceptionFilter(OldHandler
);
1027 lc
= DestinationPath
;
1028 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1029 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1031 wcscat(DestinationPath
, L
"\\");
1033 DestinationDriversPath
[0] = L
'\0';
1034 wcscat(DestinationDriversPath
, DestinationPath
);
1035 wcscat(DestinationDriversPath
, L
"drivers\\");
1037 SetCurrentDirectory(DestinationPath
);
1039 DriverFilesFound
= FileExists(DestinationPath
, vmx_fb
) &&
1040 FileExists(DestinationPath
, vmx_mode
) &&
1041 FileExists(DestinationDriversPath
, vmx_svga
);
1043 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1045 /* Show the wizard */