Skip to content

Conversation

@eranl
Copy link
Contributor

@eranl eranl commented Oct 18, 2025

This is a partial mapping of WlanApi.h.

Copy link
Member

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I made a first pass. Please have a look at the inline comments.

}

int WlanOpenHandle(int dwClientVersion, Pointer pReserved, IntByReference pdwNegotiatedVersion,
PointerByReference phClientHandle);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PointerByReference phClientHandle);
HANDLEByReference phClientHandle);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 37 to 40
@Override
protected List<String> getFieldOrder() {
return Arrays.asList("dwNumberOfItems", "dwIndex", "InterfaceInfo");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,188 @@
package com.sun.jna.platform.win32;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license header is missing (see for example

/* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved
*
* The contents of this file is dual-licensed under 2
* alternative Open Source/Free licenses: LGPL 2.1 or later and
* Apache License 2.0. (starting with JNA version 4.0.0).
*
* You can freely decide which license you want to apply to
* the project.
*
* You may obtain a copy of the LGPL License at:
*
* http://www.gnu.org/licenses/licenses.html
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "LGPL2.1".
*
* You may obtain a copy of the Apache License at:
*
* http://www.apache.org/licenses/
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "AL2.0".
*/
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

class WLAN_INTERFACE_INFO extends Structure {
public GUID InterfaceGuid;
public char[] strInterfaceDescription = new char[WLAN_MAX_NAME_LENGTH];
public int isState; // WLAN_INTERFACE_STATE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this javadoc, then people might see this in IDE help. I.e.:

        /**
         * See {@link WLAN_INTERFACE_STATE} for possible values
         */
        public int isState;

This applies to other similar constructs in here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return Arrays.asList("dwNumberOfItems", "dwIndex", "InterfaceInfo");
}

public void read() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing @Override

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

public int wlanConnectionMode; // WLAN_CONNECTION_MODE
public char[] strProfileName = new char[WLAN_MAX_NAME_LENGTH];
public WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes;
// Other fields omitted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break hard, if there is ever a use in an array or embedded inside another structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it acceptable to just add a warning about this in the doc, or should I complete these structures?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If necessary I can live with a warning, on the other hand here is a single field missing which is admittedly a structure itself, but that is also not that big.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed structures.

Comment on lines 134 to 143
class HANDLE extends WinNT.HANDLE {
public HANDLE() {
}

public HANDLE(Pointer p) {
super(p);
}
}

class GUID extends Guid.GUID {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These redefinitions are not necessary and should not be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Member

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I checked the type definitions against MSDN and the headers are a bit convoluted. I see:

  • Definitions from Wlantypes.h (or Windot11.h, see blow):

    • DOT11_SSID_MAX_LENGTH
    • DOT11_AUTH_ALGORITHM
    • DOT11_CIPHER_ALGORITHM
    • DOT11_BSS_TYPE (it is defined in Wlantypes.h, MSDN says you should include windot11.h ...)
    • DOT11_SSID (it is defined in Wlantypes.h, MSDN says you should include windot11.h ...)
  • Definitions from Windot11.h:

    • DOT11_MAC_ADDRESS
    • DOT11_PHY_TYPE

I think moving the referenced types to Windot11.java might be the cleanest solution.

For the type mapping of WLAN_SECURITY_ATTRIBUTES, please ensure, that a correct typemapper is active. boolean is not well defined. In Windows it is BOOL (32bit), but people would like to have boolean be a C bool, which is one byte (commonly). Use the com.sun.jna.win32.W32APITypeMapper.UNICODE mapper.

int DOT11_AUTH_ALGO_WPA_PSK = 4;
int DOT11_AUTH_ALGO_WPA_NONE = 5; // used in NatSTA only
int DOT11_AUTH_ALGO_RSNA = 6;
int DOT11_AUTH_ALGO_RSNA_PSK = 7;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int DOT11_AUTH_ALGO_RSNA_PSK = 7;
int DOT11_AUTH_ALGO_RSNA_PSK = 7;
int DOT11_AUTH_ALGO_WPA3 = 8;
int DOT11_AUTH_ALGO_WPA3_ENT_192 = DOT11_AUTH_ALGO_WPA3;
int DOT11_AUTH_ALGO_WPA3_SAE = 9;
int DOT11_AUTH_ALGO_OWE = 10;
int DOT11_AUTH_ALGO_WPA3_ENT = 11;

int DOT11_CIPHER_ALGO_WEP40 = 0x01;
int DOT11_CIPHER_ALGO_TKIP = 0x02;
int DOT11_CIPHER_ALGO_CCMP = 0x04;
int DOT11_CIPHER_ALGO_WEP104 = 0x05;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int DOT11_CIPHER_ALGO_WEP104 = 0x05;
int DOT11_CIPHER_ALGO_WEP104 = 0x05;
int DOT11_CIPHER_ALGO_BIP = 0x06;
int DOT11_CIPHER_ALGO_GCMP = 0x08;
int DOT11_CIPHER_ALGO_GCMP_256 = 0x09;
int DOT11_CIPHER_ALGO_CCMP_256 = 0x0a;
int DOT11_CIPHER_ALGO_BIP_GMAC_128 = 0x0b;
int DOT11_CIPHER_ALGO_BIP_GMAC_256 = 0x0c;
int DOT11_CIPHER_ALGO_BIP_CMAC_256 = 0x0d;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants