-
[RESOLVED] Vista Error (MSWINSCK.OCX)
Ok so i have this rather large program that im using, im working on making it Vista compatible.. There was a tun of work to do but im almost finished with it finally!
The only problem left is this. When the user starts the program, it starts up a splash screen, that form connects to a server app i have on a sever computer, and it checks for updates. If the version of the program is less then the version of the EXE file on the server, then it will run the patcher application as well as the updater app on the server. The server will wait a few seconds then try to connect to the users computer, and it sends the entire EXE file, after the transfer, the patcher updates the EXE file, runs the new version of the program and closes itself.
The problem. Both the main app and the patcher use the Winsock control. There's several of them all over different forms. On the patcher app, there's only one.. But on vista computers, when the program tries to run the patcher app, it says this:
"Component ‘MSWINSCK.OCX’ or one of its dependencies not correctly registered: a file is missing or invalid"
I dont get this error on the comp with VB installed, but all other computers with vista, i get this.. They can not update! I dont get why this happens. That control does the exact same things on both apps. So they need to be registered the same, and on the main app it works just fine! And on XP machines it works just fine!
anybody have any ideas? Ive look around the net and they have said to do 2 things.. Remove and Reinstall the program, which ive done and it didnt work. And to reinstall the winsock control, with some packaged version or whatever from microsoft, ive done that and it didnt work either.
-
Re: Vista Error (MSWINSCK.OCX)
Is your pathcer / updater running with elevated admin permissions? If not it needs to be in order to register or install teh component.
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by RobDog888
Is your pathcer / updater running with elevated admin permissions? If not it needs to be in order to register or install teh component.
The patcher is installed with the main app when the program is installed.
BUT!!! I think i might be seeing what your saying! When the splash screen is up and its doing updates, it will download a new patcher if one is available, and i update it every now and then.
Is there a way to run it with admin privelages through code?
-
Re: Vista Error (MSWINSCK.OCX)
But the patcher is a secondary program so it will need to request elevation of its own process. You can do this with a manifest file.
http://vbforums.com/showthread.php?t=500666
Contains the file example.
-
Re: Vista Error (MSWINSCK.OCX)
k i'll give this a shot and let you know how it goes within the next week or so, i got a few extra things lined up, and i wont be working on it this weekend. So probably tomorrow hopefully!
Will this work in XP as well?
-
Re: Vista Error (MSWINSCK.OCX)
I dont believe so, I think the xml setting to request elevation is a Vista or Windows 6.0 and above feature only.
-
Re: Vista Error (MSWINSCK.OCX)
Whats the quickest way to combine my EXE file and my .Manifest file?
I remember running acrost a thread here before, and whatever program it was, i already had on my computer, and it combined the 2.. It was a little dos program, but i cant find that thread anymore. All the threads i found have a HUUUUUGE download, or the link doesnt work =(
-
Re: Vista Error (MSWINSCK.OCX)
You can do it all in VB if you want by adding the file to vbs resource addin with a particular tag that tells it its a manifest but I forget what the tags is right now. A search could bring that up. Otherwise if you want to use a program there is REssoiurce Hacker. I believe its freeware.
-
Re: Vista Error (MSWINSCK.OCX)
Ok i feel more and more stupid every day.. I dont understand this manifest file stuff at all...
I know the manifest file is XML, and it has to be injected into the EXE file somehow. Well i know it can be done through VB, i went through this website for an older program i made:
http://www.vbforums.com/showthread.p...=manifest+file
That site is for adding an XP theme, but something about it doesnt seem right, like the code you put into your program is strictly for adding the XP theme, and making your program request admin rights itself when running, will not work....
So yeah, now i feel stupid cuz ive spent the past few days trying to figure out how and its not working ::cry:
-
Re: Vista Error (MSWINSCK.OCX)
The menifest file needs to be of 4bit increments. So if its 46 bits in filesize then you need to add 2 more bits to it by adding a space character r such.
For testing dont embed it yet. Just give it the same name as the exe and place in the same directory as the exe. It should request admin permissions when run if you have the UAC on.
-
Re: Vista Error (MSWINSCK.OCX)
ok i searched again and found this thread
http://www.vbforums.com/showthread.php?t=482140
randem explains well how to get the info in there, and it works.. It embeds the manifest file into the exe file, it even shows the vista shield on the icon when i select it, but my issue remains.
I still get this error:
"Component ‘MSWINSCK.OCX’ or one of its dependencies not correctly registered: a file is missing or invalid"
But i also noticed something! I logged onto one of the computers on my account, my program was installed on another account. I tried to run the program that was installed on the other account, and i got the same error! Usually its only with the patcher part..
So i installed it on mine, and it works, but still not the patcher..
So now i know the installer does "something" that associates the files with the installed program, but it doesnt associate it with any other EXE files in the program? If the patcher had its own install program, it would work.. But thats kinda stupid to do in my opinion..
any more ideas? :eek2: :eek2: :eek2:
-
Re: Vista Error (MSWINSCK.OCX)
That is the same manifest file contents that are in my post from earlier.
You have to determine if you are linking to the same common controls version that your winsock is registered under as the registereed file may not be in the location that is was registered with.
-
Re: Vista Error (MSWINSCK.OCX)
how do i do that? Just open up each project in VB and make sure the controls in the patcher app are the same exact controls from the main app? then recompile it?
-
Re: Vista Error (MSWINSCK.OCX)
Is the patcher program started through the Main application ??
Via ShellExecute?
If so, then the Shelled program receives the same UAC elevation as your main program. So if your main program doesnt request admin level then your pathces runs with no admin level.
-
Re: Vista Error (MSWINSCK.OCX)
Well the manifest file links one version of Comctls but winsock is not part of it so any manifest file linking for comctls will not change anything. You will either need to unregister and reregister the ocx or try to add a new section in the manufest file to point to the correct location of the ocx control.
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by some1uk03
Is the patcher program started through the Main application ??
Via ShellExecute?
If so, then the Shelled program receives the same UAC elevation as your main program. So if your main program doesnt request admin level then your pathces runs with no admin level.
Yes its using the shell command to run the patcher. If the program is installed on the current account, the program runs fine but the patcher gets this error:
"Component ‘MSWINSCK.OCX’ or one of its dependencies not correctly registered: a file is missing or invalid"
If the program is run from an account it was not installed from, then even the main program will get that error and not run...
Quote:
Originally Posted by RobDog888
Well the manifest file links one version of Comctls but winsock is not part of it so any manifest file linking for comctls will not change anything. You will either need to unregister and reregister the ocx or try to add a new section in the manufest file to point to the correct location of the ocx control.
Aahjsdfa3h@%!$%!!!!!!!! Ok ..i..... im ..... im lost!!!!!!!! How do you do that? I know nothing about how these manifest files work... its a file full of senseless garble to me!
-
Re: Vista Error (MSWINSCK.OCX)
Ok lets back up for a second.
Locate your winsock.ocx control and make sure that its registered correctly and the location matches what the registry says is its location or manifest file is pointing to the correct file/version.
Then if so it may be a permissions issue which isnt allowing your app to access the location where the ocx is located.
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by RobDog888
Ok lets back up for a second.
Locate your winsock.ocx control and make sure that its registered correctly and the location matches what the registry says is its location or manifest file is pointing to the correct file/version.
Then if so it may be a permissions issue which isnt allowing your app to access the location where the ocx is located.
Ok there's something i dont understand at all.. Your saying the manifest file is pointing to the common controls earlier and i need to also make it point to mswinsck.ocx? Well.. where does it point to that? Here's the contents of the manifest file:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="EXENAME"
type="win32"/>
<description>elevate execution level</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Of course EXENAME is changed to the name of my EXE file, but what am i supposed to change or add? I dont see it pointing to any files other then my exe file!?
-
Re: Vista Error (MSWINSCK.OCX)
Ok, good you dont have the comctls in there, just security node.
Check your registry for the location of where your ocx is regisered to. What is the file location and the location it states is in the registry? You will need to search for it in the registry. If you have trouble finding it you can unregister it and reregister it like I previously suggested.
-
Re: Vista Error (MSWINSCK.OCX)
Every file location in the registry points to MSWINSCK.OCX at C:\Windows\System32\MSWINSCK.OCX
And thats exactly where its at... I re-registered it, and it didnt work.. I even downloaded this MSWinsock install package that installs all the necessary files for mswinsck.ocx to work, and puts in all the necessary registry entries and everything, and still... the patcher wont work, but the main program will...
-
Re: Vista Error (MSWINSCK.OCX)
It almost sounds like the original installation registered the Winsock control in a virtualized Registry location under HKCU.
By starting the "patcher" with ShellExecute (or ShellExecuteEx) instead of CreateProcess, it is subject to Vista's installer detection heuristics. If Vista thinks it is an installer it will run in an installer context, which bypasses vitualization. If the "patcher" has requested an executionLevel via a manifest it will bypass installer detection, but will also not be subject to virtualization.
The fix would not be to use CreateProcess, or this manifest won't help you.
Something like this must be going on if the Winsock control appears to be installed and registered, and the base program can use the Winsock control without a problem. Maybe checking the Registry with RegEdit elevated would help see what's happening?
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
It almost sounds like the original installation registered the Winsock control in a virtualized Registry location under HKCU.
By starting the "patcher" with ShellExecute (or ShellExecuteEx) instead of CreateProcess, it is subject to Vista's installer detection heuristics. If Vista thinks it is an installer it will run in an installer context, which bypasses vitualization. If the "patcher" has requested an executionLevel via a manifest it will bypass installer detection, but will also not be subject to virtualization.
The fix would not be to use CreateProcess, or this manifest won't help you.
Something like this must be going on if the Winsock control appears to be installed and registered, and the base program can use the Winsock control without a problem. Maybe checking the Registry with RegEdit elevated would help see what's happening?
Ya lost me :eek: :eek:
-
Re: Vista Error (MSWINSCK.OCX)
BTW: You can skip the manifest by calling ShellExecute with the "runas" verb to request elevation.
Windows Vista for Developers – Part 4 – User Account Control
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by PMad
Ya lost me :eek: :eek:
For legacy applications (like a VB application that doesn't have a Vista Trust manifest element) Vista will jolly you along and do registry and filesystem virtualization. It will let you think you changed or added something to a protected location (like where components are normaly registered) but behind your back redirects you to some per-user location.
If your base application was installed as a legacy app, the Winsock control may have been registered in such a private place. However your patcher is probably detected as an installer (it can be as simple as the way the EXE is named) and so it will not see the virtualized location. Using a Trust Level manifest element will also prevent your patcher from seeing the private registration of the Winsock control.
Just running RegEdit (w/o elevating it) may fool you the same way.
-
Re: Vista Error (MSWINSCK.OCX)
Well, as you have already noticed, ive tried using a manifest file to run the patcher as admin, that didnt fix the problem. Ive made up my install packages a few different ways, didnt work.. Ive re-registered mswinsck.ocx on the computer, didnt work... Ive used different versions of MSWINSCK.OCX, didnt work.. Ive used an installer package for MSWINSCK.OCX, didnt work..
The weird thing is when the program is installed, it will ONLY work on the account its installed on (minus the patcher). If you change accounts and try to run the program, you get that error on the main program as well, but if you re-log back onto the account it was installed on, it works fine.. This is probably why you said it was registered under HKCU right? Please keep in mind, either of these 2 ways, the patcher still doesnt work..
Now on the computer VB6 is installed on, everything works just fine through code, and the installed program. Maybe that will help us identify where this problem is at?
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
For legacy applications (like a VB application that doesn't have a Vista Trust manifest element) Vista will jolly you along and do registry and filesystem virtualization. It will let you think you changed or added something to a protected location (like where components are normaly registered) but behind your back redirects you to some per-user location.
If your base application was installed as a legacy app, the Winsock control may have been registered in such a private place. However your patcher is probably detected as an installer (it can be as simple as the way the EXE is named) and so it will not see the virtualized location. Using a Trust Level manifest element will also prevent your patcher from seeing the private registration of the Winsock control.
Just running RegEdit (w/o elevating it) may fool you the same way.
What do you suggest i do to solve this issue? Ive searched all over the internet and these forums, and there's no answer anywhere... Others have had the problem too, and still have not had their problems answered.
-
Re: Vista Error (MSWINSCK.OCX)
It seems clear that Vista has profiled your application as a legacy program. Probably your installer as a legacy installer as well. So, your hat in hand like a nice hobo, Vista doled out a bowl of soup hoping to keep you happy and then turned its back on you. ;)
The first question I'd have is what installer technology you used to install this with in the first place?
But something you can try in the meantime is to log on as the user it works for and uninstall your application entirely. Follow this by an elevated reinstall (right-click, run as admin). Then retest and at least see if the base application runs for all users.
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
It seems clear that Vista has profiled your application as a legacy program. Probably your installer as a legacy installer as well. So, your hat in hand like a nice hobo, Vista doled out a bowl of soup hoping to keep you happy and then turned its back on you. ;)
The first question I'd have is what installer technology you used to install this with in the first place?
But something you can try in the meantime is to log on as the user it works for and uninstall your application entirely. Follow this by an elevated reinstall (right-click, run as admin). Then retest and at least see if the base application runs for all users.
I used Visual Studio Installer, not that great.. but seems to be the only one i can really understand haha, i'd like to use Inno, but the scripts are too complicated for me to take the time to sit down and figure them out.. I have to much to do, i'd rather not spend the time trying to figure it out...
I have already tried running the install as admin by right clicking and using Run As Administrator, but this didnt work. :eek2:
Im gonna try it again, its been awhile since ive tried it, some of my changes might make that work.
-
Re: Vista Error (MSWINSCK.OCX)
Ahh, there's the rub then!
If you mean VSI 1.1, it doesn't "know" how to make an "ALLUSERS" MSI by itself. Do you have Orca?
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
Ahh, there's the rub then!
If you mean VSI 1.1, it doesn't "know" how to make an "ALLUSERS" MSI by itself. Do you have Orca?
Ahh! What the heck is Orca? It sounds familiar... Its another installer program? I'll look for it.. hopefully its easy to use!
-
Re: Vista Error (MSWINSCK.OCX)
Orca is a Microsoft utility for editing the database inside an MSI package. It's a pain to get, you need to install the platform SDK if you don't have it, then install Orca.msi found in the bin directory in the installed SDK.
Quick and dirty thing you can try:
- Start an elevated command prompt.
- Change CD to the folder with your MSI in it.
- Type: msiexec /i yourpackage.msi ALLUSERS=2
I also have a script you could modify and use following each VSI build. Just paste this into Notepad, change the relative path to your MSI file in the OpenDatabase() line, and carefully save it as a .WSF file in your VSI project/solution folder. This one enables a per-user install by a non-admin user without elevation prompts at all.
To create an ALLUSERS admin installer just change it to add ALLUSERS set to 2 instead of the actions included here. It doesn't require Orca:
PUEditMSI.wsf
Code:
<job>
<!-- PUEditMSI.wsf
The purpose of this script is to edit an MSI package's database
after building it via Visual Studio Installer 1.1 to add or alter
settings that VSI 1.1 does not support by itself.
This script needs to be rerun after every VSI 1.1 build of the MSI
package.
This version is for the GetFileRS application, and makes sure that:
o Word Count Summary has bit 3 set, and
o TARGETDIR is in LocalAppDataFolder (Installer's name for
CSIDL_LOCAL_APPDATA), and
o ALLUSERS is null (doesn't exist).
This allows installs of the application per-user w/o a UAC prompt
under Vista.
Note the confusing SQL here: there is a Table named Property that
also has a primary key field named Property!
-->
<reference object="WindowsInstaller.Installer" />
<object id="Installer" progId="WindowsInstaller.Installer" />
<script language="VBScript">
Option Explicit
Const PID_WORDCOUNT = 15
Dim Database, SummaryInfo, View, Record, OldTarget, EndVar, NewTarget
Set Database = _
Installer.OpenDatabase("Output\DISK_1\PUGetFileRS.msi", _
msiOpenDatabaseModeTransact)
Set SummaryInfo = Database.SummaryInformation(1)
With SummaryInfo
.Property(PID_WORDCOUNT) = .Property(PID_WORDCOUNT) Or &H8&
WScript.Echo "Word Count Summary now " & CStr(.Property(PID_WORDCOUNT))
.Persist
End With
Set View = _
Database.OpenView("SELECT Target FROM CustomAction" _
& " WHERE Action = 'DIR_CA_TARGETDIR'" _
& " AND Source = 'TARGETDIR'")
View.Execute
Set Record = View.Fetch
If Record Is Nothing Then
WScript.Echo "Missing TARGETDIR action, aborting"
View.Close
WScript.Quit 1
Else
OldTarget = Record.StringData(1)
EndVar = InStr(OldTarget, "]") 'Char index of EndVar or 0.
NewTarget = "[LocalAppDataFolder]" & Mid(OldTarget, EndVar + 1)
Record.StringData(1) = NewTarget
View.Modify msiViewModifyUpdate, Record
WScript.Echo "Target was """ & OldTarget _
& """ and is now """ & NewTarget & """"
End If
View.Close
Set View = _
Database.OpenView("SELECT Property, Value FROM Property" _
& " WHERE Property = 'ALLUSERS'")
View.Execute
Set Record = View.Fetch
If Record Is Nothing Then
WScript.Echo "ALLUSERS already omitted"
Else
View.Modify msiViewModifyDelete, Record
WScript.Echo "ALLUSERS deleted"
End If
View.Close
Database.Commit
</script>
</job>
Addendum:
Changed the script to change Target as well. VSI 1.1 can set it to several places, but not the one we need.
Tested fine. Non-admin Vista user installed, ran the app, and uninstalled with never one elevation prompt.
-
Re: Vista Error (MSWINSCK.OCX)
Just looked on my comp, i had the SDK installed already, i found the Orca.msi file and installed it..
Im still not sure how to use what you just provided for me?
I copy and paste that into notepad, change the 'OpenDatabase' line to reflect the current path of my MSI file, then save the notepad data into a file with an extension of .WSF into the folder my VSI Project is in? And then what? How do i integrate it into my MSI file?
-
Re: Vista Error (MSWINSCK.OCX)
After you create a fresh MSI file you run this script (just double-click it).
The alternative is to run Orca, open your MSI with it, open the Property table, and add a new row and set the Property column to ALLUSERS and the Value column to 2.
The script is easier (you have to do this every time you make a new MSI).
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
After you create a fresh MSI file you run this script (just double-click it).
The alternative is to run Orca, open your MSI with it, open the Property table, and add a new row and set the Property column to ALLUSERS and the Value column to 2.
The script is easier (you have to do this every time you make a new MSI).
Ok, gonna give it a shot, i totally understand it with orca and the WSF file. I'll let you know in a few minutes if it worked or not.
-
Re: Vista Error (MSWINSCK.OCX)
VSI 1.1 can't be told to use an ALLUSERS value. No idea why not, but I think it was crippled intentionally as welfare for InstallShield, etc.
NONE of this will help with your patcher though. It will still need elevation one way or another (manifest or "runas")... unless it only writes to non-protected filesystem and registry locations.
Good luck!
-
Re: Vista Error (MSWINSCK.OCX)
Alot happening while I was gone. :thumb:
Itsthe Virtualization that is fooling the other user accounts from seeing winsock being registered on the system(s). This is what I was getting at when trying to determine where and if he could see the ocx being registered under.
Good analysis on detecting the all user installation wasnt being handled by the installer dilettante. :thumb:
I think this is turning out to be more of an installation issue so Thread Moved
-
Re: Vista Error (MSWINSCK.OCX)
Well, after adding the manifest file from RobDog888, and sticking in ALLUSERS with a value of 2 into the MSI file after being built, it works!
by the way, wow.. didnt know we even had an Application Deployment section haha
So should i test this and see if the manifest file RobDog888 suggested is necessary for this to work in vista? Or is it a definite must regardless?
-
Re: Vista Error (MSWINSCK.OCX)
Thanks. "Even a blind squirrel..." as they say. I thought this was a Winsock control usage issue myself.
I've been holding back on suggesting reg-free COM. I find it helps a lot in Vista. Of course his application probably targets OSs before WinXP as well anyway so it wouldn't apply.
-
Re: Vista Error (MSWINSCK.OCX)
Glad it's working!
You might keep the manifest if your patcher writes to Program Files. The ShellExecute with "runas" will probably give a pre-Vista user heartburn... they changed how it works in Vista from the earlier versions of Windows. Pre-Vista the Vista Trust stuff will be ignored as long as correctly formatted.
-
Re: Vista Error (MSWINSCK.OCX)
Quote:
Originally Posted by dilettante
Thanks. "Even a blind squirrel..." as they say. I thought this was a Winsock control usage issue myself.
I've been holding back on suggesting reg-free COM. I find it helps a lot in Vista. Of course his application probably targets OSs before WinXP as well anyway so it wouldn't apply.
This app was originally intended for XP only, no support for any older OS's.. Awhile after Vista came out, i decided i should make it vista compatible since eventually, everyone will have to move to vista... So thats where im at now, XP and Vista only, i dont care if it does or doesnt work on any other OS, the app is for this company i work for, and we only use XP and Vista :bigyello: