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
March 2009
----- 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
834 discussions
Start a n
N
ew thread
Detlef Riekenberg : shdocvw/tests: Add IServiceProvider to the webbrowser test.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 41c0d35a7a9ef485cfd731104fe7b56926f828a0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41c0d35a7a9ef485cfd731104…
Author: Detlef Riekenberg <wine.dev(a)web.de> Date: Sun Mar 1 23:09:02 2009 +0100 shdocvw/tests: Add IServiceProvider to the webbrowser test. --- dlls/shdocvw/tests/webbrowser.c | 69 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+), 0 deletions(-) diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c index c6c204a..5aae312 100644 --- a/dlls/shdocvw/tests/webbrowser.c +++ b/dlls/shdocvw/tests/webbrowser.c @@ -31,12 +31,14 @@ #include "htiframe.h" #include "mshtmhst.h" #include "mshtmcid.h" +#include "mshtml.h" #include "idispids.h" #include "olectl.h" #include "mshtmdid.h" #include "shobjidl.h" #include "shlguid.h" #include "exdispid.h" +#include "mimeinfo.h" DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); @@ -1270,6 +1272,71 @@ static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = { static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl }; + +static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + return QueryInterface(riid, ppv); +} + +static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface) +{ + return 2; +} + +static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface) +{ + return 1; +} + +static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, + REFGUID guidService, REFIID riid, void **ppv) +{ + *ppv = NULL; + + if (IsEqualGUID(&SID_STopLevelBrowser, guidService)) + trace("Service SID_STopLevelBrowser\n"); + else if (IsEqualGUID(&SID_SEditCommandTarget, guidService)) + trace("Service SID_SEditCommandTarget\n"); + else if (IsEqualGUID(&IID_ITargetFrame2, guidService)) + trace("Service IID_ITargetFrame2\n"); + else if (IsEqualGUID(&SID_SInternetSecurityManager, guidService)) + trace("Service SID_SInternetSecurityManager\n"); + else if (IsEqualGUID(&SID_SOleUndoManager, guidService)) + trace("Service SID_SOleUndoManager\n"); + else if (IsEqualGUID(&SID_IMimeInfo, guidService)) + trace("Service SID_IMimeInfo\n"); + else if (IsEqualGUID(&SID_STopWindow, guidService)) + trace("Service SID_STopWindow\n"); + + /* 30D02401-6A81-11D0-8274-00C04FD5AE38 Explorer Bar: Search */ + /* D1E7AFEC-6A2E-11D0-8C78-00C04FD918B4 no info */ + /* A9227C3C-7F8E-11D0-8CB0-00A0C92DBFE8 no info */ + /* 371EA634-DC5C-11D1-BA57-00C04FC2040E one reference to IVersionHost */ + /* 3050F429-98B5-11CF-BB82-00AA00BDCE0B IID_IElementBehaviorFactory */ + /* 6D12FE80-7911-11CF-9534-0000C05BAE0B SID_DefView */ + /* AD7F6C62-F6BD-11D2-959B-006097C553C8 no info */ + /* 53A2D5B1-D2FC-11D0-84E0-006097C9987D no info */ + /* 3050F312-98B5-11CF-BB82-00AA00BDCE0B HTMLFrameBaseClass */ + /* 639447BD-B2D3-44B9-9FB0-510F23CB45E4 no info */ + /* 20C46561-8491-11CF-960C-0080C7F4EE85 no info */ + + else + trace("Service %s not supported\n", debugstr_guid(guidService)); + + return E_NOINTERFACE; +} + + +static const IServiceProviderVtbl ServiceProviderVtbl = { + ServiceProvider_QueryInterface, + ServiceProvider_AddRef, + ServiceProvider_Release, + ServiceProvider_QueryService +}; + +static IServiceProvider ServiceProvider = { &ServiceProviderVtbl }; + + static HRESULT QueryInterface(REFIID riid, void **ppv) { *ppv = NULL; @@ -1286,6 +1353,8 @@ static HRESULT QueryInterface(REFIID riid, void **ppv) *ppv = &DocHostUIHandler; else if(IsEqualGUID(&IID_IDispatch, riid)) *ppv = &Dispatch; + else if(IsEqualGUID(&IID_IServiceProvider, riid)) + *ppv = &ServiceProvider; if(*ppv) return S_OK;
1
0
0
0
Stefan Leichter : ntoskrnl.exe: Stub for MmQuerySystemSize.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 56031d2ba47d3ddb58b2e35bfdcbc41448cae13d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=56031d2ba47d3ddb58b2e35bf…
Author: Stefan Leichter <Stefan.Leichter(a)camline.com> Date: Sun Mar 1 09:48:51 2009 +0100 ntoskrnl.exe: Stub for MmQuerySystemSize. --- dlls/ntoskrnl.exe/ntoskrnl.c | 11 +++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/wdm.h | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 0dc9aaf..6371d85 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1161,6 +1161,17 @@ PVOID WINAPI MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName) return pFunc; } + +/*********************************************************************** + * MmQuerySystemSize (NTOSKRNL.EXE.@) + */ +MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void) +{ + FIXME("stub\n"); + return MmLargeSystem; +} + + /***************************************************** * DllMain */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 7b95852..849dd51 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -706,7 +706,7 @@ @ stub MmProbeAndLockProcessPages @ stub MmProbeAndLockSelectedPages @ stub MmProtectMdlSystemAddress -@ stub MmQuerySystemSize +@ stdcall MmQuerySystemSize() @ stub MmRemovePhysicalMemory @ stdcall MmResetDriverPaging(ptr) @ stub MmSectionObjectType diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 0f241b6..3169153 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1001,6 +1001,13 @@ typedef struct _KUSER_SHARED_DATA { } DUMMYUNIONNAME; } KSHARED_USER_DATA, *PKSHARED_USER_DATA; +typedef enum _MM_SYSTEM_SIZE +{ + MmSmallSystem, + MmMediumSystem, + MmLargeSystem +} MM_SYSTEMSIZE; + NTSTATUS WINAPI ObCloseHandle(IN HANDLE handle); #define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation) @@ -1048,6 +1055,7 @@ ULONG WINAPI KeQueryTimeIncrement(void); PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T); void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T); +MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void); NTSTATUS WINAPI ObReferenceObjectByHandle(HANDLE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,PVOID*,POBJECT_HANDLE_INFORMATION);
1
0
0
0
Alexandre Julliard : iphlpapi: Remove the no longer needed getNumRoutes and GetNumWithOneHeader functions .
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 6aade4122a597f8f043212079c2e2d1813693953 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6aade4122a597f8f043212079…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:55:00 2009 +0100 iphlpapi: Remove the no longer needed getNumRoutes and GetNumWithOneHeader functions. --- dlls/iphlpapi/ipstats.c | 179 ++--------------------------------------------- dlls/iphlpapi/ipstats.h | 3 - 2 files changed, 6 insertions(+), 176 deletions(-) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index c7c08fd..f630906 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -535,13 +535,18 @@ DWORD getIPStats(PMIB_IPSTATS stats) return NO_ERROR; #else FILE *fp; + MIB_IPFORWARDTABLE *fwd_table; if (!stats) return ERROR_INVALID_PARAMETER; memset(stats, 0, sizeof(MIB_IPSTATS)); stats->dwNumIf = stats->dwNumAddr = getNumInterfaces(); - stats->dwNumRoutes = getNumRoutes(); + if (!AllocateAndGetIpForwardTableFromStack( &fwd_table, FALSE, GetProcessHeap(), 0 )) + { + stats->dwNumRoutes = fwd_table->dwNumEntries; + HeapFree( GetProcessHeap(), 0, fwd_table ); + } /* get most of these stats from /proc/net/snmp, no error if can't */ fp = fopen("/proc/net/snmp", "r"); @@ -882,178 +887,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats) #endif } -static DWORD getNumWithOneHeader(const char *filename) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_STRUCT_XINPGEN) - size_t Len = 0; - char *Buf; - struct xinpgen *pXIG, *pOrigXIG; - int Protocol; - DWORD NumEntries = 0; - - if (!strcmp (filename, "net.inet.tcp.pcblist")) - Protocol = IPPROTO_TCP; - else if (!strcmp (filename, "net.inet.udp.pcblist")) - Protocol = IPPROTO_UDP; - else - { - ERR ("Unsupported mib '%s', needs protocol mapping\n", - filename); - return 0; - } - - if (sysctlbyname (filename, NULL, &Len, NULL, 0) < 0) - { - WARN ("Unable to read '%s' via sysctlbyname\n", filename); - return 0; - } - - Buf = HeapAlloc (GetProcessHeap (), 0, Len); - if (!Buf) - { - ERR ("Out of memory!\n"); - return 0; - } - - if (sysctlbyname (filename, Buf, &Len, NULL, 0) < 0) - { - ERR ("Failure to read '%s' via sysctlbyname!\n", filename); - HeapFree (GetProcessHeap (), 0, Buf); - return 0; - } - - /* Might be nothing here; first entry is just a header it seems */ - if (Len <= sizeof (struct xinpgen)) - { - HeapFree (GetProcessHeap (), 0, Buf); - return 0; - } - - pOrigXIG = (struct xinpgen *)Buf; - pXIG = pOrigXIG; - - for (pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len); - pXIG->xig_len > sizeof (struct xinpgen); - pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len)) - { - struct tcpcb *pTCPData = NULL; - struct inpcb *pINData; - struct xsocket *pSockData; - - if (Protocol == IPPROTO_TCP) - { - pTCPData = &((struct xtcpcb *)pXIG)->xt_tp; - pINData = &((struct xtcpcb *)pXIG)->xt_inp; - pSockData = &((struct xtcpcb *)pXIG)->xt_socket; - } - else - { - pINData = &((struct xinpcb *)pXIG)->xi_inp; - pSockData = &((struct xinpcb *)pXIG)->xi_socket; - } - - /* Ignore sockets for other protocols */ - if (pSockData->xso_protocol != Protocol) - continue; - - /* Ignore PCBs that were freed while generating the data */ - if (pINData->inp_gencnt > pOrigXIG->xig_gen) - continue; - - /* we're only interested in IPv4 addresses */ - if (!(pINData->inp_vflag & INP_IPV4) || - (pINData->inp_vflag & INP_IPV6)) - continue; - - /* If all 0's, skip it */ - if (!pINData->inp_laddr.s_addr && - !pINData->inp_lport && - !pINData->inp_faddr.s_addr && - !pINData->inp_fport) - continue; - - NumEntries++; - } - - HeapFree (GetProcessHeap (), 0, Buf); - return NumEntries; -#else - FILE *fp; - int ret = 0; - - fp = fopen(filename, "r"); - if (fp) { - char buf[512] = { 0 }, *ptr; - - - ptr = fgets(buf, sizeof(buf), fp); - if (ptr) { - do { - ptr = fgets(buf, sizeof(buf), fp); - if (ptr) - ret++; - } while (ptr); - } - fclose(fp); - } - else - ERR ("Unable to open '%s' to count entries!\n", filename); - - return ret; -#endif -} - -DWORD getNumRoutes(void) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[6] = {CTL_NET, PF_ROUTE, 0, PF_INET, NET_RT_DUMP, 0}; - size_t needed; - char *buf, *lim, *next; - struct rt_msghdr *rtm; - DWORD RouteCount = 0; - - if (sysctl (mib, 6, NULL, &needed, NULL, 0) < 0) - { - ERR ("sysctl 1 failed!\n"); - return 0; - } - - buf = HeapAlloc (GetProcessHeap (), 0, needed); - if (!buf) return 0; - - if (sysctl (mib, 6, buf, &needed, NULL, 0) < 0) - { - ERR ("sysctl 2 failed!\n"); - HeapFree (GetProcessHeap (), 0, buf); - return 0; - } - - lim = buf + needed; - for (next = buf; next < lim; next += rtm->rtm_msglen) - { - rtm = (struct rt_msghdr *)next; - - if (rtm->rtm_type != RTM_GET) - { - WARN ("Got unexpected message type 0x%x!\n", - rtm->rtm_type); - continue; - } - - /* Ignore all entries except for gateway routes which aren't - multicast */ - if (!(rtm->rtm_flags & RTF_GATEWAY) || (rtm->rtm_flags & RTF_MULTICAST)) - continue; - - RouteCount++; - } - - HeapFree (GetProcessHeap (), 0, buf); - return RouteCount; -#else - return getNumWithOneHeader("/proc/net/route"); -#endif -} static MIB_IPFORWARDTABLE *append_ipforward_row( HANDLE heap, DWORD flags, MIB_IPFORWARDTABLE *table, DWORD *count, const MIB_IPFORWARDROW *row ) diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 871fcec..aad931c 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -52,9 +52,6 @@ DWORD getTCPStats(MIB_TCPSTATS *stats); */ DWORD getUDPStats(MIB_UDPSTATS *stats); -/* Returns the number of entries in the route table. */ -DWORD getNumRoutes(void); - DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags);
1
0
0
0
Alexandre Julliard : iphlpapi: Remove the no longer needed getNumTcpEntries function.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 18a5a77bacd76d5720b783af93fe6704d215dc78 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=18a5a77bacd76d5720b783af9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:54:35 2009 +0100 iphlpapi: Remove the no longer needed getNumTcpEntries function. --- dlls/iphlpapi/ipstats.c | 16 ++++++---------- dlls/iphlpapi/ipstats.h | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 103ef45..c7c08fd 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -693,6 +693,7 @@ DWORD getTCPStats(MIB_TCPSTATS *stats) #else FILE *fp; + MIB_TCPTABLE *tcp_table; if (!stats) return ERROR_INVALID_PARAMETER; @@ -772,7 +773,11 @@ DWORD getTCPStats(MIB_TCPSTATS *stats) stats->dwOutRsts = strtoul(ptr, &endPtr, 10); ptr = endPtr; } - stats->dwNumConns = getNumTcpEntries(); + if (!AllocateAndGetTcpTableFromStack( &tcp_table, FALSE, GetProcessHeap(), 0 )) + { + stats->dwNumConns = tcp_table->dwNumEntries; + HeapFree( GetProcessHeap(), 0, tcp_table ); + } } } fclose(fp); @@ -1565,15 +1570,6 @@ DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOr } -DWORD getNumTcpEntries(void) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_NETINET_IN_PCB_H) - return getNumWithOneHeader ("net.inet.tcp.pcblist"); -#else - return getNumWithOneHeader ("/proc/net/tcp"); -#endif -} - static MIB_TCPTABLE *append_tcp_row( HANDLE heap, DWORD flags, MIB_TCPTABLE *table, DWORD *count, const MIB_TCPROW *row ) { diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 2c82981..871fcec 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -55,9 +55,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats); /* Returns the number of entries in the route table. */ DWORD getNumRoutes(void); -/* Returns the number of entries in the TCP state table. */ -DWORD getNumTcpEntries(void); - DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags);
1
0
0
0
Alexandre Julliard : iphlpapi: Remove the no longer needed getNumUdpEntries function.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 3573c6497076e35d7a5111e4136156ae26a1ae89 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3573c6497076e35d7a5111e41…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:54:16 2009 +0100 iphlpapi: Remove the no longer needed getNumUdpEntries function. --- dlls/iphlpapi/ipstats.c | 16 +++++++--------- dlls/iphlpapi/ipstats.h | 3 --- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 5ce373f..103ef45 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -793,6 +793,7 @@ DWORD getUDPStats(MIB_UDPSTATS *stats) int mib[] = {CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS}; #define MIB_LEN (sizeof(mib) / sizeof(mib[0])) struct udpstat udp_stat; + MIB_UDPTABLE *udp_table; size_t needed; if (!stats) return ERROR_INVALID_PARAMETER; @@ -809,7 +810,12 @@ DWORD getUDPStats(MIB_UDPSTATS *stats) stats->dwOutDatagrams = udp_stat.udps_opackets; stats->dwNoPorts = udp_stat.udps_noport; stats->dwInErrors = udp_stat.udps_hdrops + udp_stat.udps_badsum + udp_stat.udps_fullsock + udp_stat.udps_badlen; - stats->dwNumAddrs = getNumUdpEntries(); + if (!AllocateAndGetUdpTableFromStack( &udp_table, FALSE, GetProcessHeap(), 0 )) + { + stats->dwNumAddrs = udp_table->dwNumEntries; + HeapFree( GetProcessHeap(), 0, udp_table ); + } + else stats->dwNumAddrs = 0; return NO_ERROR; #else @@ -1453,14 +1459,6 @@ done: return ret; } -DWORD getNumUdpEntries(void) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_NETINET_IN_PCB_H) - return getNumWithOneHeader ("net.inet.udp.pcblist"); -#else - return getNumWithOneHeader("/proc/net/udp"); -#endif -} static MIB_UDPTABLE *append_udp_row( HANDLE heap, DWORD flags, MIB_UDPTABLE *table, DWORD *count, const MIB_UDPROW *row ) diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 88c4839..2c82981 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -55,9 +55,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats); /* Returns the number of entries in the route table. */ DWORD getNumRoutes(void); -/* Returns the number of entries in the UDP state table. */ -DWORD getNumUdpEntries(void); - /* Returns the number of entries in the TCP state table. */ DWORD getNumTcpEntries(void);
1
0
0
0
Alexandre Julliard : iphlpapi: Remove the no longer needed getNumArpEntries function.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 7a5c5099bcb8a1079bcd31f3d93609a86327e487 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a5c5099bcb8a1079bcd31f3d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:53:41 2009 +0100 iphlpapi: Remove the no longer needed getNumArpEntries function. --- dlls/iphlpapi/ipstats.c | 45 --------------------------------------------- dlls/iphlpapi/ipstats.h | 3 --- 2 files changed, 0 insertions(+), 48 deletions(-) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index d01bf22..5ce373f 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1268,51 +1268,6 @@ done: return ret; } -DWORD getNumArpEntries(void) -{ -#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - int mib[] = {CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_FLAGS, RTF_LLINFO}; -#define MIB_LEN (sizeof(mib) / sizeof(mib[0])) - DWORD arpEntries = 0; - size_t needed; - char *buf, *lim, *next; - struct rt_msghdr *rtm; - struct sockaddr_inarp *sinarp; - struct sockaddr_dl *sdl; - - if (sysctl (mib, MIB_LEN, NULL, &needed, NULL, 0) == -1) - { - ERR ("failed to get size of arp table\n"); - return 0; - } - - buf = HeapAlloc (GetProcessHeap (), 0, needed); - if (!buf) return 0; - - if (sysctl (mib, MIB_LEN, buf, &needed, NULL, 0) == -1) - { - ERR ("failed to get arp table\n"); - HeapFree (GetProcessHeap (), 0, buf); - return 0; - } - - lim = buf + needed; - next = buf; - while(next < lim) - { - rtm = (struct rt_msghdr *)next; - sinarp=(struct sockaddr_inarp *)(rtm + 1); - sdl = (struct sockaddr_dl *)((char *)sinarp + ROUNDUP(sinarp->sin_len)); - if(sdl->sdl_alen) /* arp entry */ - arpEntries++; - next += rtm->rtm_msglen; - } - HeapFree (GetProcessHeap (), 0, buf); - return arpEntries; -#endif - return getNumWithOneHeader("/proc/net/arp"); -} - static MIB_IPNETTABLE *append_ipnet_row( HANDLE heap, DWORD flags, MIB_IPNETTABLE *table, DWORD *count, const MIB_IPNETROW *row ) { diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 3e05d56..88c4839 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -55,9 +55,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats); /* Returns the number of entries in the route table. */ DWORD getNumRoutes(void); -/* Returns the number of entries in the arp table. */ -DWORD getNumArpEntries(void); - /* Returns the number of entries in the UDP state table. */ DWORD getNumUdpEntries(void);
1
0
0
0
Alexandre Julliard : iphlpapi: Moved AllocateAndGetIpForwardTableFromStack implementation to ipstats.c.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 44f30a645e65db6385bc9b33d26de2c3264d8e84 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=44f30a645e65db6385bc9b33d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:52:45 2009 +0100 iphlpapi: Moved AllocateAndGetIpForwardTableFromStack implementation to ipstats.c. --- dlls/iphlpapi/iphlpapi_main.c | 64 +--------------------------------------- dlls/iphlpapi/ipstats.c | 42 +++++++++++++++++++++++++- dlls/iphlpapi/ipstats.h | 7 +---- 3 files changed, 43 insertions(+), 70 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index f0ca8ad..3481f86 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -189,63 +189,6 @@ DWORD WINAPI AllocateAndGetIpAddrTableFromStack(PMIB_IPADDRTABLE *ppIpAddrTable, } -static int IpForwardTableSorter(const void *a, const void *b) -{ - int ret; - - if (a && b) { - const MIB_IPFORWARDROW* rowA = (const MIB_IPFORWARDROW*)a; - const MIB_IPFORWARDROW* rowB = (const MIB_IPFORWARDROW*)b; - - ret = rowA->dwForwardDest - rowB->dwForwardDest; - if (ret == 0) { - ret = rowA->dwForwardProto - rowB->dwForwardProto; - if (ret == 0) { - ret = rowA->dwForwardPolicy - rowB->dwForwardPolicy; - if (ret == 0) - ret = rowA->dwForwardNextHop - rowB->dwForwardNextHop; - } - } - } - else - ret = 0; - return ret; -} - - -/****************************************************************** - * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@) - * - * Get the route table. - * Like GetIpForwardTable(), but allocate the returned table from heap. - * - * PARAMS - * ppIpForwardTable [Out] pointer into which the MIB_IPFORWARDTABLE is - * allocated and returned. - * bOrder [In] whether to sort the table - * heap [In] heap from which the table is allocated - * flags [In] flags to HeapAlloc - * - * RETURNS - * ERROR_INVALID_PARAMETER if ppIfTable is NULL, other error codes - * on failure, NO_ERROR on success. - */ -DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE * - ppIpForwardTable, BOOL bOrder, HANDLE heap, DWORD flags) -{ - DWORD ret; - - TRACE("ppIpForwardTable %p, bOrder %d, heap %p, flags 0x%08x\n", - ppIpForwardTable, bOrder, heap, flags); - ret = getRouteTable(ppIpForwardTable, heap, flags); - if (!ret && bOrder) - qsort((*ppIpForwardTable)->table, (*ppIpForwardTable)->dwNumEntries, - sizeof(MIB_IPFORWARDROW), IpForwardTableSorter); - TRACE("returning %d\n", ret); - return ret; -} - - /****************************************************************** * CreateIpForwardEntry (IPHLPAPI.@) * @@ -535,7 +478,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen) ret = getIPAddrTable(&ipAddrTable, GetProcessHeap(), 0); if (!ret) - ret = getRouteTable(&routeTable, GetProcessHeap(), 0); + ret = AllocateAndGetIpForwardTableFromStack(&routeTable, FALSE, GetProcessHeap(), 0); if (!ret) table = getNonLoopbackInterfaceIndexTable(); if (table) { @@ -1101,7 +1044,7 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi if (!pdwSize) return ERROR_INVALID_PARAMETER; - ret = getRouteTable(&table, GetProcessHeap(), 0); + ret = AllocateAndGetIpForwardTableFromStack(&table, bOrder, GetProcessHeap(), 0); if (!ret) { DWORD size = FIELD_OFFSET( MIB_IPFORWARDTABLE, table[table->dwNumEntries] ); if (!pIpForwardTable || *pdwSize < size) { @@ -1111,9 +1054,6 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi else { *pdwSize = size; memcpy(pIpForwardTable, table, size); - if (bOrder) - qsort(pIpForwardTable->table, pIpForwardTable->dwNumEntries, - sizeof(MIB_IPFORWARDROW), IpForwardTableSorter); } HeapFree(GetProcessHeap(), 0, table); } diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 58ec76f..d01bf22 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1065,12 +1065,44 @@ static MIB_IPFORWARDTABLE *append_ipforward_row( HANDLE heap, DWORD flags, MIB_I return table; } -DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap, DWORD flags) +static int compare_ipforward_rows(const void *a, const void *b) +{ + const MIB_IPFORWARDROW *rowA = a; + const MIB_IPFORWARDROW *rowB = b; + int ret; + + if ((ret = rowA->dwForwardDest - rowB->dwForwardDest) != 0) return ret; + if ((ret = rowA->dwForwardProto - rowB->dwForwardProto) != 0) return ret; + if ((ret = rowA->dwForwardPolicy - rowB->dwForwardPolicy) != 0) return ret; + return rowA->dwForwardNextHop - rowB->dwForwardNextHop; +} + +/****************************************************************** + * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@) + * + * Get the route table. + * Like GetIpForwardTable(), but allocate the returned table from heap. + * + * PARAMS + * ppIpForwardTable [Out] pointer into which the MIB_IPFORWARDTABLE is + * allocated and returned. + * bOrder [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppIfTable is NULL, other error codes + * on failure, NO_ERROR on success. + */ +DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForwardTable, BOOL bOrder, + HANDLE heap, DWORD flags) { MIB_IPFORWARDTABLE *table; MIB_IPFORWARDROW row; DWORD ret = NO_ERROR, count = 16; + TRACE("table %p, bOrder %d, heap %p, flags 0x%08x\n", ppIpForwardTable, bOrder, heap, flags); + if (!ppIpForwardTable) return ERROR_INVALID_PARAMETER; if (!(table = HeapAlloc( heap, flags, FIELD_OFFSET(MIB_IPFORWARDTABLE, table[count] )))) @@ -1225,8 +1257,14 @@ done: #endif if (!table) return ERROR_OUTOFMEMORY; - if (!ret) *ppIpForwardTable = table; + if (!ret) + { + if (bOrder && table->dwNumEntries) + qsort( table->table, table->dwNumEntries, sizeof(row), compare_ipforward_rows ); + *ppIpForwardTable = table; + } else HeapFree( heap, flags, table ); + TRACE( "returning ret %u table %p\n", ret, table ); return ret; } diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 30b78b2..3e05d56 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -55,12 +55,6 @@ DWORD getUDPStats(MIB_UDPSTATS *stats); /* Returns the number of entries in the route table. */ DWORD getNumRoutes(void); -/* Allocates the route table from heap and returns it to you in - * *ppIpForwardTable. Returns NO_ERROR on success, something else on failure. - */ -DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap, - DWORD flags); - /* Returns the number of entries in the arp table. */ DWORD getNumArpEntries(void); @@ -73,5 +67,6 @@ DWORD getNumTcpEntries(void); DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags); +DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForwardTable, BOOL bOrder, HANDLE heap, DWORD flags); #endif /* ndef WINE_IPSTATS_H_ */
1
0
0
0
Alexandre Julliard : iphlpapi: Moved AllocateAndGetIpNetTableFromStack implementation to ipstats.c.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: b406213c42793cc166b90ab2f7d4fc70445b0103 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b406213c42793cc166b90ab2f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:51:48 2009 +0100 iphlpapi: Moved AllocateAndGetIpNetTableFromStack implementation to ipstats.c. --- dlls/iphlpapi/iphlpapi_main.c | 50 +---------------------------------------- dlls/iphlpapi/ipstats.c | 39 ++++++++++++++++++++++++++++++- dlls/iphlpapi/ipstats.h | 6 +---- 3 files changed, 39 insertions(+), 56 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 1d2735f..f0ca8ad 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -246,51 +246,6 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE * } -static int IpNetTableSorter(const void *a, const void *b) -{ - int ret; - - if (a && b) - ret = ((const MIB_IPNETROW*)a)->dwAddr - ((const MIB_IPNETROW*)b)->dwAddr; - else - ret = 0; - return ret; -} - - -/****************************************************************** - * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@) - * - * Get the IP-to-physical address mapping table. - * Like GetIpNetTable(), but allocate the returned table from heap. - * - * PARAMS - * ppIpNetTable [Out] pointer into which the MIB_IPNETTABLE is - * allocated and returned. - * bOrder [In] whether to sort the table - * heap [In] heap from which the table is allocated - * flags [In] flags to HeapAlloc - * - * RETURNS - * ERROR_INVALID_PARAMETER if ppIpNetTable is NULL, other error codes - * on failure, NO_ERROR on success. - */ -DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, - BOOL bOrder, HANDLE heap, DWORD flags) -{ - DWORD ret; - - TRACE("ppIpNetTable %p, bOrder %d, heap %p, flags 0x%08x\n", - ppIpNetTable, bOrder, heap, flags); - ret = getArpTable(ppIpNetTable, heap, flags); - if (!ret && bOrder) - qsort((*ppIpNetTable)->table, (*ppIpNetTable)->dwNumEntries, - sizeof(MIB_IPADDRROW), IpNetTableSorter); - TRACE("returning %d\n", ret); - return ret; -} - - /****************************************************************** * CreateIpForwardEntry (IPHLPAPI.@) * @@ -1196,7 +1151,7 @@ DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOr if (!pdwSize) return ERROR_INVALID_PARAMETER; - ret = getArpTable(&table, GetProcessHeap(), 0); + ret = AllocateAndGetIpNetTableFromStack( &table, bOrder, GetProcessHeap(), 0 ); if (!ret) { DWORD size = FIELD_OFFSET( MIB_IPNETTABLE, table[table->dwNumEntries] ); if (!pIpNetTable || *pdwSize < size) { @@ -1206,9 +1161,6 @@ DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOr else { *pdwSize = size; memcpy(pIpNetTable, table, size); - if (bOrder) - qsort(pIpNetTable->table, pIpNetTable->dwNumEntries, - sizeof(MIB_IPNETROW), IpNetTableSorter); } HeapFree(GetProcessHeap(), 0, table); } diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 1a3086f..58ec76f 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1296,12 +1296,41 @@ static MIB_IPNETTABLE *append_ipnet_row( HANDLE heap, DWORD flags, MIB_IPNETTABL return table; } -DWORD getArpTable(PMIB_IPNETTABLE *ppIpNetTable, HANDLE heap, DWORD flags) +static int compare_ipnet_rows(const void *a, const void *b) +{ + const MIB_IPNETROW *rowA = a; + const MIB_IPNETROW *rowB = b; + + return ntohl(rowA->dwAddr) - ntohl(rowB->dwAddr); +} + + +/****************************************************************** + * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@) + * + * Get the IP-to-physical address mapping table. + * Like GetIpNetTable(), but allocate the returned table from heap. + * + * PARAMS + * ppIpNetTable [Out] pointer into which the MIB_IPNETTABLE is + * allocated and returned. + * bOrder [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppIpNetTable is NULL, other error codes + * on failure, NO_ERROR on success. + */ +DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, + HANDLE heap, DWORD flags) { MIB_IPNETTABLE *table; MIB_IPNETROW row; DWORD ret = NO_ERROR, count = 16; + TRACE("table %p, bOrder %d, heap %p, flags 0x%08x\n", ppIpNetTable, bOrder, heap, flags); + if (!ppIpNetTable) return ERROR_INVALID_PARAMETER; if (!(table = HeapAlloc( heap, flags, FIELD_OFFSET(MIB_IPNETTABLE, table[count] )))) @@ -1420,8 +1449,14 @@ done: #endif if (!table) return ERROR_OUTOFMEMORY; - if (!ret) *ppIpNetTable = table; + if (!ret) + { + if (bOrder && table->dwNumEntries) + qsort( table->table, table->dwNumEntries, sizeof(row), compare_ipnet_rows ); + *ppIpNetTable = table; + } else HeapFree( heap, flags, table ); + TRACE( "returning ret %u table %p\n", ret, table ); return ret; } diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index bc2fe7b..30b78b2 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -64,11 +64,6 @@ DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap, /* Returns the number of entries in the arp table. */ DWORD getNumArpEntries(void); -/* Allocates the arp table from heap and returns it to you in *ppIpNetTable. - * Returns NO_ERROR on success, something else on failure. - */ -DWORD getArpTable(PMIB_IPNETTABLE *ppIpNetTable, HANDLE heap, DWORD flags); - /* Returns the number of entries in the UDP state table. */ DWORD getNumUdpEntries(void); @@ -77,5 +72,6 @@ DWORD getNumTcpEntries(void); DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); +DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags); #endif /* ndef WINE_IPSTATS_H_ */
1
0
0
0
Alexandre Julliard : iphlpapi: Moved AllocateAndGetTcpTableFromStack implementation to ipstats.c.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: bc08fb99d3a6ef662556e6eda5788016d7045ad4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc08fb99d3a6ef662556e6eda…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:51:02 2009 +0100 iphlpapi: Moved AllocateAndGetTcpTableFromStack implementation to ipstats.c. --- dlls/iphlpapi/iphlpapi_main.c | 66 +---------------------------------------- dlls/iphlpapi/ipstats.c | 44 ++++++++++++++++++++++++++- dlls/iphlpapi/ipstats.h | 6 +--- 3 files changed, 44 insertions(+), 72 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 735091b..1d2735f 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -291,67 +291,6 @@ DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, } -static int TcpTableSorter(const void *a, const void *b) -{ - int ret; - - if (a && b) { - const MIB_TCPROW* rowA = a; - const MIB_TCPROW* rowB = b; - - ret = ntohl (rowA->dwLocalAddr) - ntohl (rowB->dwLocalAddr); - if (ret == 0) { - ret = ntohs ((unsigned short)rowA->dwLocalPort) - - ntohs ((unsigned short)rowB->dwLocalPort); - if (ret == 0) { - ret = ntohl (rowA->dwRemoteAddr) - ntohl (rowB->dwRemoteAddr); - if (ret == 0) - ret = ntohs ((unsigned short)rowA->dwRemotePort) - - ntohs ((unsigned short)rowB->dwRemotePort); - } - } - } - else - ret = 0; - return ret; -} - - -/****************************************************************** - * AllocateAndGetTcpTableFromStack (IPHLPAPI.@) - * - * Get the TCP connection table. - * Like GetTcpTable(), but allocate the returned table from heap. - * - * PARAMS - * ppTcpTable [Out] pointer into which the MIB_TCPTABLE is - * allocated and returned. - * bOrder [In] whether to sort the table - * heap [In] heap from which the table is allocated - * flags [In] flags to HeapAlloc - * - * RETURNS - * ERROR_INVALID_PARAMETER if ppTcpTable is NULL, whatever GetTcpTable() - * returns otherwise. - */ -DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, - BOOL bOrder, HANDLE heap, DWORD flags) -{ - DWORD ret; - - TRACE("ppTcpTable %p, bOrder %d, heap %p, flags 0x%08x\n", - ppTcpTable, bOrder, heap, flags); - - *ppTcpTable = NULL; - ret = getTcpTable(ppTcpTable, heap, flags); - if (!ret && bOrder) - qsort((*ppTcpTable)->table, (*ppTcpTable)->dwNumEntries, - sizeof(MIB_TCPROW), TcpTableSorter); - TRACE("returning %d\n", ret); - return ret; -} - - /****************************************************************** * CreateIpForwardEntry (IPHLPAPI.@) * @@ -1525,7 +1464,7 @@ DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder) if (!pdwSize) return ERROR_INVALID_PARAMETER; - ret = getTcpTable(&table, GetProcessHeap(), 0); + ret = AllocateAndGetTcpTableFromStack(&table, bOrder, GetProcessHeap(), 0); if (!ret) { DWORD size = FIELD_OFFSET( MIB_TCPTABLE, table[table->dwNumEntries] ); if (!pTcpTable || *pdwSize < size) { @@ -1535,9 +1474,6 @@ DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder) else { *pdwSize = size; memcpy(pTcpTable, table, size); - if (bOrder) - qsort(pTcpTable->table, pTcpTable->dwNumEntries, - sizeof(MIB_TCPROW), TcpTableSorter); } HeapFree(GetProcessHeap(), 0, table); } diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 2277b80..1a3086f 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1591,12 +1591,46 @@ static DWORD TCPStateToMIBState (int state) } -DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, HANDLE heap, DWORD flags) +static int compare_tcp_rows(const void *a, const void *b) +{ + const MIB_TCPROW *rowA = a; + const MIB_TCPROW *rowB = b; + int ret; + + if ((ret = ntohl (rowA->dwLocalAddr) - ntohl (rowB->dwLocalAddr)) != 0) return ret; + if ((ret = ntohs ((unsigned short)rowA->dwLocalPort) - + ntohs ((unsigned short)rowB->dwLocalPort)) != 0) return ret; + if ((ret = ntohl (rowA->dwRemoteAddr) - ntohl (rowB->dwRemoteAddr)) != 0) return ret; + return ntohs ((unsigned short)rowA->dwRemotePort) - ntohs ((unsigned short)rowB->dwRemotePort); +} + + +/****************************************************************** + * AllocateAndGetTcpTableFromStack (IPHLPAPI.@) + * + * Get the TCP connection table. + * Like GetTcpTable(), but allocate the returned table from heap. + * + * PARAMS + * ppTcpTable [Out] pointer into which the MIB_TCPTABLE is + * allocated and returned. + * bOrder [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppTcpTable is NULL, whatever GetTcpTable() + * returns otherwise. + */ +DWORD WINAPI AllocateAndGetTcpTableFromStack( PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, + HANDLE heap, DWORD flags) { MIB_TCPTABLE *table; MIB_TCPROW row; DWORD ret = NO_ERROR, count = 16; + TRACE("table %p, bOrder %d, heap %p, flags 0x%08x\n", ppTcpTable, bOrder, heap, flags); + if (!ppTcpTable) return ERROR_INVALID_PARAMETER; if (!(table = HeapAlloc( heap, flags, FIELD_OFFSET(MIB_TCPTABLE, table[count] )))) @@ -1713,7 +1747,13 @@ DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, HANDLE heap, DWORD flags) #endif if (!table) return ERROR_OUTOFMEMORY; - if (!ret) *ppTcpTable = table; + if (!ret) + { + if (bOrder && table->dwNumEntries) + qsort( table->table, table->dwNumEntries, sizeof(row), compare_tcp_rows ); + *ppTcpTable = table; + } else HeapFree( heap, flags, table ); + TRACE( "returning ret %u table %p\n", ret, table ); return ret; } diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 431b414..bc2fe7b 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -75,11 +75,7 @@ DWORD getNumUdpEntries(void); /* Returns the number of entries in the TCP state table. */ DWORD getNumTcpEntries(void); -/* Allocates the TCP state table from heap and returns it to you in *ppTcpTable. - * Returns NO_ERROR on success, something else on failure. - */ -DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, HANDLE heap, DWORD flags); - DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); +DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); #endif /* ndef WINE_IPSTATS_H_ */
1
0
0
0
Alexandre Julliard : iphlpapi: Moved AllocateAndGetUdpTableFromStack implementation to ipstats.c.
by Alexandre Julliard
02 Mar '09
02 Mar '09
Module: wine Branch: master Commit: 95827a8237fea9ef3fa0558a99009ff5c9c7cd9d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=95827a8237fea9ef3fa0558a9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 2 12:50:30 2009 +0100 iphlpapi: Moved AllocateAndGetUdpTableFromStack implementation to ipstats.c. --- dlls/iphlpapi/iphlpapi_main.c | 56 +---------------------------------------- dlls/iphlpapi/ipstats.c | 41 ++++++++++++++++++++++++++++- dlls/iphlpapi/ipstats.h | 7 +--- 3 files changed, 42 insertions(+), 62 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 0c5f209..735091b 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -352,57 +352,6 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, } -static int UdpTableSorter(const void *a, const void *b) -{ - int ret; - - if (a && b) { - const MIB_UDPROW* rowA = (const MIB_UDPROW*)a; - const MIB_UDPROW* rowB = (const MIB_UDPROW*)b; - - ret = rowA->dwLocalAddr - rowB->dwLocalAddr; - if (ret == 0) - ret = rowA->dwLocalPort - rowB->dwLocalPort; - } - else - ret = 0; - return ret; -} - - -/****************************************************************** - * AllocateAndGetUdpTableFromStack (IPHLPAPI.@) - * - * Get the UDP listener table. - * Like GetUdpTable(), but allocate the returned table from heap. - * - * PARAMS - * ppUdpTable [Out] pointer into which the MIB_UDPTABLE is - * allocated and returned. - * bOrder [In] whether to sort the table - * heap [In] heap from which the table is allocated - * flags [In] flags to HeapAlloc - * - * RETURNS - * ERROR_INVALID_PARAMETER if ppUdpTable is NULL, whatever GetUdpTable() - * returns otherwise. - */ -DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, - BOOL bOrder, HANDLE heap, DWORD flags) -{ - DWORD ret; - - TRACE("ppUdpTable %p, bOrder %d, heap %p, flags 0x%08x\n", - ppUdpTable, bOrder, heap, flags); - ret = getUdpTable(ppUdpTable, heap, flags); - if (!ret && bOrder) - qsort((*ppUdpTable)->table, (*ppUdpTable)->dwNumEntries, - sizeof(MIB_UDPROW), UdpTableSorter); - TRACE("returning %d\n", ret); - return ret; -} - - /****************************************************************** * CreateIpForwardEntry (IPHLPAPI.@) * @@ -1650,7 +1599,7 @@ DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder) if (!pdwSize) return ERROR_INVALID_PARAMETER; - ret = getUdpTable(&table, GetProcessHeap(), 0); + ret = AllocateAndGetUdpTableFromStack( &table, bOrder, GetProcessHeap(), 0 ); if (!ret) { DWORD size = FIELD_OFFSET( MIB_UDPTABLE, table[table->dwNumEntries] ); if (!pUdpTable || *pdwSize < size) { @@ -1660,9 +1609,6 @@ DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder) else { *pdwSize = size; memcpy(pUdpTable, table, size); - if (bOrder) - qsort(pUdpTable->table, pUdpTable->dwNumEntries, - sizeof(MIB_UDPROW), UdpTableSorter); } HeapFree(GetProcessHeap(), 0, table); } diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 9cfaa21..2277b80 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1454,12 +1454,43 @@ static MIB_UDPTABLE *append_udp_row( HANDLE heap, DWORD flags, MIB_UDPTABLE *tab return table; } -DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags) +static int compare_udp_rows(const void *a, const void *b) +{ + const MIB_UDPROW *rowA = a; + const MIB_UDPROW *rowB = b; + int ret; + + if ((ret = rowA->dwLocalAddr - rowB->dwLocalAddr) != 0) return ret; + return rowA->dwLocalPort - rowB->dwLocalPort; +} + + +/****************************************************************** + * AllocateAndGetUdpTableFromStack (IPHLPAPI.@) + * + * Get the UDP listener table. + * Like GetUdpTable(), but allocate the returned table from heap. + * + * PARAMS + * ppUdpTable [Out] pointer into which the MIB_UDPTABLE is + * allocated and returned. + * bOrder [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppUdpTable is NULL, whatever GetUdpTable() + * returns otherwise. + */ +DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, + HANDLE heap, DWORD flags) { MIB_UDPTABLE *table; MIB_UDPROW row; DWORD ret = NO_ERROR, count = 16; + TRACE("table %p, bOrder %d, heap %p, flags 0x%08x\n", ppUdpTable, bOrder, heap, flags); + if (!ppUdpTable) return ERROR_INVALID_PARAMETER; if (!(table = HeapAlloc( heap, flags, FIELD_OFFSET(MIB_UDPTABLE, table[count] )))) @@ -1496,8 +1527,14 @@ DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags) #endif if (!table) return ERROR_OUTOFMEMORY; - if (!ret) *ppUdpTable = table; + if (!ret) + { + if (bOrder && table->dwNumEntries) + qsort( table->table, table->dwNumEntries, sizeof(row), compare_udp_rows ); + *ppUdpTable = table; + } else HeapFree( heap, flags, table ); + TRACE( "returning ret %u table %p\n", ret, table ); return ret; } diff --git a/dlls/iphlpapi/ipstats.h b/dlls/iphlpapi/ipstats.h index 147276e..431b414 100644 --- a/dlls/iphlpapi/ipstats.h +++ b/dlls/iphlpapi/ipstats.h @@ -72,11 +72,6 @@ DWORD getArpTable(PMIB_IPNETTABLE *ppIpNetTable, HANDLE heap, DWORD flags); /* Returns the number of entries in the UDP state table. */ DWORD getNumUdpEntries(void); -/* Allocates the UDP state table from heap and returns it to you in *ppUdpTable. - * Returns NO_ERROR on success, something else on failure. - */ -DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags); - /* Returns the number of entries in the TCP state table. */ DWORD getNumTcpEntries(void); @@ -85,4 +80,6 @@ DWORD getNumTcpEntries(void); */ DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, HANDLE heap, DWORD flags); +DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); + #endif /* ndef WINE_IPSTATS_H_ */
1
0
0
0
← Newer
1
...
76
77
78
79
80
81
82
83
84
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Results per page:
10
25
50
100
200