WlanConnect from wlanapi.dll in Windows XP fails - windows-xp

I am creating a program which will be able to connect automatically to a wireless network. For doing that, I am using a library called ManagedWifi, which uses the library "wlanapi.dll". When I try to use the code on Windows Vista, everything is fine, but when I use it on Windows XP it fails. I have checked that it has Service Pack 3 installed, and "wlanapi.dll" is located in Windows/system32. The problem is when ManagedWifi calls this method:
[DllImport("wlanapi.dll")]
public static extern int WlanConnect(
[In] IntPtr clientHandle,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
[In] ref WlanConnectionParameters connectionParameters,
IntPtr pReserved);
It throws an error System.ComponentModel.Win32Exception: Element not found. But, if the library is correctly located in system32, why does it throw this error? And why only in Windows XP and not in Vista?
Thank you very much to everyone
EDIT: I have checked boith file versions, Vista and XP, and I've seen they are different (XP: 5.1, Vista: 6.0) but I have copied Vista's version to XP and I still have the same problem

Solved
The problem is that Windows XP, when the network is an adhoc network, adds the "-adhoc" sufix to the name. When I was trying to connect to it, it didn't find the "xxx" network

Using :
[DllImport("wlanapi.dll")]
internal static extern int WlanSetProfile(
[In] IntPtr hClientHandle,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
[In] WlanProfileFlags dwFlags,
[In, MarshalAs(UnmanagedType.LPWStr)] string strProfileXml,
[In, MarshalAs(UnmanagedType.LPWStr)] string strAllUserProfileSecurity,
[In] bool bOverwrite,
[In, Out] IntPtr pReserved,
[Out] out WlanReasonCode dwReasonCode
);
You have to create the profile first, Element not found says that the profile which you are trying to connect is not available

Related

Apache Ignite crash on startup

I'm using Apache Ignite entity framework Nuget as a second level cache in an ApsNetCore 2.0 web application under IIS(as reverse proxy).
On my development machine (VS2017 Windows 8.1) everything works well. Wen i deploy to WindowsServer 2012 the Ignite crash at startup with :
An error occurred while starting the application.
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck)
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration.GetOrStartIgnite(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration..ctor()
I checked and re-chewed, installed the JDK , correct system variables....everything. The error don't goes away. What is interesting is the application run ok as console. When it runs under IIS(reverse proxy) it crashes at startup with the above error.
Any suggestions ?
Thank you
I managed to start the website. How ? Only with JDK 11 and explicit path to jvm.dll on app.config file:
If is not explicit in config then crashes.
The JAVA_HOME from system variable is correct set. Also the Path variable is
%JAVA_HOME%;%JAVA_HOME%\bin;%JAVA_HOME%\bin\server;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Memurai;C:\Program Files\Java\jdk-15.0.1\bin\
Maybe is a conflict with C:\Program Files\Java\jdk-15.0.1\bin\ ? It carsh with jvm 15. But it works with jvm 11
Looks like the IIS worker process is running in 32-bit mode, so Ignite looks for a 32-bit JDK, which is not present.
And the console app runs in 64-bit mode, using 64-bit JDK, so it works.
Please check the app pool settings in IIS Manager -> Application Pools -> select the app pool you want and -> Advanced Settings.
Additionally, you can enable detailed logging to a file (since you can't see console logs in IIS) - Ignite logs all attempts to resolve the JDK path. For example, with Apache.Ignite.NLog package:
var nlogConfig = new LoggingConfiguration();
var fileTarget = new FileTarget
{
FileName = "/home/pavel/w/ignite_nlog.log"
};
nlogConfig.AddTarget("logfile", fileTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogManager.Configuration = nlogConfig;
var igniteConfig = new IgniteConfiguration
{
Logger = new IgniteNLogLogger()
};
Ignition.Start(igniteConfig);
I've checked the suggested points by Pavel Tupitsyn:
App pool aplication is 64bits (emable 32bits=false)
I've installed apache.Ignite.NLog
I'tested it on my machine and it logs well all java resolves.
I've deployed to windows server 2012 and under IIS i'm getting 'Process Failure'.
The log file looks like:
2020-12-07 19:39:38.3304|DEBUG||Starting Ignite.NET 2.9.0.50002
2020-12-07 19:39:38.3834|WARN||GC server mode is not enabled, this could lead to less than optimal performance on multi-core machines (to enable see http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).
2020-12-07 19:39:46.2534|DEBUG||Starting Ignite.NET 2.9.0.50002
so...just a warning (present on my machine too).
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:
Apache.Ignite.Core.Common.IgniteException
at Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(System.String, Apache.Ignite.Core.Log.ILogger)
at Apache.Ignite.Core.Ignition.Start(Apache.Ignite.Core.IgniteConfiguration)
at Nop.Web.Program.Main(System.String[])
well...adding apache.ingite.nlog throws PROCESS FAILURE
Hosting is virtual machine with Windows Server 2012 64bits
Any other ideas please....

The port 'COM11' does not exist. Specified port is not open

I have been using Unity and teensy to perform serial communication for quite some time. And it has been working fine.
Now I changed my teensy board and thus the COM Port has changed on it.
Teensy is communicating perfectly in arduino and sending all the right signals when checked in serial monitor. But I am getting this error in unity.
> IOException: The port `COM11' does not exist.
System.IO.Ports.WinSerialStream.ReportIOError (System.String optional_arg)
System.IO.Ports.WinSerialStream..ctor (System.String port_name, Int32
baud_rate, Int32 data_bits, Parity parity, StopBits sb, Boolean dtr_enable, Boolean rts_enable, Handshake hs, Int32 read_timeout, Int32 write_timeout, Int32 read_buffer_size, Int32 write_buffer_size)
(wrapper remoting-invoke-with-check) System.IO.Ports.WinSerialStream:.ctor (string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
System.IO.Ports.SerialPort.Open ()
Initially the com ports were single digit values such as COM4 or COM8 etc. But since I started getting twodigit COM Ports I started facing this problem. If I connect a teensy again with a single digit com port it works fine but does not detect COM50 etc.
How do I solve this?
If this is Windows OS then try to specify the COM port name as \\.\COM11
myPort= new SerialPort("\\\\.\\COM11",9600);
NOTES: This syntax also works for ports COM1 through COM9. Certain boards will let you choose the port names yourself. This syntax works for those names as well.
Use System.IO.Ports.SerialPort.GetPortNames() to see what names does the OS use for current COM ports. (I'm not sure if you're talking about .NET, but if you do this helps)
Use
foreach(string str in SerialPort.GetPortNames())
{
Debug.WriteLine(string.Format("Existing COM port: {0}", str));
}
For know the ports available

'sqlite3.dll was not loaded' when trying to install GitHub

I am trying to install GitHub using GitHubSetup.exe, downloaded from windows.github.com. The setup program 'downloads' what it needs, then closes and does nothing more.
Looking at TheLog.txt (in AppData/GitHub) shows the following:
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Dumping Loaded Module List
2015-04-09 12:18:24.0325|ERROR|thread: 1|CrashManager|Aieeeeeeee!
System.TypeInitializationException: The type initializer for 'NativeMethods' threw an exception. ---> System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
--- End of inner exception stack trace ---
at SQLitePCL.SQLite3Provider.NativeMethods.sqlite3_open_v2(Byte[] filename, IntPtr& db, Int32 flags, Byte[] vfs)
at SQLitePCL.SQLite3Provider.SQLitePCL.ISQLite3Provider.sqlite3_open_v2(String filename, IntPtr& db, Int32 flags, String vfs)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.SQLitePersistentBlobCache..ctor(String databaseFile, IScheduler scheduler)
at GitHub.Helpers.SqlitePersistentBlobCacheFactory.CreateBlobCache(String path)
at GitHub.Helpers.SharedCache.<>c__DisplayClass5.<.ctor>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at GitHub.Helpers.SharedCache.get_LocalMachine()
at GitHub.Helpers.AppLogManager.get_AnonymousIdentifier()
at GitHub.Helpers.HaystackTarget.Write(LogEventInfo logEvent)
at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
2015-04-09 12:18:24.0747|ERROR|thread: 1|CrashManager|Inner Exception
System.Exception: sqlite3.dll was not loaded.
at SQLitePCL.SQLite3Provider.NativeMethods..cctor()
'sqlite3.dll was not loaded.' is also the error I get when I try to click on the GitHib shortcut that is placed on the desktop.
I am running Windows 8.1, 64 bit.
I have tried downloading a sqlite3.dll file and placing it in system32, but that does nothing. I have also explicitly told my firewall to allow connections for the setup program. I feel a little in over my head here - does anyone have any suggestions?
Please let me know if I need to provide any more information!
Thanks a lot!
Brendan here, one of the GitHub for Windows developers.
The latest update introduced a dependency that required a version of the Visual C++ Redistributable that wasn't installed as a pre-requisite. As a workaround, you can install the 32-bit version from here which adds it back in:
http://www.microsoft.com/en-us/download/details.aspx?id=30679

CSPack RemotingException while packaging Cloud service project with MSBuild

I have a powershell script that is packaging our builds and deploys them to Azure Cloud Services. This script was running without any problem with SDK 2.3, but when we upgraded to SDK 2.5 we started receiving the following error while building the project:
CorePublish:
CorePublish: PackageWebRole = True
Publishing starting...
RolePlugins is
Importedmodules is
Publishing to 'bin\Release\app.publish\'
Creating directory "bin\Release\app.publish\".
TargetServiceDefinition is bin\Release\ServiceDefinition.csdef
TargetServiceConfiguration is bin\Release\ServiceConfiguration.cscfg
Roles is E:\Preview\temp\Azure\obj\Release\App\
error MSB4018: The "CSPack" task failed unexpectedly.
System.Runtime.Remoting.RemotingException: Object '/54628d54_42c6_4d39_bc4c_958b6bfaeb90/6y8efa6v6y8omskqeetyix8g_4.rem' has been disconnected or does not exist at the server.
at System.IO.FileStream.get_CanRead()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.CheckFileAccessParameter(Stream stream, FileAccess access)
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at Microsoft.ServiceHosting.Tools.Packaging.Utils.CopyFullStreamToPart(Stream source, PackagePart part, PackageManifest manifest)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream, Action`1 postProcess, PackageRestrictions restrictions)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
It is running on Windows Server 2008 R2, using MSBuild from VS2013 and the MSBuild is runnin like this parameters (from powershell):
& $msBuildPath "$tempPath\Azure\Azure.ccproj" /p:TargetProfile=Cloud /p:Configuration=Release /target:publish /flp:"Verbosity=quiet;logfile=E:\AzurePreview\msbuild.log"
I could not find anything connected to this issue.
I even tried to remove all traces of VS, SDKs and tools that might be connected to powershell, VS or Azure in general and installed the necessary parts again rebut nothing helped.
Could you please help me resolve this issue?
After discussing this issue with Microsoft support, I was able to package the project using CSPack command line tool, so I'm using this as a workaround.
Edit:
This issue seems fixed in Azure SDK 2.7

Rally Ad-in for Excel- I can not connect to rally

I cannot connect to rally after installation of excel plugin. After every attempt of connection I receive message listed below:
Error connecting to Rally: Unable to connect to the remote server
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest&
request) at System.Net.WebClient.DownloadString(Uri address) at
Rally.RestApi.HttpService.Get(Uri target, IDictionary`2 headers) at
Rally.RestApi.RallyRestApi.MakeRequest(Uri uri) at
Rally.RestApi.RallyRestApi.GetByReference(String aRef, String[]
fetchedFields) at
Rally.RestApi.RallyRestApi.GetCurrentUser(String[] fetchedFields)
at RallyExcel.ExcelRestApi.GetUserInfo(Boolean includeWorkspaceData)
in E:\projects\exceladdin_tmp\RallyExcel\ExcelRestApi.cs:line 48 at
RallyExcel.RallyConnectionDialog.OnOKClicked(Object sender, EventArgs
e) in
E:\projects\exceladdin_tmp\RallyExcel\RallyConnectionDialog.cs:line 65
I have reinstalled plugin several times with no results. I also download .msi installation file from Rally page few times for those installations (in case it was broken).
I do not think that it is related with the Internet network since I was trying to connect using several different LANs with no results.
Looking at error message it seems that plugin need some files from disk “E:\”, which is (in my case) CD/DVD drive. I can not find any place (e.g. configuration file) where I can change this setting and direct it to any existing disk.
Finally, this problem appears also for my colleagues. We all are using Lenovo ThinkPad with Win 7 (usually 64) and MS Office 2010.
I will be grateful for any help.
I received the error below while trying to connect to Rally via Excel. It was because I needed to change my password in Rally. Once I opened up Rally in my browser and logged in, the web site requested that I change my password. Once I did that, I was able to connect to Rally via Excel.
Error connecting to Rally: Invalid JSON primitive: .
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)
at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)
at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)
at Rally.RestApi.DynamicJsonSerializer.Deserialize(String json)
at Rally.RestApi.RallyRestApi.GetByReference(String aRef, String[] fetchedFields)
at RallyExcel.RallyRestApiWrapper.GetCurrentUser(String[] fetchedFields) in C:\Users\admin\Documents\exceladdin\RallyExcel\ExcelRestApi.cs:line 343
at RallyExcel.ExcelRestApi.GetUserInfo(Boolean includeWorkspaceData) in C:\Users\admin\Documents\exceladdin\RallyExcel\ExcelRestApi.cs:line 78
at RallyExcel.RallyConnectionDialog.OnConnectClicked(Object sender, EventArgs e) in C:\Users\admin\Documents\exceladdin\RallyExcel\RallyConnectionDialog.cs:line 168