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)
35 #include <pseh/pseh2.h>
40 extern VOID CALLBACK
InstallHinfSectionW(HWND hwnd
, HINSTANCE ModuleHandle
,
41 PCWSTR CmdLineBuffer
, INT nCmdShow
);
44 HINSTANCE hAppInstance
;
45 BOOL StartVMwConfigWizard
, DriverFilesFound
, ActivateVBE
= FALSE
, UninstallDriver
= FALSE
;
47 static WCHAR DestinationDriversPath
[MAX_PATH
+1];
48 static WCHAR CDDrive
= L
'\0';
49 static WCHAR PathToVideoDrivers60
[MAX_PATH
+1] = L
"X:\\program files\\VMWare\\VMWare Tools\\Drivers\\video\\2k\\32bit\\";
50 static WCHAR PathToVideoDrivers55
[MAX_PATH
+1] = L
"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\32Bit\\";
51 static WCHAR PathToVideoDrivers45
[MAX_PATH
+1] = L
"X:\\program files\\VMware\\VMware Tools\\Drivers\\video\\winnt2k\\";
52 static WCHAR PathToVideoDrivers40
[MAX_PATH
+1] = L
"X:\\video\\winnt2k\\";
53 static WCHAR DestinationPath
[MAX_PATH
+1];
54 static WCHAR
*vmx_fb
= L
"vmx_fb.dll";
55 static WCHAR
*vmx_mode
= L
"vmx_mode.dll";
56 static WCHAR
*vmx_mode_v6
= L
"vmx mode.dll";
57 static WCHAR
*vmx_svga
= L
"vmx_svga.sys";
59 static WCHAR
*SrcPath
= PathToVideoDrivers45
;
61 static HANDLE hInstallationThread
= NULL
;
62 static HWND hInstallationNotifyWnd
= NULL
;
63 static LONG AbortInstall
= 0;
64 #define WM_INSTABORT (WM_USER + 2)
65 #define WM_INSTCOMPLETE (WM_USER + 3)
66 #define WM_INSTSTATUSUPDATE (WM_USER + 4)
68 /* Helper functions */
70 DetectVMware(int *Version
)
79 /* Try using a VMware I/O port. If not running in VMware this'll throw an
82 __asm__
__volatile__("inl %%dx, %%eax"
83 : "=a" (ver
), "=b" (magic
)
84 : "0" (0x564d5868), "d" (0x5658), "c" (0xa));
85 #elif defined(_MSC_VER) && defined(_M_IX86)
97 #elif defined(_MSC_VER) && defined(_M_AMD64)
98 DPRINT1("DetectVMware stub\n");
99 _SEH2_YIELD(return FALSE
);
104 _SEH2_EXCEPT(_SEH2_GetExceptionCode() == EXCEPTION_PRIV_INSTRUCTION
? EXCEPTION_EXECUTE_HANDLER
: EXCEPTION_CONTINUE_SEARCH
)
106 _SEH2_YIELD(return FALSE
);
110 if(magic
== 0x564d5868)
119 /* try to open the file */
121 DoesFileExist(WCHAR
*Path
, WCHAR
*File
)
123 WCHAR FileName
[MAX_PATH
+ 1];
127 wcscat(FileName
, Path
);
128 wcscat(FileName
, File
);
130 FileHandle
= CreateFile(FileName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
132 if(FileHandle
== INVALID_HANDLE_VALUE
)
134 /* If it was a sharing violation the file must already exist */
135 return GetLastError() == ERROR_SHARING_VIOLATION
;
138 if(GetFileSize(FileHandle
, NULL
) <= 0)
140 CloseHandle(FileHandle
);
144 CloseHandle(FileHandle
);
149 CenterWindow(HWND hWnd
)
155 hWndParent
= GetParent(hWnd
);
156 if (hWndParent
== NULL
)
157 hWndParent
= GetDesktopWindow();
159 GetWindowRect(hWndParent
, &rcParent
);
160 GetWindowRect(hWnd
, &rcWindow
);
164 ((rcParent
.right
- rcParent
.left
) - (rcWindow
.right
- rcWindow
.left
)) / 2,
165 ((rcParent
.bottom
- rcParent
.top
) - (rcWindow
.bottom
- rcWindow
.top
)) / 2,
172 /* Find the drive with the inserted VMware cd-rom */
174 IsVMwareCDInDrive(WCHAR
*Drv
)
177 static WCHAR Drive
[4] = L
"X:\\";
182 for(Current
= 'C'; Current
<= 'Z'; Current
++)
186 if(GetDriveType(Drive
) == DRIVE_CDROM
)
189 PathToVideoDrivers60
[0] = Current
;
190 PathToVideoDrivers55
[0] = Current
;
191 PathToVideoDrivers40
[0] = Current
;
192 PathToVideoDrivers45
[0] = Current
;
193 if(SetCurrentDirectory(PathToVideoDrivers60
))
194 SrcPath
= PathToVideoDrivers60
;
195 else if(SetCurrentDirectory(PathToVideoDrivers55
))
196 SrcPath
= PathToVideoDrivers55
;
197 else if(SetCurrentDirectory(PathToVideoDrivers45
))
198 SrcPath
= PathToVideoDrivers45
;
199 else if(SetCurrentDirectory(PathToVideoDrivers40
))
200 SrcPath
= PathToVideoDrivers40
;
203 SetCurrentDirectory(DestinationPath
);
207 if(DoesFileExist(SrcPath
, vmx_fb
) &&
208 (DoesFileExist(SrcPath
, vmx_mode
) || DoesFileExist(SrcPath
, vmx_mode_v6
)) &&
209 DoesFileExist(SrcPath
, vmx_svga
))
223 LoadResolutionSettings(DWORD
*ResX
, DWORD
*ResY
, DWORD
*ColDepth
)
226 DWORD Type
, Size
= sizeof(DWORD
);
228 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
229 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
230 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
232 DEVMODE CurrentDevMode
;
234 /* If this key is absent, just get current settings */
235 memset(&CurrentDevMode
, 0, sizeof(CurrentDevMode
));
236 CurrentDevMode
.dmSize
= sizeof(CurrentDevMode
);
237 if (EnumDisplaySettings(NULL
, ENUM_CURRENT_SETTINGS
, &CurrentDevMode
) == TRUE
)
239 *ColDepth
= CurrentDevMode
.dmBitsPerPel
;
240 *ResX
= CurrentDevMode
.dmPelsWidth
;
241 *ResY
= CurrentDevMode
.dmPelsHeight
;
247 if(RegQueryValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, &Type
, (BYTE
*)ColDepth
, &Size
) != ERROR_SUCCESS
||
251 Size
= sizeof(DWORD
);
254 if(RegQueryValueEx(hReg
, L
"DefaultSettings.XResolution", 0, &Type
, (BYTE
*)ResX
, &Size
) != ERROR_SUCCESS
||
258 Size
= sizeof(DWORD
);
261 if(RegQueryValueEx(hReg
, L
"DefaultSettings.YResolution", 0, &Type
, (BYTE
*)ResY
, &Size
) != ERROR_SUCCESS
||
272 IsVmwSVGAEnabled(VOID
)
275 DWORD Type
, Size
, Value
;
277 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
278 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga",
279 0, KEY_QUERY_VALUE
, &hReg
) != ERROR_SUCCESS
)
283 Size
= sizeof(DWORD
);
284 if(RegQueryValueEx(hReg
, L
"Start", 0, &Type
, (BYTE
*)&Value
, &Size
) != ERROR_SUCCESS
||
298 SaveResolutionSettings(DWORD ResX
, DWORD ResY
, DWORD ColDepth
)
303 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
304 L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Device0",
305 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
309 if(RegSetValueEx(hReg
, L
"DefaultSettings.BitsPerPel", 0, REG_DWORD
, (BYTE
*)&ColDepth
, sizeof(DWORD
)) != ERROR_SUCCESS
)
315 if(RegSetValueEx(hReg
, L
"DefaultSettings.XResolution", 0, REG_DWORD
, (BYTE
*)&ResX
, sizeof(DWORD
)) != ERROR_SUCCESS
)
321 if(RegSetValueEx(hReg
, L
"DefaultSettings.YResolution", 0, REG_DWORD
, (BYTE
*)&ResY
, sizeof(DWORD
)) != ERROR_SUCCESS
)
327 if(RegSetValueEx(hReg
, L
"DefaultSettings.VRefresh", 0, REG_DWORD
, (BYTE
*)&VFreq
, sizeof(DWORD
)) != ERROR_SUCCESS
)
338 EnableDriver(WCHAR
*Key
, BOOL Enable
)
343 Value
= (Enable
? 1 : 4);
345 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
, Key
, 0, KEY_SET_VALUE
, &hReg
) != ERROR_SUCCESS
)
349 if(RegSetValueEx(hReg
, L
"Start", 0, REG_DWORD
, (BYTE
*)&Value
, sizeof(DWORD
)) != ERROR_SUCCESS
)
359 /* Activate the vmware driver and deactivate the others */
361 EnableVmwareDriver(BOOL VBE
, BOOL VGA
, BOOL VMX
)
363 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\VBE", VBE
))
367 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vga", VGA
))
371 if(!EnableDriver(L
"SYSTEM\\CurrentControlSet\\Services\\vmx_svga", VMX
))
382 /* Property page dialog callback */
383 static INT_PTR CALLBACK
391 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
398 /* Center the wizard window */
399 hwndControl
= GetParent(hwndDlg
);
400 CenterWindow (hwndControl
);
406 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
413 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CONFIG
);
425 /* Property page dialog callback */
426 static INT_PTR CALLBACK
438 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
442 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
445 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSTALLING_VMWARE_TOOLS
);
455 InstTerminateInstaller(BOOL Wait
)
457 if(hInstallationThread
!= NULL
)
461 InterlockedExchange((LONG
*)&AbortInstall
, 2);
462 WaitForSingleObject(hInstallationThread
, INFINITE
);
466 InterlockedExchange((LONG
*)&AbortInstall
, 1);
472 InstInstallationThread(LPVOID lpParameter
)
475 WCHAR InfFileName
[1024];
477 int DrivesTested
= 0;
479 if(AbortInstall
!= 0) goto done
;
480 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_SEARCHINGFORCDROM
, 0);
482 while(AbortInstall
== 0)
485 DriveAvailable
= IsVMwareCDInDrive(&CDDrive
);
488 if(DrivesTested
++ > 20)
490 PostMessage(hInstallationNotifyWnd
, WM_INSTABORT
, IDS_FAILEDTOLOCATEDRIVERS
, 0);
495 if(AbortInstall
!= 0) goto done
;
496 PostMessage(hInstallationNotifyWnd
, WM_INSTSTATUSUPDATE
, IDS_COPYINGFILES
, 0);
498 wcscpy(InfFileName
, SrcPath
);
499 wcscat(InfFileName
, L
"vmx_svga.inf");
500 DPRINT1("Calling UpdateDriverForPlugAndPlayDevices()\n");
501 if (!UpdateDriverForPlugAndPlayDevices(
502 hInstallationNotifyWnd
,
503 L
"PCI\\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00",
519 SendMessage(hInstallationNotifyWnd
, WM_INSTCOMPLETE
, 0, 0);
522 SendMessage(hInstallationNotifyWnd
, WM_INSTABORT
, 0, 0);
527 hThread
= InterlockedExchangePointer((PVOID
*)&hInstallationThread
, 0);
530 CloseHandle(hThread
);
536 InstStartInstallationThread(HWND hwndNotify
)
538 if(hInstallationThread
== NULL
)
541 hInstallationNotifyWnd
= hwndNotify
;
543 hInstallationThread
= CreateThread(NULL
,
545 InstInstallationThread
,
549 if(hInstallationThread
== NULL
)
554 ResumeThread(hInstallationThread
);
561 /* Property page dialog callback */
562 static INT_PTR CALLBACK
574 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
578 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, L
"");
579 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, TRUE
, 50);
580 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
581 InstStartInstallationThread(hwndDlg
);
584 InstTerminateInstaller(TRUE
);
587 if(hInstallationThread
!= NULL
)
589 PropSheet_SetWizButtons(GetParent(hwndDlg
), 0);
590 InstTerminateInstaller(FALSE
);
591 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, -1);
596 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
597 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_INSERT_VMWARE_TOOLS
);
604 /* go back in case we aborted the installation thread */
605 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
606 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_INSERT_VMWARE_TOOLS
);
610 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
611 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
614 case WM_INSTCOMPLETE
:
615 SendDlgItemMessage(hwndDlg
, IDC_INSTALLINGPROGRESS
, PBM_SETMARQUEE
, FALSE
, 0);
616 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
617 PropSheet_SetCurSelByID(GetParent(hwndDlg
), IDD_CONFIG
);
619 case WM_INSTSTATUSUPDATE
:
622 LoadString(hAppInstance
, wParam
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
623 SetDlgItemText(hwndDlg
, IDC_INSTALLINGSTATUS
, Msg
);
630 /* Property page dialog callback */
631 static INT_PTR CALLBACK
632 PageInstallFailedProc(
643 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
647 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
657 FillComboBox(HWND Dlg
, int idComboBox
, int From
, int To
)
662 for(i
= From
; i
<= To
; i
++)
664 if(LoadString(hAppInstance
, i
, Text
, 255) > 0)
666 SendDlgItemMessage(Dlg
, idComboBox
, CB_ADDSTRING
, 0, (LPARAM
)Text
);
678 /* Property page dialog callback */
679 static INT_PTR CALLBACK
687 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
692 DWORD ResX
= 0, ResY
= 0, ColDepth
= 0;
695 FillComboBox(hwndDlg
, IDC_COLORQUALITY
, 10001, 10003);
696 if(LoadResolutionSettings(&ResX
, &ResY
, &ColDepth
))
698 SendDlgItemMessage(hwndDlg
, ResX
+ ResY
, BM_SETCHECK
, BST_CHECKED
, 0);
714 SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_SETCURSEL
, cbSel
, 0);
722 /* Center the wizard window */
723 hwndControl
= GetParent(hwndDlg
);
724 CenterWindow (hwndControl
);
730 PropSheet_SetWizButtons(GetParent(hwndDlg
), ((StartVMwConfigWizard
|| DriverFilesFound
) ? PSWIZB_FINISH
| PSWIZB_BACK
: PSWIZB_FINISH
));
735 if(StartVMwConfigWizard
)
737 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
742 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_WELCOMEPAGE
);
749 DWORD rx
= 800, ry
= 600, cd
= 32;
751 static MAPCTLRES Resolutions
[11] = {
764 for(i
= 0; i
< 11; i
++)
766 if(SendDlgItemMessage(hwndDlg
, Resolutions
[i
].ControlID
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
768 rx
= Resolutions
[i
].ResX
;
769 ry
= Resolutions
[i
].ResY
;
774 switch(SendDlgItemMessage(hwndDlg
, IDC_COLORQUALITY
, CB_GETCURSEL
, 0, 0))
787 SaveResolutionSettings(rx
, ry
, cd
);
797 /* Property page dialog callback */
798 static INT_PTR CALLBACK
799 PageChooseActionProc(
809 SendDlgItemMessage(hwndDlg
, IDC_CONFIGSETTINGS
, BM_SETCHECK
, BST_CHECKED
, 0);
813 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
817 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
821 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
826 static ULONG SelPage
[4] = {IDD_CONFIG
, IDD_SELECTDRIVER
, IDD_SELECTDRIVER
, IDD_CHOOSEACTION
};
829 for(i
= IDC_CONFIGSETTINGS
; i
<= IDC_UNINSTALL
; i
++)
831 if(SendDlgItemMessage(hwndDlg
, i
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
837 UninstallDriver
= (i
== IDC_UNINSTALL
);
839 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, SelPage
[i
- IDC_CONFIGSETTINGS
]);
849 /* Property page dialog callback */
850 static INT_PTR CALLBACK
851 PageSelectDriverProc(
861 SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_SETCHECK
, BST_CHECKED
, 0);
865 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
869 PropSheet_SetWizButtons(GetParent(hwndDlg
), (UninstallDriver
? PSWIZB_NEXT
| PSWIZB_BACK
: PSWIZB_BACK
| PSWIZB_FINISH
));
873 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_CHOOSEACTION
);
878 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
892 ActivateVBE
= (SendDlgItemMessage(hwndDlg
, IDC_VBE
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
893 if(!EnableVmwareDriver(ActivateVBE
,
898 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
899 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
900 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
913 ShowUninstNotice(HWND Owner
)
916 LoadString(hAppInstance
, IDS_UNINSTNOTICE
, Msg
, sizeof(Msg
) / sizeof(WCHAR
));
917 MessageBox(Owner
, Msg
, NULL
, MB_ICONINFORMATION
);
920 static INT_PTR CALLBACK
932 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
936 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_FINISH
);
942 if(!EnableVmwareDriver(ActivateVBE
,
947 LoadString(hAppInstance
, (ActivateVBE
? IDS_FAILEDTOSELVBEDRIVER
: IDS_FAILEDTOSELVGADRIVER
), Msg
, sizeof(Msg
) / sizeof(WCHAR
));
948 MessageBox(GetParent(hwndDlg
), Msg
, NULL
, MB_ICONWARNING
);
949 SetWindowLongPtr(hwndDlg
, DWL_MSGRESULT
, IDD_SELECTDRIVER
);
952 ShowUninstNotice(GetParent(hwndDlg
));
967 HPROPSHEETPAGE ahpsp
[8];
971 LoadString(hAppInstance
, IDS_WIZARD_NAME
, Caption
, sizeof(Caption
) / sizeof(TCHAR
));
973 /* Create the Welcome page */
974 ZeroMemory (&psp
, sizeof(PROPSHEETPAGE
));
975 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
976 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
977 psp
.hInstance
= hAppInstance
;
978 psp
.pfnDlgProc
= PageWelcomeProc
;
979 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_WELCOMEPAGE
);
980 ahpsp
[0] = CreatePropertySheetPage(&psp
);
982 /* Create the INSERT_VMWARE_TOOLS page */
983 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
984 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSTITLE
);
985 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLSSUBTITLE
);
986 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSERT_VMWARE_TOOLS
);
987 psp
.pfnDlgProc
= PageInsertDiscProc
;
988 ahpsp
[1] = CreatePropertySheetPage(&psp
);
990 /* Create the INSTALLING_VMWARE_TOOLS page */
991 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
992 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSTITLE
);
993 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLSSUBTITLE
);
994 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLING_VMWARE_TOOLS
);
995 psp
.pfnDlgProc
= PageInstallingProc
;
996 ahpsp
[2] = CreatePropertySheetPage(&psp
);
998 /* Create the CONFIG page */
999 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1000 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CONFIGTITLE
);
1001 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CONFIGSUBTITLE
);
1002 psp
.pfnDlgProc
= PageConfigProc
;
1003 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CONFIG
);
1004 ahpsp
[3] = CreatePropertySheetPage(&psp
);
1006 /* Create the INSTALLATION_FAILED page */
1007 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1008 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDTITLE
);
1009 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILEDSUBTITLE
);
1010 psp
.pfnDlgProc
= PageInstallFailedProc
;
1011 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_INSTALLATION_FAILED
);
1012 ahpsp
[4] = CreatePropertySheetPage(&psp
);
1014 /* Create the CHOOSEACTION page */
1015 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1016 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONTITLE
);
1017 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_CHOOSEACTIONSUBTITLE
);
1018 psp
.pfnDlgProc
= PageChooseActionProc
;
1019 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_CHOOSEACTION
);
1020 ahpsp
[5] = CreatePropertySheetPage(&psp
);
1022 /* Create the SELECTDRIVER page */
1023 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1024 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERTITLE
);
1025 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_SELECTDRIVERSUBTITLE
);
1026 psp
.pfnDlgProc
= PageSelectDriverProc
;
1027 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTDRIVER
);
1028 ahpsp
[6] = CreatePropertySheetPage(&psp
);
1030 /* Create the DOUNINSTALL page */
1031 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
1032 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLTITLE
);
1033 psp
.pszHeaderSubTitle
= MAKEINTRESOURCE(IDD_DOUNINSTALLSUBTITLE
);
1034 psp
.pfnDlgProc
= PageDoUninstallProc
;
1035 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_DOUNINSTALL
);
1036 ahpsp
[7] = CreatePropertySheetPage(&psp
);
1038 /* Create the property sheet */
1039 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
1040 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
;
1041 psh
.hInstance
= hAppInstance
;
1042 psh
.hwndParent
= NULL
;
1044 psh
.nStartPage
= (StartVMwConfigWizard
? 5 : 0);
1046 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
1047 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
1049 /* Display the wizard */
1050 return (LONG
)(PropertySheet(&psh
) != -1);
1054 wWinMain(HINSTANCE hInstance
,
1055 HINSTANCE hPrevInstance
,
1063 hAppInstance
= hInstance
;
1065 if(!DetectVMware(&Version
))
1070 lc
= DestinationPath
;
1071 lc
+= GetSystemDirectory(DestinationPath
, MAX_PATH
) - 1;
1072 if(lc
>= DestinationPath
&& *lc
!= L
'\\')
1074 wcscat(DestinationPath
, L
"\\");
1076 DestinationDriversPath
[0] = L
'\0';
1077 wcscat(DestinationDriversPath
, DestinationPath
);
1078 wcscat(DestinationDriversPath
, L
"drivers\\");
1080 SetCurrentDirectory(DestinationPath
);
1082 DriverFilesFound
= DoesFileExist(DestinationPath
, vmx_fb
) &&
1083 DoesFileExist(DestinationPath
, vmx_mode
) &&
1084 DoesFileExist(DestinationDriversPath
, vmx_svga
);
1086 StartVMwConfigWizard
= DriverFilesFound
&& IsVmwSVGAEnabled();
1088 /* Show the wizard */