winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2013
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
645 discussions
Start a n
N
ew thread
Huw Davies : iphlpapi: Add interface enumeration for Android.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 21dc848378318519d28a535517fe0997e63f3fe3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=21dc848378318519d28a53551…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Sep 19 15:39:21 2013 +0100 iphlpapi: Add interface enumeration for Android. --- configure | 3 +- configure.ac | 3 +- dlls/iphlpapi/ifenum.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++- include/config.h.in | 6 ++ 4 files changed, 209 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e6f6971..a2f8e22 100755 --- a/configure +++ b/configure @@ -6235,7 +6235,7 @@ fi done -for ac_header in linux/ipx.h linux/irda.h +for ac_header in linux/ipx.h linux/irda.h linux/rtnetlink.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <sys/types.h> @@ -13405,6 +13405,7 @@ for ac_func in \ getpwuid \ gettimeofday \ getuid \ + if_nameindex \ kqueue \ lstat \ memmove \ diff --git a/configure.ac b/configure.ac index e03928c..b687119 100644 --- a/configure.ac +++ b/configure.ac @@ -606,7 +606,7 @@ AC_CHECK_HEADERS([netinet/tcp_timer.h netinet/udp_var.h netinet/icmp_var.h netin #include <netinet/tcp_timer.h> #endif]) -AC_CHECK_HEADERS([linux/ipx.h linux/irda.h],,, +AC_CHECK_HEADERS([linux/ipx.h linux/irda.h linux/rtnetlink.h],,, [#include <sys/types.h> #ifdef HAVE_ASM_TYPES_H # include <asm/types.h> @@ -2032,6 +2032,7 @@ AC_CHECK_FUNCS(\ getpwuid \ gettimeofday \ getuid \ + if_nameindex \ kqueue \ lstat \ memmove \ diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c index 6ad08a8..03c1b1a 100644 --- a/dlls/iphlpapi/ifenum.c +++ b/dlls/iphlpapi/ifenum.c @@ -79,6 +79,10 @@ #include <ifaddrs.h> #endif +#ifdef HAVE_LINUX_RTNETLINK_H +#include <linux/rtnetlink.h> +#endif + #include "ifenum.h" #include "ws2ipdef.h" @@ -161,7 +165,7 @@ BOOL isIfIndexLoopback(ULONG idx) return ret; } - +#ifdef HAVE_IF_NAMEINDEX DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) { DWORD count = 0, i; @@ -199,6 +203,200 @@ end: return count; } +#elif defined(HAVE_LINUX_RTNETLINK_H) +static int open_netlink( int *pid ) +{ + int fd = socket( AF_NETLINK, SOCK_RAW, NETLINK_ROUTE ); + struct sockaddr_nl addr; + socklen_t len; + + if (fd < 0) return fd; + + memset( &addr, 0, sizeof(addr) ); + addr.nl_family = AF_NETLINK; + + if (bind( fd, (struct sockaddr *)&addr, sizeof(addr) ) < 0) + goto fail; + + len = sizeof(addr); + if (getsockname( fd, (struct sockaddr *)&addr, &len ) < 0) + goto fail; + + *pid = addr.nl_pid; + return fd; +fail: + close( fd ); + return -1; +} + +static int send_netlink_req( int fd, int pid, int type, int *seq_no ) +{ + static LONG seq; + struct request + { + struct nlmsghdr hdr; + struct rtgenmsg gen; + } req; + struct sockaddr_nl addr; + + req.hdr.nlmsg_len = sizeof(req); + req.hdr.nlmsg_type = type; + req.hdr.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; + req.hdr.nlmsg_pid = pid; + req.hdr.nlmsg_seq = InterlockedIncrement( &seq ); + req.gen.rtgen_family = AF_UNSPEC; + + memset( &addr, 0, sizeof(addr) ); + addr.nl_family = AF_NETLINK; + if (sendto( fd, &req, sizeof(req), 0, (struct sockaddr *)&addr, sizeof(addr) ) != sizeof(req)) + return -1; + *seq_no = req.hdr.nlmsg_seq; + return 0; +} + +struct netlink_reply +{ + struct netlink_reply *next; + int size; + struct nlmsghdr *hdr; +}; + +static void free_netlink_reply( struct netlink_reply *data ) +{ + struct netlink_reply *ptr; + while( data ) + { + ptr = data->next; + HeapFree( GetProcessHeap(), 0, data ); + data = ptr; + } +} + +static int recv_netlink_reply( int fd, int pid, int seq, struct netlink_reply **data ) +{ + int bufsize = getpagesize(); + int left, read, done = 0; + socklen_t sa_len; + struct sockaddr_nl addr; + struct netlink_reply *cur, *last = NULL; + struct nlmsghdr *hdr; + char *buf; + + *data = NULL; + buf = HeapAlloc( GetProcessHeap(), 0, bufsize ); + if (!buf) return -1; + + do + { + left = read = recvfrom( fd, buf, bufsize, 0, (struct sockaddr *)&addr, &sa_len ); + if (read < 0) goto fail; + if (addr.nl_pid != 0) continue; /* not from kernel */ + + for (hdr = (struct nlmsghdr *)buf; NLMSG_OK(hdr, left); hdr = NLMSG_NEXT(hdr, left)) + { + if (hdr->nlmsg_pid != pid || hdr->nlmsg_seq != seq) continue; + if (hdr->nlmsg_type == NLMSG_DONE) + { + done = 1; + break; + } + } + + cur = HeapAlloc( GetProcessHeap(), 0, sizeof(*cur) + read ); + if (!cur) goto fail; + cur->next = NULL; + cur->size = read; + cur->hdr = (struct nlmsghdr *)(cur + 1); + memcpy( cur->hdr, buf, read ); + if (last) last->next = cur; + else *data = cur; + last = cur; + } while (!done); + + HeapFree( GetProcessHeap(), 0, buf ); + return 0; + +fail: + free_netlink_reply( *data ); + HeapFree( GetProcessHeap(), 0, buf ); + return -1; +} + + +static DWORD get_indices_from_reply( struct netlink_reply *reply, int pid, int seq, + BOOL skip_loopback, InterfaceIndexTable *table ) +{ + struct nlmsghdr *hdr; + struct netlink_reply *r; + int count = 0; + + for (r = reply; r; r = r->next) + { + int size = r->size; + for (hdr = r->hdr; NLMSG_OK(hdr, size); hdr = NLMSG_NEXT(hdr, size)) + { + if (hdr->nlmsg_pid != pid || hdr->nlmsg_seq != seq) continue; + if (hdr->nlmsg_type == NLMSG_DONE) break; + + if (hdr->nlmsg_type == RTM_NEWLINK) + { + struct ifinfomsg *info = NLMSG_DATA(hdr); + + if (skip_loopback && (info->ifi_flags & IFF_LOOPBACK)) continue; + if (table) table->indexes[count] = info->ifi_index; + count++; + } + } + } + return count; +} + +DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) +{ + int fd, pid, seq; + struct netlink_reply *reply = NULL; + DWORD count = 0; + + if (table) *table = NULL; + fd = open_netlink( &pid ); + if (fd < 0) return 0; + + if (send_netlink_req( fd, pid, RTM_GETLINK, &seq ) < 0) + goto end; + + if (recv_netlink_reply( fd, pid, seq, &reply ) < 0) + goto end; + + count = get_indices_from_reply( reply, pid, seq, skip_loopback, NULL ); + + if (table) + { + InterfaceIndexTable *ret = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(InterfaceIndexTable, indexes[count]) ); + if (!ret) + { + count = 0; + goto end; + } + + ret->numIndexes = count; + get_indices_from_reply( reply, pid, seq, skip_loopback, ret ); + *table = ret; + } + +end: + free_netlink_reply( reply ); + close( fd ); + return count; +} + +#else +DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) +{ + if (table) *table = NULL; + return 0; +} +#endif + static DWORD getInterfaceBCastAddrByName(const char *name) { DWORD ret = INADDR_ANY; diff --git a/include/config.h.in b/include/config.h.in index 62bee90..1f0bfea 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -258,6 +258,9 @@ /* Define to 1 if you have the <ifaddrs.h> header file. */ #undef HAVE_IFADDRS_H +/* Define to 1 if you have the `if_nameindex' function. */ +#undef HAVE_IF_NAMEINDEX + /* Define to 1 if you have the <inet/mib2.h> header file. */ #undef HAVE_INET_MIB2_H @@ -432,6 +435,9 @@ /* Define to 1 if you have the <linux/param.h> header file. */ #undef HAVE_LINUX_PARAM_H +/* Define to 1 if you have the <linux/rtnetlink.h> header file. */ +#undef HAVE_LINUX_RTNETLINK_H + /* Define to 1 if you have the <linux/serial.h> header file. */ #undef HAVE_LINUX_SERIAL_H
1
0
0
0
Huw Davies : iphlpapi: Combine the various interface enumeration functions into one function.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 8876c3ee820a7c0ef6662ef6c81f45bab0b204ae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8876c3ee820a7c0ef6662ef6c…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Sep 19 15:39:20 2013 +0100 iphlpapi: Combine the various interface enumeration functions into one function. --- dlls/iphlpapi/ifenum.c | 119 ++++++++++------------------------------- dlls/iphlpapi/ifenum.h | 13 ++--- dlls/iphlpapi/iphlpapi_main.c | 18 ++++--- dlls/iphlpapi/ipstats.c | 4 +- 4 files changed, 45 insertions(+), 109 deletions(-) diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c index d8eebca..6ad08a8 100644 --- a/dlls/iphlpapi/ifenum.c +++ b/dlls/iphlpapi/ifenum.c @@ -161,103 +161,42 @@ BOOL isIfIndexLoopback(ULONG idx) return ret; } -DWORD getNumNonLoopbackInterfaces(void) -{ - DWORD numInterfaces; - int fd = socket(PF_INET, SOCK_DGRAM, 0); - - if (fd != -1) { - struct if_nameindex *indexes = if_nameindex(); - - if (indexes) { - struct if_nameindex *p; - - for (p = indexes, numInterfaces = 0; p && p->if_name; p++) - if (!isLoopbackInterface(fd, p->if_name)) - numInterfaces++; - if_freenameindex(indexes); - } - else - numInterfaces = 0; - close(fd); - } - else - numInterfaces = 0; - return numInterfaces; -} -DWORD getNumInterfaces(void) +DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) { - DWORD numInterfaces; - struct if_nameindex *indexes = if_nameindex(); + DWORD count = 0, i; + struct if_nameindex *p, *indices = if_nameindex(); + InterfaceIndexTable *ret; - if (indexes) { - struct if_nameindex *p; + if (table) *table = NULL; + if (!indices) return 0; - for (p = indexes, numInterfaces = 0; p && p->if_name; p++) - numInterfaces++; - if_freenameindex(indexes); - } - else - numInterfaces = 0; - return numInterfaces; -} - -InterfaceIndexTable *getInterfaceIndexTable(void) -{ - DWORD numInterfaces; - InterfaceIndexTable *ret; - struct if_nameindex *indexes = if_nameindex(); - - if (indexes) { - struct if_nameindex *p; - - for (p = indexes, numInterfaces = 0; p && p->if_name; p++) - numInterfaces++; - ret = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceIndexTable, indexes[numInterfaces])); - if (ret) { - ret->numIndexes = 0; - for (p = indexes; p && p->if_name; p++) - ret->indexes[ret->numIndexes++] = p->if_index; + for (p = indices; p->if_name; p++) + { + if (skip_loopback && isIfIndexLoopback( p->if_index )) continue; + count++; } - if_freenameindex(indexes); - } - else - ret = NULL; - return ret; -} - -InterfaceIndexTable *getNonLoopbackInterfaceIndexTable(void) -{ - DWORD numInterfaces; - InterfaceIndexTable *ret; - int fd = socket(PF_INET, SOCK_DGRAM, 0); - if (fd != -1) { - struct if_nameindex *indexes = if_nameindex(); - - if (indexes) { - struct if_nameindex *p; - - for (p = indexes, numInterfaces = 0; p && p->if_name; p++) - if (!isLoopbackInterface(fd, p->if_name)) - numInterfaces++; - ret = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceIndexTable, indexes[numInterfaces])); - if (ret) { - ret->numIndexes = 0; - for (p = indexes; p && p->if_name; p++) - if (!isLoopbackInterface(fd, p->if_name)) - ret->indexes[ret->numIndexes++] = p->if_index; - } - if_freenameindex(indexes); + if (table) + { + ret = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(InterfaceIndexTable, indexes[count]) ); + if (!ret) + { + count = 0; + goto end; + } + for (p = indices, i = 0; p->if_name && i < count; p++) + { + if (skip_loopback && isIfIndexLoopback( p->if_index )) continue; + ret->indexes[i++] = p->if_index; + } + ret->numIndexes = count = i; + *table = ret; } - else - ret = NULL; - close(fd); - } - else - ret = NULL; - return ret; + +end: + if_freenameindex( indices ); + return count; } static DWORD getInterfaceBCastAddrByName(const char *name) diff --git a/dlls/iphlpapi/ifenum.h b/dlls/iphlpapi/ifenum.h index 304f0db..49b6e7b 100644 --- a/dlls/iphlpapi/ifenum.h +++ b/dlls/iphlpapi/ifenum.h @@ -44,23 +44,18 @@ #define MAX_INTERFACE_PHYSADDR 8 #define MAX_INTERFACE_DESCRIPTION 256 -DWORD getNumInterfaces(void) DECLSPEC_HIDDEN; -DWORD getNumNonLoopbackInterfaces(void) DECLSPEC_HIDDEN; BOOL isIfIndexLoopback(ULONG idx) DECLSPEC_HIDDEN; -/* A table of interface indexes, see get*InterfaceTable(). */ +/* A table of interface indexes, see get_interface_indices(). */ typedef struct _InterfaceIndexTable { DWORD numIndexes; IF_INDEX indexes[1]; } InterfaceIndexTable; -/* Returns a table with all known interface indexes, or NULL if one could not - * be allocated. HeapFree() the returned table. +/* Returns the count of all interface indexes and optionally a ptr to an interface table. + * HeapFree() the returned table. Will optionally ignore loopback devices. */ -InterfaceIndexTable *getInterfaceIndexTable(void) DECLSPEC_HIDDEN; - -/* Like getInterfaceIndexTable, but filters out loopback interfaces. */ -InterfaceIndexTable *getNonLoopbackInterfaceIndexTable(void) DECLSPEC_HIDDEN; +DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) DECLSPEC_HIDDEN; /* ByName/ByIndex versions of various getter functions. */ diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index e2d09eb..9d23c82 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -463,7 +463,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen) if (!pOutBufLen) ret = ERROR_INVALID_PARAMETER; else { - DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces(); + DWORD numNonLoopbackInterfaces = get_interface_indices( TRUE, NULL ); if (numNonLoopbackInterfaces > 0) { DWORD numIPAddresses = getNumIPAddresses(); @@ -489,7 +489,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen) if (!ret) ret = AllocateAndGetIpForwardTableFromStack(&routeTable, FALSE, GetProcessHeap(), 0); if (!ret) - table = getNonLoopbackInterfaceIndexTable(); + get_interface_indices( TRUE, &table ); if (table) { size = sizeof(IP_ADAPTER_INFO) * table->numIndexes; size += ipAddrTable->dwNumEntries * sizeof(IP_ADDR_STRING); @@ -1129,7 +1129,7 @@ ULONG WINAPI DECLSPEC_HOTPATCH GetAdaptersAddresses(ULONG family, ULONG flags, P if (!buflen) return ERROR_INVALID_PARAMETER; - table = getInterfaceIndexTable(); + get_interface_indices( FALSE, &table ); if (!table || !table->numIndexes) { HeapFree(GetProcessHeap(), 0, table); @@ -1431,7 +1431,7 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder) if (!pdwSize) ret = ERROR_INVALID_PARAMETER; else { - DWORD numInterfaces = getNumInterfaces(); + DWORD numInterfaces = get_interface_indices( FALSE, NULL ); ULONG size = sizeof(MIB_IFTABLE); if (numInterfaces > 1) @@ -1441,7 +1441,8 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder) ret = ERROR_INSUFFICIENT_BUFFER; } else { - InterfaceIndexTable *table = getInterfaceIndexTable(); + InterfaceIndexTable *table; + get_interface_indices( FALSE, &table ); if (table) { size = sizeof(MIB_IFTABLE); @@ -1501,7 +1502,7 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen) if (!dwOutBufLen) ret = ERROR_INVALID_PARAMETER; else { - DWORD numInterfaces = getNumInterfaces(); + DWORD numInterfaces = get_interface_indices( FALSE, NULL ); ULONG size = sizeof(IP_INTERFACE_INFO); if (numInterfaces > 1) @@ -1511,7 +1512,8 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen) ret = ERROR_INSUFFICIENT_BUFFER; } else { - InterfaceIndexTable *table = getInterfaceIndexTable(); + InterfaceIndexTable *table; + get_interface_indices( FALSE, &table ); if (table) { size = sizeof(IP_INTERFACE_INFO); @@ -1837,7 +1839,7 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf) if (!pdwNumIf) ret = ERROR_INVALID_PARAMETER; else { - *pdwNumIf = getNumInterfaces(); + *pdwNumIf = get_interface_indices( FALSE, NULL ); ret = NO_ERROR; } TRACE("returning %d\n", ret); diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 1185f08..3ff30f3 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -763,7 +763,7 @@ DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS stats, DWORD family) if (family != WS_AF_INET && family != WS_AF_INET6) return ERROR_INVALID_PARAMETER; memset( stats, 0, sizeof(*stats) ); - stats->dwNumIf = stats->dwNumAddr = getNumInterfaces(); + stats->dwNumIf = stats->dwNumAddr = get_interface_indices( FALSE, NULL ); if (!AllocateAndGetIpForwardTableFromStack( &fwd_table, FALSE, GetProcessHeap(), 0 )) { stats->dwNumRoutes = fwd_table->dwNumEntries; @@ -1174,7 +1174,7 @@ DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS stats, DWORD family) if (family != WS_AF_INET && family != WS_AF_INET6) return ERROR_INVALID_PARAMETER; memset( stats, 0, sizeof(*stats) ); - stats->dwNumAddrs = getNumInterfaces(); + stats->dwNumAddrs = get_interface_indices( FALSE, NULL ); if (family == WS_AF_INET6) {
1
0
0
0
Hans Leidekker : rsaenh: Add support for retrieving the security descriptor on key containers.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 8e74c8953a60c128491026ce66d988c382a6c86c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8e74c8953a60c128491026ce6…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Thu Sep 19 16:23:42 2013 +0200 rsaenh: Add support for retrieving the security descriptor on key containers. --- dlls/advapi32/tests/crypt.c | 32 ++++++++++++++++++++++++++++++++ dlls/rsaenh/rsaenh.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 0 deletions(-) diff --git a/dlls/advapi32/tests/crypt.c b/dlls/advapi32/tests/crypt.c index 768dd3b..dc10cce 100644 --- a/dlls/advapi32/tests/crypt.c +++ b/dlls/advapi32/tests/crypt.c @@ -1140,6 +1140,37 @@ static void test_SystemFunction036(void) ok(ret == TRUE, "Expected SystemFunction036 to return TRUE, got %d\n", ret); } +static void test_container_sd(void) +{ + HCRYPTPROV prov; + SECURITY_DESCRIPTOR *sd; + DWORD len; + BOOL ret; + + ret = CryptAcquireContextA(&prov, "winetest", "Microsoft Enhanced Cryptographic Provider v1.0", + PROV_RSA_FULL, CRYPT_MACHINE_KEYSET|CRYPT_NEWKEYSET); + ok(ret, "got %u\n", GetLastError()); + + len = 0; + SetLastError(0xdeadbeef); + ret = CryptGetProvParam(prov, PP_KEYSET_SEC_DESCR, NULL, &len, OWNER_SECURITY_INFORMATION); + ok(ret, "got %u\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError()); + ok(len, "expected len > 0\n"); + + sd = HeapAlloc(GetProcessHeap(), 0, len); + ret = CryptGetProvParam(prov, PP_KEYSET_SEC_DESCR, (BYTE *)sd, &len, OWNER_SECURITY_INFORMATION); + ok(ret, "got %u\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, sd); + + ret = CryptReleaseContext(prov, 0); + ok(ret, "got %u\n", GetLastError()); + + ret = CryptAcquireContextA(&prov, "winetest", "Microsoft Enhanced Cryptographic Provider v1.0", + PROV_RSA_FULL, CRYPT_MACHINE_KEYSET|CRYPT_DELETEKEYSET); + ok(ret, "got %u\n", GetLastError()); +} + START_TEST(crypt) { init_function_pointers(); @@ -1151,6 +1182,7 @@ START_TEST(crypt) test_incorrect_api_usage(); test_verify_sig(); test_machine_guid(); + test_container_sd(); clean_up_environment(); } diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index b4e4b35..df2db42 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -38,6 +38,7 @@ #include "implglue.h" #include "objbase.h" #include "rpcproxy.h" +#include "aclapi.h" WINE_DEFAULT_DEBUG_CHANNEL(crypt); @@ -3674,6 +3675,7 @@ BOOL WINAPI RSAENH_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam * - PP_SIG_KEYSIZE_INC: RSA signature keywidth granularity in bits. * - PP_KEYX_KEYSIZE_INC: RSA key-exchange keywidth granularity in bits. * - PP_ENUMALGS{_EX}: Query provider capabilities. + * - PP_KEYSET_SEC_DESCR: Retrieve security descriptor on container. */ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags) @@ -3834,6 +3836,34 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, case PP_CRYPT_COUNT_KEY_USE: /* Asked for by IE About dialog */ return copy_param(pbData, pdwDataLen, abWTF, sizeof(abWTF)); + case PP_KEYSET_SEC_DESCR: + { + SECURITY_DESCRIPTOR *sd; + DWORD err, len, flags = (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET); + + if (!open_container_key(pKeyContainer->szName, flags, &hKey)) + { + SetLastError(NTE_BAD_KEYSET); + return FALSE; + } + + err = GetSecurityInfo(hKey, SE_REGISTRY_KEY, dwFlags, NULL, NULL, NULL, NULL, (void **)&sd); + RegCloseKey(hKey); + if (err) + { + SetLastError(err); + return FALSE; + } + + len = GetSecurityDescriptorLength(sd); + if (*pdwDataLen >= len) memcpy(pbData, sd, len); + else SetLastError(ERROR_INSUFFICIENT_BUFFER); + *pdwDataLen = len; + + LocalFree(sd); + return TRUE; + } + default: /* MSDN: Unknown parameter number in dwParam */ SetLastError(NTE_BAD_TYPE);
1
0
0
0
Bruno Jesus : ws2_32/tests: Mark WinNT result as broken.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 5dcf368e1bdf0b5bbfe6303a99e91d7827e9bdb3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5dcf368e1bdf0b5bbfe6303a9…
Author: Bruno Jesus <00cpxxx(a)gmail.com> Date: Thu Sep 19 09:17:05 2013 -0300 ws2_32/tests: Mark WinNT result as broken. --- dlls/ws2_32/tests/protocol.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c index 1b9a429..9c6d80d 100644 --- a/dlls/ws2_32/tests/protocol.c +++ b/dlls/ws2_32/tests/protocol.c @@ -100,7 +100,8 @@ static void test_WSAEnumProtocolsA(void) ret = WSAEnumProtocolsA( ptest, NULL, &len ); ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly\n"); error = WSAGetLastError(); - ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error); + ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */, + "Expected 10055, received %d\n", error); buffer = HeapAlloc( GetProcessHeap(), 0, len ); @@ -166,7 +167,8 @@ static void test_WSAEnumProtocolsW(void) ret = WSAEnumProtocolsW( ptest, NULL, &len ); ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly\n"); error = WSAGetLastError(); - ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error); + ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */, + "Expected 10055, received %d\n", error); buffer = HeapAlloc( GetProcessHeap(), 0, len );
1
0
0
0
Piotr Caban : msvcp60: Don' t call _Eos on allocation error or 0-length string in basic_string::reserve .
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: bd610a66c4da5954e60a4c9f9a3fe38b135e73ea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bd610a66c4da5954e60a4c9f9…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Thu Sep 19 11:58:55 2013 +0200 msvcp60: Don't call _Eos on allocation error or 0-length string in basic_string::reserve. --- dlls/msvcp60/string.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c index 6fe2780..1f64621 100644 --- a/dlls/msvcp60/string.c +++ b/dlls/msvcp60/string.c @@ -1714,8 +1714,8 @@ void __thiscall basic_string_char_reserve(basic_string_char *this, MSVCP_size_t if(len > size) return; - basic_string_char__Grow(this, size, FALSE); - basic_string_char__Eos(this, len); + if(basic_string_char__Grow(this, size, FALSE)) + basic_string_char__Eos(this, len); } /* ?empty@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE_NXZ */ @@ -3429,8 +3429,8 @@ void __thiscall basic_string_wchar_reserve(basic_string_wchar *this, MSVCP_size_ if(len > size) return; - basic_string_wchar__Grow(this, size, FALSE); - basic_string_wchar__Eos(this, len); + if(basic_string_wchar__Grow(this, size, FALSE)) + basic_string_wchar__Eos(this, len); } /* ?empty@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE_NXZ */
1
0
0
0
Stefan Dösinger : d3d8/tests: Test invalid volume lock boxes.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 8aa65c79e77d758595465681aa86d29f67180fea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8aa65c79e77d758595465681a…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Sep 19 11:02:57 2013 +0200 d3d8/tests: Test invalid volume lock boxes. --- dlls/d3d8/tests/device.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 121 insertions(+), 0 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index c16ee63..7932a7f 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -5733,6 +5733,126 @@ static void test_volume_blocks(void) DestroyWindow(window); } +static void test_lockbox_invalid(void) +{ + static const struct + { + D3DBOX box; + HRESULT result; + } + test_data[] = + { + {{0, 0, 2, 2, 0, 1}, D3D_OK}, /* Valid */ + {{0, 0, 4, 4, 0, 1}, D3D_OK}, /* Valid */ + {{0, 0, 0, 4, 0, 1}, D3DERR_INVALIDCALL}, /* 0 height */ + {{0, 0, 4, 0, 0, 1}, D3DERR_INVALIDCALL}, /* 0 width */ + {{0, 0, 4, 4, 1, 1}, D3DERR_INVALIDCALL}, /* 0 depth */ + {{4, 0, 0, 4, 0, 1}, D3DERR_INVALIDCALL}, /* left > right */ + {{0, 4, 4, 0, 0, 1}, D3DERR_INVALIDCALL}, /* top > bottom */ + {{0, 0, 4, 4, 1, 0}, D3DERR_INVALIDCALL}, /* back > front */ + {{0, 0, 8, 4, 0, 1}, D3DERR_INVALIDCALL}, /* right > surface */ + {{0, 0, 4, 8, 0, 1}, D3DERR_INVALIDCALL}, /* bottom > surface */ + {{0, 0, 4, 4, 0, 3}, D3DERR_INVALIDCALL}, /* back > surface */ + {{8, 0, 16, 4, 0, 1}, D3DERR_INVALIDCALL}, /* left > surface */ + {{0, 8, 4, 16, 0, 1}, D3DERR_INVALIDCALL}, /* top > surface */ + {{0, 0, 4, 4, 2, 4}, D3DERR_INVALIDCALL}, /* top > surface */ + }; + static const D3DBOX test_boxt_2 = {2, 2, 4, 4, 0, 1}; + IDirect3DVolumeTexture8 *texture = NULL; + D3DLOCKED_BOX locked_box; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + BYTE *base; + HRESULT hr; + + if (!(d3d = pDirect3DCreate8(D3D_SDK_VERSION))) + { + skip("Failed to create D3D object, skipping tests.\n"); + return; + } + + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice8_CreateVolumeTexture(device, 4, 4, 2, 1, 0, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture); + ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr); + base = locked_box.pBits; + hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + + for (i = 0; i < (sizeof(test_data) / sizeof(*test_data)); ++i) + { + unsigned int offset, expected_offset; + const D3DBOX *box = &test_data[i].box; + + locked_box.pBits = (BYTE *)0xdeadbeef; + locked_box.RowPitch = 0xdeadbeef; + locked_box.SlicePitch = 0xdeadbeef; + + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, box, 0); + /* Unlike surfaces, volumes properly check the box even in Windows XP */ + ok(hr == test_data[i].result, + "Got unexpected hr %#x with box [%u, %u, %u]->[%u, %u, %u], expected %#x.\n", + hr, box->Left, box->Top, box->Front, box->Right, box->Bottom, box->Back, + test_data[i].result); + if (FAILED(hr)) + continue; + + offset = (BYTE *)locked_box.pBits - base; + expected_offset = box->Front * locked_box.SlicePitch + box->Top * locked_box.RowPitch + box->Left * 4; + ok(offset == expected_offset, + "Got unexpected offset %u (expected %u) for rect [%u, %u, %u]->[%u, %u, %u].\n", + offset, expected_offset, box->Left, box->Top, box->Front, box->Right, box->Bottom, box->Back); + + hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + } + + /* locked_box = NULL throws an exception on Windows */ + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, NULL, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, &test_data[0].box, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_data[0].box.Left, test_data[0].box.Top, test_data[0].box.Front, + test_data[0].box.Right, test_data[0].box.Bottom, test_data[0].box.Back); + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, &test_data[0].box, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_data[0].box.Left, test_data[0].box.Top, test_data[0].box.Front, + test_data[0].box.Right, test_data[0].box.Bottom, test_data[0].box.Back); + hr = IDirect3DVolumeTexture8_LockBox(texture, 0, &locked_box, &test_boxt_2, 0); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for rect [%u, %u, %u]->[%u, %u, %u].\n", + hr, test_boxt_2.Left, test_boxt_2.Top, test_boxt_2.Front, + test_boxt_2.Right, test_boxt_2.Bottom, test_boxt_2.Back); + hr = IDirect3DVolumeTexture8_UnlockBox(texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); + + IDirect3DVolumeTexture8_Release(texture); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" ); @@ -5814,6 +5934,7 @@ START_TEST(device) test_update_volumetexture(); test_create_rt_ds_fail(); test_volume_blocks(); + test_lockbox_invalid(); } UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }
1
0
0
0
Stefan Dösinger : d3d8/tests: Add tests for block-based volume formats.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 9efed3d379c2a954ae36c5b6a771f2b56158c1f6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9efed3d379c2a954ae36c5b6a…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Sep 19 11:02:56 2013 +0200 d3d8/tests: Add tests for block-based volume formats. --- dlls/d3d8/tests/device.c | 361 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 361 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=9efed3d379c2a954ae36c…
1
0
0
0
Stefan Dösinger : wined3d: Pass a correct access flag to glMapBufferARB.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: d15042837a8a8c44d81d6bdc2449606a63aabfa1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d15042837a8a8c44d81d6bdc2…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Sep 19 11:02:55 2013 +0200 wined3d: Pass a correct access flag to glMapBufferARB. --- dlls/wined3d/resource.c | 9 +++++++++ dlls/wined3d/volume.c | 3 ++- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index a24db3c..6a0a29b 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -419,3 +419,12 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) return ret; } + +GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) +{ + if (d3d_flags & WINED3D_MAP_READONLY) + return GL_READ_ONLY_ARB; + if (d3d_flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)) + return GL_WRITE_ONLY_ARB; + return GL_READ_WRITE_ARB; +} diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 9251a55..ea481a1 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -642,7 +642,8 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, } else { - base_memory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); + GLenum access = wined3d_resource_gl_legacy_map_flags(flags); + base_memory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, access)); } GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f85bfec..a590b31 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2025,6 +2025,7 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; +GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16
1
0
0
0
Stefan Dösinger : wined3d: Don't use volume->resource. allocatedMemory.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: e9b4f154ddb61c7bf135348cf8a996814bea2420 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e9b4f154ddb61c7bf135348cf…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Sep 19 11:02:54 2013 +0200 wined3d: Don't use volume->resource.allocatedMemory. Depending on the location flags, the buffer or heap_memory should be used. --- dlls/wined3d/volume.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 2fa04c5..9251a55 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -168,7 +168,6 @@ static void wined3d_volume_download_data(struct wined3d_volume *volume, static void wined3d_volume_evict_sysmem(struct wined3d_volume *volume) { wined3d_resource_free_sysmem(&volume->resource); - volume->resource.allocatedMemory = NULL; wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_SYSMEM); } @@ -202,7 +201,7 @@ static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume, * implementing EXT_SRGB_DECODE in the driver or finding out why we * picked the wrong copy for the original upload and fixing that. * - * Also keep in mind that we want to avoid using resource.allocatedMemory + * Also keep in mind that we want to avoid using resource.heap_memory * for DEFAULT pool surfaces. */ WARN_(d3d_perf)("Performing slow rgb/srgb volume transfer.\n"); @@ -258,7 +257,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume, } else if (volume->locations & WINED3D_LOCATION_SYSMEM) { - struct wined3d_bo_address data = {0, volume->resource.allocatedMemory}; + struct wined3d_bo_address data = {0, volume->resource.heap_memory}; wined3d_volume_upload_data(volume, context, &data); } else if (volume->locations & WINED3D_LOCATION_BUFFER) @@ -287,11 +286,8 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume, break; case WINED3D_LOCATION_SYSMEM: - if (!volume->resource.allocatedMemory || !volume->resource.heap_memory) - { + if (!volume->resource.heap_memory) ERR("Trying to load WINED3D_LOCATION_SYSMEM without setting it up first.\n"); - return; - } if (volume->locations & WINED3D_LOCATION_DISCARDED) { @@ -300,7 +296,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume, } else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { - struct wined3d_bo_address data = {0, volume->resource.allocatedMemory}; + struct wined3d_bo_address data = {0, volume->resource.heap_memory}; if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB) volume_bind_and_dirtify(volume, context, FALSE); @@ -412,7 +408,7 @@ static void wined3d_volume_free_pbo(struct wined3d_volume *volume) static BOOL volume_prepare_system_memory(struct wined3d_volume *volume) { - if (volume->resource.allocatedMemory) + if (volume->resource.heap_memory) return TRUE; if (!wined3d_resource_allocate_sysmem(&volume->resource)) @@ -420,7 +416,6 @@ static BOOL volume_prepare_system_memory(struct wined3d_volume *volume) ERR("Failed to allocate system memory.\n"); return FALSE; } - volume->resource.allocatedMemory = volume->resource.heap_memory; return TRUE; } @@ -674,7 +669,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, wined3d_volume_load_location(volume, context, WINED3D_LOCATION_SYSMEM); context_release(context); } - base_memory = volume->resource.allocatedMemory; + base_memory = volume->resource.heap_memory; } TRACE("Base memory pointer %p.\n", base_memory); @@ -815,7 +810,6 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device && gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) { wined3d_resource_free_sysmem(&volume->resource); - volume->resource.allocatedMemory = NULL; volume->flags |= WINED3D_VFLAG_PBO; }
1
0
0
0
Stefan Dösinger : d3d9/tests: Read the caps from the device.
by Alexandre Julliard
19 Sep '13
19 Sep '13
Module: wine Branch: master Commit: 708024f78649b087b8c97cae38bdf9a42f60129b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=708024f78649b087b8c97cae3…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Sep 19 11:02:53 2013 +0200 d3d9/tests: Read the caps from the device. --- dlls/d3d9/tests/device.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index f71f8be..02b4174 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -7018,9 +7018,6 @@ static void test_volume_blocks(void) skip("Failed to create IDirect3D9 object, skipping tests.\n"); return; } - hr = IDirect3D9_GetDeviceCaps(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps); - ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); - pow2 = !!(caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP_POW2); window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); @@ -7031,6 +7028,9 @@ static void test_volume_blocks(void) DestroyWindow(window); return; } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + pow2 = !!(caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP_POW2); for (i = 0; i < sizeof(formats) / sizeof(*formats); i++) {
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
65
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Results per page:
10
25
50
100
200