Error in registering COM server from bat file lauched from RunOnce - dll

I am currently working on my product installation in Windows XP 64-bit machine. I am trying to register my COM modules as part of installation. I am doing this by adding an entry in 'RunOnce' (registry) key to launch a bat file and registration is done from that bat file.
All my COM dlls are registered correctly but two of the COM servers (.exe) showing error that it failed to load one of its dependency dll. But the same dll is statically linked with another COM server and this server registered successfully !
And surprisingly running the same bat file directly(double clicking on it) doesn't generate any errors and its works fine for all assemblies!. I have checked this in couple of my test machines only of the machines showing this behavior. Unfortunately that't the customer tool machine.
Its not dependency dll not available issue. Because after registering all files by directly running the bat file, I could reproduce this again by adding a key in RunOnce manually and restarting the machine.
Additional info, I am accessing this machine remotely via logmein.
Exact error message: "This application has failed to start because XXX.dll was not found. Re-installing the application may fix this problem".
This XXX.dll is not available in the same path but its in another folder and its path is available in path variable.
bat file content is;
"C:\WINDOWS\system32\regsvr32.exe" RemoteControlHandler.dll
"C:\WINDOWS\system32\regsvr32.exe" ProcPgmHandler.dll
"C:\WINDOWS\system32\regsvr32.exe" GEM300Handler.dll
"C:\WINDOWS\system32\regsvr32.exe" ICEScreenAdapter.ocx
HIB.exe /regserver //Throws error
JobManager.exe /regserver
Cim300Adapter.exe /regserver
GemEquipmentCtrl.exe /regserver //Throws error
Hope this information is enough for experts, feel free to ask if you need any additional information.
Nixon

Related

vb.net CLR/SHIM error: This application could not be started. --> Unable to find a version of the runtime to use

Getting an unexpected, "This application cannot be started" popup error that is suggesting SHIM_NOVERSION_FOUND error in .NET CLR. Here's what's going on...
I have two vb.net applications:
1- MyApp.exe -- Windows Forms App
2- Launcher.exe -- Windows Service
Both are .NET framework 4.5 applications, and Launcher.exe is embedded inside MyApp.exe. Both are configured for AnyCPU, and neither use an app.config file. The reason being that the delivery tool can only deliver a single file, so I can't include any extras. The executable must be self-contained, and you can't embed an app.config file.
The execution runs in the following layers:
Layer 1: Delivery tool
Native C++ application
Elevated, running as Local System Account
Layer 2: MyApp.exe
.NET 4.5 application
Elevated, running as Local System Account
It runs fine, and installs Launcher.exe as a new Windows Service.
Layer 3: Launcher.exe
.NET 4.5 Windows Service
Elevated, running as Local System Account
Uses Windows API calls to enable the following privileges: SE_INCREASE_QUOTA_NAME, SE_ASSIGNPRIMARYTOKEN_NAME, SE_TCB_NAME
In summary, it uses elevated privileges to search for Explorer.exe processes, open them, duplicate the user's security token, and call the CreateProcessAsUser() API, using the user's token, in order to launch a second copy of MyApp.exe, running on the user's desktop.
Layer 4: MyApp.exe
.NET 4.5 application
Fails to launch with popup error --> This application could not be started.
It's A COPY of MyApp.exe, same as layer 2.
I've enabled .NET CLR debugging to compare the loading of MyApp.exe at layers 2 and 4:
Layer 2:
6172,1589.119,Parsing config file: C:...\MyApp.exe.config
6172,1589.119,Config File (Open). Result:80070002
6172,1589.119,UseLegacyV2RuntimeActivationPolicy is set to 0
6172,1589.119,LegacyFunctionCall: GetFileVersion. Filename: C:...\MyApp.exe
6172,1589.119,LegacyFunctionCall: GetFileVersion. Filename: C:...\MyApp.exe
6172,1589.119,C:...\MyApp.exe was built with version: v4.0.30319
6172,1589.166,Decided on runtime: v4.0.30319
Layer 4:
6552,1594.704,Parsing config file: C:\windows\TEMP\MyApp.exe.config
6552,1594.704,Config File (Open). Result:80070002
6552,1594.704,UseLegacyV2RuntimeActivationPolicy is set to 0
6552,1594.704,LegacyFunctionCall: GetFileVersion. Filename: C:\windows\TEMP\MyApp.exe
6552,1594.704,ERROR: Unable to find a version of the runtime to use.
6552,1594.704,SEM_FAILCRITICALERRORS is set to 5
6552,1688.055,FunctionCall: RealDllMain. Reason: 0
6552,1688.055,FunctionCall: OnShimDllMainCalled. Reason: 0
Random facts:
This doesn't happen on all computers targeted.
Disabling the antivirus doesn't resolve on affected systems.
On some computers, the error only happens once, and subsequent executions do not reproduce the popup error.
Looking for any help in understanding or debugging WHY .NET CLR is unable to determine the runtime version to use, when that very same application has already launched successfully!
I had the same issue with a Windows service running as LocalSystem and a WPF application that I was trying to run using CreateProcessAsUser by duplicating the user token pertaining to the active session (WTSQueryUserToken). When running the .exe manually it worked, but when the service was trying to create the process I kept receiving "This application could not be started". I also got the same CLR logs as you with "ERROR: Unable to find a version of the runtime to use.".
These are the things I've done:
Set OnlyUseLatestCLR registry value to 1
Use UNC paths for mapped drives (I am running inside a Windows VM and for some reason the system could not find the path for the config file after loading the app)
Check firstly if the path you are passing to CreateProcessAsUser is correct.

Module comctl32.ocx failed to load in Windows 10 Home

I have an old VB 6 app that someone is trying to install. The user is trying to register Comctl32.ocx. The file is in C:\windows\system32. The user has Windows 10 Home. When trying to register using:
Regsvr32 c:\windows\system32\comctl32.ocx
The user gets the message:
The module "comctl32.ocx" failed to load. Make sure the binary is
stored at the specified path or debug it to check for problems with
the binary or dependent .DLL files. The specified module could not be
found.
Any ideas what the user can try?
See https://support.microsoft.com/en-us/kb/249873
Basically: You are trying to register from the wrong directory, 32 bit OCx must be in c:\windows\syswow64
Also make sure you execute that command from an elevated command prompt (Admin).

Could not load file or assembly 'microsoft.visualstudio.shell.ui.internal' or one of its dependencies. SQL Server 2012

My SQL Server 2012 suddenly stopped working here is all I got in popup message:
could not load file or assembly 'microsoft.visualstudio.shell.ui.internal' or one of its dependencies. An attempt was made to load a program with incorrect format.
I have Repaired using installation CD but no luck.
I had the same problem and fixed by uninstalling the Visual Studio 2010 Shell and installing back. Simply reinstalling doesn't work.
1. Download the Visual Studio 2010 Shell: https://www.microsoft.com/en-us/download/details.aspx?id=1366
2. Run the exe file and click uninstall(or remove).
3. Run the exe file and click install with default settings.
After these steps the Management Studio will work just fine.
I got this error in VS2013 when reparing in the logfille,
[113C:2588][2018-01-20T16:41:54]i000: MUX: ExecuteError: Package (vs_minshellcore) failed: Error Message Id: 1305 ErrorMessage: Error reading from file C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Shell.UI.Internal\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.UI.Internal.dll. Verify that the file exists and that you can access it.
and I check the file is exist, and I modify its access authority to complete control to every user account, but this error still occur,
Finally I delete this dll, and find same dll in another Normal Computer with VS , and copy the file paste to the problem computer, and run repair again then pass.
Share my works Microsoft.VisualStudio.Shell.UI.Internal.dll in Here.
But in my case after repair success, vs2013 still got error when opening, so I finally give up and turn to use vs2015, which luckly can work. It is a strange problem.
have this problem also with vs2019 community. I was trying to create the first 2019 project after it is installed. Then I got this. I ran the install exe file, vs_community.exe again in order to repaire it. But I found out that the install program request to restart the pc to finish the last step. Actually I restarted the pc afterwards manually. But I still did it by clicking on the button "restart pc". After the pc is restarted, the problem is gong. I can create project without any error.

How Do I Get The Resource DLL Code Samples In The Windows SDKs To Compile And Run?

I am currently trying to build a Resource DLL on on Windows Server 2003 and 2008. I am currently working with the Resource DLL code samples supplied with the Windows SDKs, and I can't get them to work.
On Windows Server 2008 I succeeded compiling the Windows 7 SDK ClipBook Server sample, but couldn't get it to properly work in the cluster. When I insert the resource as a resource type to the cluster using "cluster restype /create /dll" it works, but the resource is listed with an unknown type instead of a ClipBook Server type, as I think it should have as it is the type defined in the Resource DLL's code.
I also succeed in creating a resource of that type, but I can never get it to go Online. I always get the error:
System error 5079 has occurred (0x000013d7).
The specified node does not support a resource of this type. This may be due to version inconsistencies or due to the absence of the resource DLL on this node.
And this is despite the fact that the resource is located on all the nodes in the cluster including the one I try to start the resource on.
On Windows Server 2003, I'm working with the Platform SDK version 5.2, and I can't even get the ClipBook Server Resource DLL code sample to compile. I always get MIDL1001 Error saying that it cannot open the file cluscfgserver.idl. I added the path of the file's location to the include path of the project. That didn't work. When I tried to hard-code the path of the file, I got several linker errors when trying to link with this file.
If anyone knows anything about any of these problems, I would appreciate any input.
Those examples are old and busted. Here are a few things I had to go through to get the similar "File Share Sample" to work:
Convert the project to x64 (supposedly 32 bit resources still work, but I haven't been able to verify that)
Add the module definition file (.def) to the linker input property page so that the Startup function is exposed
There were several spots in code where CompareString is used to check the resource type name and 0 is expected on success, but it actually returns CSTR_EQUAL (3).
This is probably why you get the "(Unknown Type)" name.
To register the resource extension, cluster.exe won't accept spaces in the dll name, so in my case I had to use cluster /REGADMINEXT:'FILESH~2.dll'
Only the Property Sheet extension interface is supported, everything else (context menu, wizards) has been removed as of Server 2008
Check the extension DLL stdafx.cpp sources for the Resource Type "ClipBook Server". It should be "ClipBook Server Sample": const WCHAR g_wszResourceTypeNames[] = L"ClipBook Server Sample\0"

How do I install the Apache FtpServer as a service within Windows 7 (64-bit)?

I tried everything I could think of, but I always get this error when I try to start the Apache FtpServer service.
Windows could not start the Apache FtpServer on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 0.
Has anyone got Apache FtpServer to function as a Windows service in Windows 7 or even Windows Vista?
Note:
My Java_HOME environment variable is set as c:\java and I have a symbolic link, linking this directory to the longer C:\Program Files\Java\jdk1.6.0_17.
I also have another symbolic link pointing c:\ftp to the longer C:\Program Files (x86)\Apache Software Foundation\apache-ftpserver-1.0.3.
The only reason I did any of this in the first place is because I was reading that some people were having problems with spaces or long path names, but I tried physically moving the directories as well, all with the same error.
I had the same issue today using apache ftpser 1.0.5., the error message was "Failed installing 'ftpd' service".
The solution was to start the DOS command shell as "Administrator".