Jump to content

Meha

Member
  • Posts

    6
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    India

About Meha

Meha's Achievements

0

Reputation

  1. mritter, Is it possible for you to introduce a special java script file called “userfucntions.js “ with a dummy function? This will allow users to add their own functions and call it from the config.js. I am already using it. Problem is, with every new release I will have to modify wpi.hta to add <script > .. </script> line. Also, please don’t forget to add Win 7 and Windows 2008 R2 suport in getOSVer(). Thanks, ****************** sample userfunctions.js *********************************** //************************************************ // // Windows Post-Install Wizard // // userfunctions.js // //************************************************ function SetNeroCompatibility() { position = "userfunctions.js"; whatfunc = "SetNeroCompatibility()" // This function makes Nero 9 compatible with windows 2008 and 2008R2 by setting XP/Vista compatibility flag. var osCompatibility = "NOTREQUIRED"; var osVersion = getOSver(); if ( osVersion == "08" ) { osCompatibility = "WINXP"; } else if ( osVersion == "08R2" ) { osCompatibility = "VISTA"; } if (osCompatibility != "NOTREQUIRED") { try { // can't use WshShell.RegWrite() here; // see kb article at http://support.microsoft.com/kb/281309 var wimRegProv = GetObject("winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv"); var wpiRoot = root; var neroInstaller = "SetupX.exe"; var HKEY_CURRENT_USER = 0x80000001; if (wpiRoot != null) { neroInstaller = wpiRoot + "\\Nero\\SetupX.exe"; } wimRegProv.SetStringValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", neroInstaller, osCompatibility ); } catch (ex) { } } } function SetWMP11Compatibility() { position = "userfunctions.js"; whatfunc = "SetWMP11Compatibility()" // This function makes WMP 11 compatible with windows 2003 by setting XP compatibility flag. var osCompatibility = "NOTREQUIRED"; var osVersion = getOSver(); if (osVersion == "03") { osCompatibility = "WINXP"; } if (osCompatibility != "NOTREQUIRED") { try { // can't use WshShell.RegWrite() here; // see kb article at http://support.microsoft.com/kb/281309 var wimRegProv = GetObject("winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv"); var wpiRoot = root; if (wpiRoot != null) { wmpPath = wpiRoot + "\\MediaPlayers\\WindowsMediaPlayer11\\"; } var HKEY_CURRENT_USER = 0x80000001; wimRegProv.SetStringValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", wmpPath+"wmfdist11.exe", osCompatibility); wimRegProv.SetStringValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", wmpPath+"wmdbexport.exe", osCompatibility); wimRegProv.SetStringValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", wmpPath+"wmp11.exe", osCompatibility); } catch (ex) { } } } ************************************************
  2. Delete while exiting WPI. While starting WPI: If command line argument is specified for config/option files, use them. Otherwise load them from current WPI folder. If at all anybody loads a new config/option file while in Edit Screen via Load Button, do not forget to refresh the main screen with the same, after coming out of edit screen.
  3. I think it would be better to initialize a global variable to hold path for Options/Config files and initialize it while loading WPI. You can provide a <SaveAs> button to change location and reset global variable. These can be retained till one exit from WPI. This way one can keep main WPI window and Edit window in sync. Meha
  4. mritter, Following is the modified version of WMI section of getOSver() I have tested this on XP, 2003, Vista and 2008 and returns correct value. I don't have Windows 7, Windows 2000 Pro and 2000 Server test machines. Hope somebody else Will test it on these platforms and give you the feed back. This is adapted from GetNativeSystemInfo(ref SYSTEM_INFO lpSystemInfo) using OSVERSIONINFOEX ***************************************************** objWMIService=GetObject("winmgmts:\\\\" + "." + "\\root\\CIMV2"); colItems=objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); enumItems=new Enumerator(colItems); objItem=enumItems.item(); ver = objItem.Version.substr(0,3); prodType = objItem.ProductType; if ( ver == "6.1" ) // please confirm version no. on Windows 7 { if ( prodType == 1 ) { sVersionID = "Win7"; // Windows 7 } else { sVersionID = "08R2"; // Windows Server 2008 R2 -> next server version based on Windows 7 } } else if ( ver == "6.0" ) { if ( prodType == 1 ) { szOSVerCache = "Vista"; } else { szOSVerCache = "08"; } } else if ( ver =="5.2" ) { if ( prodType == 1 ) { szOSVerCache = "XP"; // 64 bit version as per MSDN doc. not tested by me } else { szOSVerCache = "03"; } } else if ( ver =="5.1" ) { szOSVerCache = "XP"; } else if ( ver =="5.0" ) // Not sure about reliability of WMI on Win 2000. Just for completeness. Need not go for 2KP & 2KS { if ( prodType == 1 ) { szOSVerCache = "2KP"; } else { szOSVerCache = "2KS"; } } ***************************************************** Here are the possible product types. wProductType Any additional information about the system. This member can be one of the following values. Value Meaning VER_NT_DOMAIN_CONTROLLER 0x0000002 The system is a domain controller and the operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server. VER_NT_SERVER 0x0000003 The operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server. Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER. VER_NT_WORKSTATION 0x0000001 The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional. ***************************************************** MSDN library link to OSVERSIONINFOEX Structure http://msdn.microsoft.com/en-us/library/ms724833(VS.85).aspx If you like, you can even have IsServer() and IsWorkstation() functions as conditions. prodType == 1 for Workstation prodType > 1 for Server Hope this will settle getOSVersion() issues. Meha
  5. mritter, Here is a small bug. getOSver() returns "NOT_FOUND" for Windows Server ® 2008. ***** if (ver.indexOf("Windows7") != -1) szOSVerCache="Win7"; if (ver.indexOf("Server 2008") != -1) -> will not work as it returns info as "Windows Server ® 2008" szOSVerCache="08"; if (ver.indexOf("Vista") != -1) szOSVerCache="Vista"; ***** Better use Build no. Version 6.0.6000 Build 6000 -> for Vista Version 6.0.6001 Build 6001 -> for Windows 2008 for time being, I changed this as if (ver.indexOf("2008") != -1) szOSVerCache="08"; Hope this helps.
×
×
  • Create New...