The GUID is obtained the same way the stock Wlan::API does it and it is used all over the place, e.g in the (added by me) WlanSetProfile(), which creates a new profile from the required XML structures like thus:

sub WlanSetProfile { croak "Wlan functions are not available" unless $wlan_available; my ($handle, $guuid, $xmlref) = @_; my $reason = Zero; $API{ WlanSetProfile }->Call($handle, $guuid, 0, $$xmlref, 0, 1, 0 +, $reason) == 0 or die "$^E"; };

Background: I want to automate establishing an ad-hoc network. On XP, insecure WEP is the only available encryption method. So, in order to make things a bit more secure, before connecting I create a new profile with a new WEP key, effectively creating a session key.

WlanSetProfile() succeeds and I can use the new profile to connect manually. So, the GUID is good. Also, the UTF16LE profilename is good, because before creating a new profile, I do some housekeeping and delete the previously used profile with the (added by me) WlanDeleteProfile()

sub WlanDeleteProfile { croak "Wlan functions are not available" unless $wlan_available; my ($handle, $guuid, $profilename) = @_; $API{ WlanDeleteProfile }->Call($handle, $guuid, $profilename, 0) +== 0 or die "$^E"; };

Deleting a profile works by supplying its name in the required fashion. WlanDeleteProfile() succeeds.

Unfortunately, using S for P in the signature

['WlanConnect' => 'IPSI' => 'I']

makes no difference.

I think my best bet is to follow Corion's suggestion and investigate pack()ing some string.


In reply to Re^4: Adding WlanConnect() to Win32::Wlan::API by tomsell
in thread Adding WlanConnect() to Win32::Wlan::API by tomsell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.