windows: Use WINAPI call convention for Windows API callbacks

For x86_64 it does not actually matter, but for i686 builds the call convention
is different with WINAPI.
This commit is contained in:
Martin Willi
2014-06-06 16:28:28 +02:00
parent bd19e27ae3
commit cab59c73fc
8 changed files with 28 additions and 23 deletions
@@ -355,9 +355,11 @@ typedef struct {
/**
* NotifyIpInterfaceChange() callback
*/
static void change_interface(private_kernel_iph_net_t *this,
MIB_IPINTERFACE_ROW_FIXUP *row, MIB_NOTIFICATION_TYPE type)
static void WINAPI change_interface(void *user, PMIB_IPINTERFACE_ROW row_badal,
MIB_NOTIFICATION_TYPE type)
{
private_kernel_iph_net_t *this = user;
MIB_IPINTERFACE_ROW_FIXUP* row = (MIB_IPINTERFACE_ROW_FIXUP*)row_badal;
IP_ADAPTER_ADDRESSES addrs[64], *current;
ULONG res, size = sizeof(addrs);
@@ -757,7 +759,8 @@ kernel_iph_net_t *kernel_iph_net_create()
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.ifaces = linked_list_create(),
);
/* PIPINTERFACE_CHANGE_CALLBACK is not using WINAPI in MinGW, which seems
* to be wrong. Force a cast to our WINAPI call */
res = NotifyIpInterfaceChange(AF_UNSPEC, (void*)change_interface,
this, TRUE, &this->changes);
if (res != NO_ERROR)
@@ -1545,9 +1545,9 @@ static traffic_selector_t *addr2ts(FWP_IP_VERSION version, void *data,
/**
* FwpmNetEventSubscribe0() callback
*/
static void event_callback(private_kernel_wfp_ipsec_t *this,
const FWPM_NET_EVENT1 *event)
static void WINAPI event_callback(void *user, const FWPM_NET_EVENT1 *event)
{
private_kernel_wfp_ipsec_t *this = user;
traffic_selector_t *local = NULL, *remote = NULL;
u_int8_t protocol = 0;
u_int16_t from_local = 0, to_local = 65535;
@@ -1610,7 +1610,7 @@ static bool register_events(private_kernel_wfp_ipsec_t *this)
DWORD res;
res = FwpmNetEventSubscribe0(this->handle, &subscription,
(void*)event_callback, this, &this->event);
event_callback, this, &this->event);
if (res != ERROR_SUCCESS)
{
DBG1(DBG_KNL, "registering for WFP events failed: 0x%08x", res);
@@ -75,14 +75,14 @@ struct private_socket_win_socket_t {
/**
* WSASendMsg function
*/
int (*WSASendMsg)(SOCKET, LPWSAMSG, DWORD, LPDWORD,
LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI (*WSASendMsg)(SOCKET, LPWSAMSG, DWORD, LPDWORD,
LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
/**
* WSARecvMsg function
*/
int (*WSARecvMsg)(SOCKET, LPWSAMSG, LPDWORD,
LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI (*WSARecvMsg)(SOCKET, LPWSAMSG, LPDWORD,
LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
};
METHOD(socket_t, receiver, status_t,