Code Monkey home page Code Monkey logo

Comments (4)

robinwassen avatar robinwassen commented on August 25, 2024

Robert Austen contacted me with a solution to the problem.

The core issue that a binary compiled with x86 architecture won't be able to call WlanSetProfileEapXmlUserData on a x64 Windows 7/8. See: http://social.msdn.microsoft.com/Forums/en-US/130b1fef-213b-493b-9aab-0ee8978106b2/wlanapidll-wlansetprofileeapxmluserdata

Mail from Robert

Well after much work, I finally got this working. I haven't been able to convert this to C# yet but I got it working with C++. The key was the make the application x64 in order for it to work with Windows 7 64-bit. So don't forget to change the Active Platform to x64. At least I know this will work on Windows 7 64-bit now. So I was able to use the Native WIFI API in C# to create the profile and then this test C++ application to set the credentials. I verified that it works and I can connect. I probably won't spend too much time trying to get this to work in C#. I might end up just making this into 2 DLLs (x86 and x64) that my C# application will call.

Sample code provided by Robert: https://gist.github.com/robinwassen/6164456

from simplewifi.

robinwassen avatar robinwassen commented on August 25, 2024

The solution I would propose for SimpleWifi is probably something similar. Create a shim in c++ compiled to both a x86 and x64 assembly, then make the C# library select the appropriate assembly depending on the current OS architecture.

from simplewifi.

robinwassen avatar robinwassen commented on August 25, 2024

Some followup from Robert:

What is strange is that I created a x64 DLL which sets the XML. In fact I am not passing it any data and is basically my console application turned into a DLL. If my C# calls the DLL, I get the same 1206 error that I was getting before. I have my C# application x64 as well so it appears something funny is going on when a x64 C# console application tries to load a x64 DLL that makes this API call. Worst case scenario I will just make it a console application where you pass it parameters to use.

Looks like the issue is running the application in debug mode within Visual Studio. If I just run the application outside VS it gets a return code of 0.

So doing some more testing. I finally got the PInvoke in C# to work now. The key is that I can't debug in Windows as I have to run the code outside of the application and I have to set the platform to x64. Setting it to Any CPU causes it to fail. So now I don't have to create a C++ DLL.

from simplewifi.

Mk2209 avatar Mk2209 commented on August 25, 2024

Thanks for your answer. I shall pass from time to time to see if there has been some progress.

from simplewifi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.