Prev: Need WritePrivateProfileString replacement
Next: What is advantage of using a resouce file as opposed to a string variable?
From: will_456 on 5 Dec 2009 01:42 I have a vb6 app. which uses Windows scripting host. The inno installer has always worked well on Windows 95 through to Vista but on Windows 7 produces this error. C:\Windows\system32\wshom.ocx unable to register the Dll\OCX: regsvr32 failed with error code 0x5 Any ideas? I've heard the installation of windows scripting host is now considered a bad security risk from windows 7 onwards.
From: mayayana on 5 Dec 2009 08:53 You should always know the redist. situation with any file before you ship it -- and not just on the level of hearsay. Sorry if that sounds scolding, but we're shipping files to other peoples' PCs and they're trusting us not to screw things up. You should never depend on any installer to get the right files. You have to know yourself. Also, you probably don't really need wshom.ocx. That contains mainly the FileSystemObject, the barely-usable Registry functions (WSHShell), Network, and shortcut handling. You should be able to do whatever you need with straight VB. The WSH functions are slow, poorly designed, and -- as you know -- have [unnecessary] dependencies. :) Microsoft apparently created the WSH to satisfy admins who wanted something more up-to-date than DOS or NT command-line scripting. But based on the gaps in functionality, the notably slow speed, the paucity of real updates over the past 9 years, and the general lack of press that the WSH gets at microsoft.com, I don't think they ever bothered to do more than cook up a quickie scripting package. Most of what WSH can do depends on hacks or 3rd-party COM objects. But to answer your question specifically: This is just a wikipedia page link, so it's not official info., but it seems to indicate that WSH is pre-installed on Vista/7 and is not meant to be updated: http://en.wikipedia.org/wiki/Windows_Script_Host "As of Windows XP Service Pack 3, release 5.7 is not necessary as it is included." I'm surprised that you've ever shipped those files and that you haven't had trouble. WSH was available with Win98 and has been pre-installed since Win2000. If there's specific functionality you need that came in a recent version you should tell people they need to install the update and not just foist it on them. Some system admins depend on WSH but while others uninstall parts of WSH for security reasons. In both cases they're likely to be taken aback that you've seen fit to replace their files. > I have a vb6 app. which uses Windows scripting host. > The inno installer has always worked well on Windows 95 through to Vista > but on Windows 7 produces this error. > > C:\Windows\system32\wshom.ocx > unable to register the Dll\OCX: regsvr32 failed with error code 0x5 > > Any ideas? I've heard the installation of windows scripting host is now > considered a bad security risk from windows 7 onwards.
From: will_456 on 5 Dec 2009 14:51 mayayana wrote: > You should always know the redist. situation > with any file before you ship it -- and not just > on the level of hearsay. Sorry if that sounds > scolding, but we're shipping files to other > peoples' PCs and they're trusting us not to screw > things up. You should never depend on any > installer to get the right files. You have to know > yourself. > > Also, you probably don't > really need wshom.ocx. That contains mainly the > FileSystemObject, the barely-usable Registry > functions (WSHShell), Network, and shortcut > handling. You should be able to do whatever > you need with straight VB. The WSH functions > are slow, poorly designed, and -- as you know -- > have [unnecessary] dependencies. :) Microsoft > apparently created the WSH to satisfy admins who > wanted something more up-to-date than DOS > or NT command-line scripting. But based on the gaps > in functionality, the notably slow speed, the > paucity of real updates over the past 9 years, > and the general lack of press that the WSH gets > at microsoft.com, I don't think they ever bothered > to do more than cook up a quickie scripting package. > Most of what WSH can do depends on hacks or > 3rd-party COM objects. > > But to answer your question specifically: > > This is just a wikipedia page link, so it's not > official info., but it seems to indicate that WSH > is pre-installed on Vista/7 and is not meant to > be updated: > > http://en.wikipedia.org/wiki/Windows_Script_Host > > "As of Windows XP Service Pack 3, release 5.7 is not necessary > as it is included." > > I'm surprised that you've ever shipped those files > and that you haven't had trouble. WSH was available > with Win98 and has been pre-installed since Win2000. > > If there's specific functionality you need that came in > a recent version you should tell people they need to install > the update and not just foist it on them. Some system > admins depend on WSH but while others uninstall parts > of WSH for security reasons. In both cases they're likely > to be taken aback that you've seen fit to replace their > files. > > >> I have a vb6 app. which uses Windows scripting host. >> The inno installer has always worked well on Windows 95 through to Vista >> but on Windows 7 produces this error. >> >> C:\Windows\system32\wshom.ocx >> unable to register the Dll\OCX: regsvr32 failed with error code 0x5 >> >> Any ideas? I've heard the installation of windows scripting host is now >> considered a bad security risk from windows 7 onwards. > > Thanks for the advice. My app has been in use since 1999 and is designed to work on Win 95 onwards hence the installer has always include WSH. One functions I have used it for in the program is to find the location of the users special folders eg. documents folder and then to delete a subfolder. I had used other methods but they were quite complex. WSH allowed me to do it with just a few lines.
From: MikeD on 5 Dec 2009 18:27 "will_456" <will_456(a)nospam.com> wrote in message news:hRySm.60404$ze1.22912(a)news-server.bigpond.net.au... >> > Thanks for the advice. My app has been in use since 1999 and is designed > to work on Win 95 onwards hence the installer has always include WSH. > One functions I have used it for in the program is to find the location of > the users special folders eg. documents folder and then to delete a > subfolder. > > I had used other methods but they were quite complex. WSH allowed me to do > it with just a few lines. Not really good reasons because all of those can be done fairly easily without it. If for no other reason, you should consider getting rid of the WSH and using either API or VB's own statements, functions, etc. to eliminate the dependency. Also, some users and many sysadmins will have removed that file to prevent scripts from using it for malicious purposes. So from that standpoint alone, it's really not a good idea to use it in your app. All the "special folders" can be obtained by using the SHGetSpecialFolderPath Win32API function. You can write a wrapper function around this API function so you only need to make one call in your app whenever you need a special folder. Here's some code: -----BEGIN CODE Private Const MAX_PATH As Long = 260 Private Declare Function SHGetSpecialFolderPath Lib "Shell32" Alias "SHGetSpecialFolderPathA" (ByVal hwndOwner As Long, ByVal lpszPath As String, ByVal nFolder As Long, ByVal fCreate As Long) As Long Public Enum SHSpecialFolderIDs CSIDL_DESKTOP = &H0& ' <desktop> CSIDL_INTERNET = &H1& ' Internet Explorer (icon on desktop) CSIDL_PROGRAMS = &H2& ' Start Menu\Programs CSIDL_CONTROLS = &H3& ' My Computer\Control Panel CSIDL_PRINTERS = &H4& ' My Computer\Printers CSIDL_PERSONAL = &H5& ' My Documents CSIDL_FAVORITES = &H6& ' <user name>\Favorites CSIDL_STARTUP = &H7& ' Start Menu\Programs\Startup CSIDL_RECENT = &H8& ' <user name>\Recent CSIDL_SENDTO = &H9& ' <user name>\SendTo CSIDL_BITBUCKET = &HA& ' <desktop>\Recycle Bin CSIDL_STARTMENU = &HB& ' <user name>\Start Menu CSIDL_MYDOCUMENTS = &HC& ' logical "My Documents" desktop icon CSIDL_MYMUSIC = &HD& ' "My Music" folder CSIDL_MYVIDEO = &HE& ' "My Videos" folder CSIDL_DESKTOPDIRECTORY = &H10& ' <user name>\Desktop CSIDL_DRIVES = &H11& ' My Computer CSIDL_NETWORK = &H12& ' Network Neighborhood (My Network Places) CSIDL_NETHOOD = &H13& ' <user name>\nethood CSIDL_FONTS = &H14& ' windows\fonts CSIDL_TEMPLATES = &H15& CSIDL_COMMON_STARTMENU = &H16& ' All Users\Start Menu CSIDL_COMMON_PROGRAMS = &H17& ' All Users\Start Menu\Programs CSIDL_COMMON_STARTUP = &H18& ' All Users\Startup CSIDL_COMMON_DESKTOPDIRECTORY = &H19& ' All Users\Desktop CSIDL_APPDATA = &H1A& ' <user name>\Application Data CSIDL_PRINTHOOD = &H1B& ' <user name>\PrintHood CSIDL_LOCAL_APPDATA = &H1C& ' <user name>\Local Settings\Applicaiton Data (non roaming) CSIDL_ALTSTARTUP = &H1D& ' non localized startup CSIDL_COMMON_ALTSTARTUP = &H1E& ' non localized common startup CSIDL_COMMON_FAVORITES = &H1F& CSIDL_INTERNET_CACHE = &H20& CSIDL_COOKIES = &H21& CSIDL_HISTORY = &H22& CSIDL_COMMON_APPDATA = &H23& ' All Users\Application Data CSIDL_WINDOWS = &H24& ' GetWindowsDirectory() CSIDL_SYSTEM = &H25& ' GetSystemDirectory() CSIDL_PROGRAM_FILES = &H26& ' C:\Program Files CSIDL_MYPICTURES = &H27& ' C:\Program Files\My Pictures CSIDL_PROFILE = &H28& ' USERPROFILE CSIDL_SYSTEMX86 = &H29& ' x86 system directory on RISC CSIDL_PROGRAM_FILESX86 = &H2A& ' x86 C:\Program Files on RISC CSIDL_PROGRAM_FILES_COMMON = &H2B& ' C:\Program Files\Common CSIDL_PROGRAM_FILES_COMMONX86 = &H2C& ' x86 Program Files\Common on RISC CSIDL_COMMON_TEMPLATES = &H2D& ' All Users\Templates CSIDL_COMMON_DOCUMENTS = &H2E& ' All Users\Documents CSIDL_COMMON_ADMINTOOLS = &H2F& ' All Users\Start Menu\Programs\Administrative Tools CSIDL_ADMINTOOLS = &H30& ' <user name>\Start Menu\Programs\Administrative Tools CSIDL_CONNECTIONS = &H31& ' Network and Dial-up Connections CSIDL_COMMON_MUSIC = &H35& ' All Users\My Music CSIDL_COMMON_PICTURES = &H36& ' All Users\My Pictures CSIDL_COMMON_VIDEO = &H37& ' All Users\My Video CSIDL_RESOURCES = &H38& ' Resource Direcotry CSIDL_RESOURCES_LOCALIZED = &H39& ' Localized Resource Direcotry CSIDL_COMMON_OEM_LINKS = &H3A& ' Links to All Users OEM specific apps CSIDL_CDBURN_AREA = &H3B& ' USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning ' unused = &H003c& CSIDL_COMPUTERSNEARME = &H3D& ' Computers Near Me (computered from Workgroup membership) End Enum Public Function GetSpecialFolder(ByVal FolderID As SHSpecialFolderIDs) As String 'SHGetSpecialFolderPath is not necessarily supported under Win95. It can be called 'under Win95 if IE4 AND the Desktop Update are installed. Dim sBuffer As String sBuffer = String$(MAX_PATH, vbNullChar) 'For Win98 and higher Call SHGetSpecialFolderPath(0&, sBuffer, FolderID, 0&) GetSpecialFolder = StripNulls(sBuffer) End Function Public Function StripNulls(ByVal sText As String) As String 'Returns all characters up to a null character. 'If the string does not contain a null character, 'the string is returned unmodified. Dim lNullPos As Long lNullPos = InStr(sText, vbNullChar) If lNullPos Then StripNulls = Left$(sText, lNullPos - 1) Else StripNulls = sText End If End Function -----END CODE To delete the subfolder, just use VB's own RmDir statement or any of a number of API functions. -- Mike
From: mayayana on 5 Dec 2009 18:31
> > > Thanks for the advice. My app has been in use since 1999 and is designed > to work on Win 95 onwards hence the installer has always include WSH. It's tricky. WSH is actually several files. WSHOM.ocx depends on scrrun.dll (which has the FSO) and msvcrt.dll, the VC6 runtime. If you just need FSO you can redistribute scrrun.dll (though it still needs msvcrt.dll). Post-2000 Windows won't let you replace any system files. I'm not sure whether any versions of Windows classifies WSH files as system files. If it were me I'd redistribute scrrun.dll v. 5.1. Then your installer shouldn't try to replace it if it exists because it should be the same or later version. On the other hand, if you run across a system that actually needs it there's a good chance that msvcrt.dll will also be missing, so you might want to also ship a version of that. > One functions I have used it for in the program is to find the location > of the users special folders eg. documents folder and then to delete a > subfolder. > > I had used other methods but they were quite complex. WSH allowed me to > do it with just a few lines. > The FSO *is* very convenient for file system access. If you change your mind, you might try looking at Randy birch's site: http://vbnet.mvps.org/ It might take some work, but at least you'd be free of a thorny dependency. |