ReactOS.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
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
List overview
Download
Ros-diffs
October 2019
----- 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
ros-diffs@reactos.org
23 participants
180 discussions
Start a n
N
ew thread
[reactos] 01/01: [DNSAPI] Add the Resolver Service RPC client code and implement DnsFlushResolverCache()
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b79246c534dbcf75f290c…
commit b79246c534dbcf75f290c6c1352eb715addeec14 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Oct 27 20:38:25 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Oct 27 20:38:25 2019 +0100 [DNSAPI] Add the Resolver Service RPC client code and implement DnsFlushResolverCache() Patch by Peter Hater and Christoph von Wittich. Slightly modified by me. CORE-12159 --- dll/win32/dnsapi/CMakeLists.txt | 11 ++++-- dll/win32/dnsapi/dnsapi/precomp.h | 2 ++ dll/win32/dnsapi/dnsapi/query.c | 23 ++++++++++++ dll/win32/dnsapi/dnsapi/rpc.c | 75 +++++++++++++++++++++++++++++++++++++++ dll/win32/dnsapi/dnsapi/stubs.c | 7 ---- 5 files changed, 108 insertions(+), 10 deletions(-) diff --git a/dll/win32/dnsapi/CMakeLists.txt b/dll/win32/dnsapi/CMakeLists.txt index 2dcfaa0a84b..a0edb35c99b 100644 --- a/dll/win32/dnsapi/CMakeLists.txt +++ b/dll/win32/dnsapi/CMakeLists.txt @@ -1,9 +1,12 @@ include_directories( include + ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl ${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/src ${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/adns_win32) +add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/dnsrslvr.idl) + add_definitions(-DADNS_JGAA_WIN32 -D_CRT_NO_POSIX_ERROR_CODES) spec2def(dnsapi.dll dnsapi.spec ADD_IMPORTLIB) @@ -14,8 +17,10 @@ list(APPEND SOURCE dnsapi/names.c dnsapi/query.c dnsapi/record.c + dnsapi/rpc.c dnsapi/stubs.c - dnsapi/precomp.h) + dnsapi/precomp.h + ${CMAKE_CURRENT_BINARY_DIR}/dnsrslvr_c.c) add_library(dnsapi MODULE ${SOURCE} @@ -23,7 +28,7 @@ add_library(dnsapi MODULE ${CMAKE_CURRENT_BINARY_DIR}/dnsapi.def) set_module_type(dnsapi win32dll) -target_link_libraries(dnsapi adns) -add_importlibs(dnsapi advapi32 user32 ws2_32 iphlpapi msvcrt kernel32 ntdll) +target_link_libraries(dnsapi adns ${PSEH_LIB}) +add_importlibs(dnsapi advapi32 rpcrt4 user32 ws2_32 iphlpapi msvcrt kernel32 ntdll) add_pch(dnsapi dnsapi/precomp.h SOURCE) add_cd_file(TARGET dnsapi DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/dnsapi/dnsapi/precomp.h b/dll/win32/dnsapi/dnsapi/precomp.h index 687e67f5947..e792a4779fa 100644 --- a/dll/win32/dnsapi/dnsapi/precomp.h +++ b/dll/win32/dnsapi/dnsapi/precomp.h @@ -25,6 +25,8 @@ #define NTOS_MODE_USER #include <ndk/rtlfuncs.h> +#include <dnsrslvr_c.h> + /* Internal DNSAPI Headers */ #include <internal/windns.h> diff --git a/dll/win32/dnsapi/dnsapi/query.c b/dll/win32/dnsapi/dnsapi/query.c index 7b40b09a867..2daa2803663 100644 --- a/dll/win32/dnsapi/dnsapi/query.c +++ b/dll/win32/dnsapi/dnsapi/query.c @@ -1072,3 +1072,26 @@ DnsIntFreeRecordList(PDNS_RECORD ToDelete) ToDelete = next; } } + +BOOL +WINAPI +DnsFlushResolverCache(VOID) +{ + DNS_STATUS Status = ERROR_SUCCESS; + + DPRINT("DnsFlushResolverCache()\n"); + + RpcTryExcept + { + Status = R_ResolverFlushCache(NULL); + DPRINT("R_ResolverFlushCache() returned %lu\n", Status); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = RpcExceptionCode(); + DPRINT("Exception returned %lu\n", Status); + } + RpcEndExcept; + + return (Status == ERROR_SUCCESS); +} diff --git a/dll/win32/dnsapi/dnsapi/rpc.c b/dll/win32/dnsapi/dnsapi/rpc.c new file mode 100644 index 00000000000..528f87e6b7e --- /dev/null +++ b/dll/win32/dnsapi/dnsapi/rpc.c @@ -0,0 +1,75 @@ +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include <stdarg.h> +#include <windef.h> +#include <winbase.h> +#include <dnsrslvr_c.h> + +#define NDEBUG +#include <debug.h> + +handle_t __RPC_USER +DNSRSLVR_HANDLE_bind(DNSRSLVR_HANDLE pszMachineName) +{ + handle_t hBinding = NULL; + LPWSTR pszStringBinding; + RPC_STATUS Status; + + DPRINT1("DNSRSLVR_HANDLE_bind(%S)\n", pszMachineName); + + Status = RpcStringBindingComposeW(NULL, + L"ncalrpc", + pszMachineName, + L"DNSResolver", + NULL, + &pszStringBinding); + if (Status != RPC_S_OK) + { + DPRINT1("RpcStringBindingCompose returned 0x%x\n", Status); + return NULL; + } + + /* Set the binding handle that will be used to bind to the server. */ + Status = RpcBindingFromStringBindingW(pszStringBinding, + &hBinding); + if (Status != RPC_S_OK) + { + DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", Status); + } + + Status = RpcStringFreeW(&pszStringBinding); + if (Status != RPC_S_OK) + { + DPRINT1("RpcStringFree returned 0x%x\n", Status); + } + + return hBinding; +} + +void __RPC_USER +DNSRSLVR_HANDLE_unbind(DNSRSLVR_HANDLE pszMachineName, + handle_t hBinding) +{ + RPC_STATUS Status; + + DPRINT("DNSRSLVR_HANDLE_unbind(%S)\n", pszMachineName); + + Status = RpcBindingFree(&hBinding); + if (Status != RPC_S_OK) + { + DPRINT1("RpcBindingFree returned 0x%x\n", Status); + } +} + +void __RPC_FAR * __RPC_USER +midl_user_allocate(SIZE_T len) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); +} + +void __RPC_USER +midl_user_free(void __RPC_FAR * ptr) +{ + HeapFree(GetProcessHeap(), 0, ptr); +} \ No newline at end of file diff --git a/dll/win32/dnsapi/dnsapi/stubs.c b/dll/win32/dnsapi/dnsapi/stubs.c index 2832270d36b..f474f34695b 100644 --- a/dll/win32/dnsapi/dnsapi/stubs.c +++ b/dll/win32/dnsapi/dnsapi/stubs.c @@ -216,13 +216,6 @@ DnsFindAuthoritativeZone() return ERROR_OUTOFMEMORY; } -BOOL WINAPI -DnsFlushResolverCache(VOID) -{ - UNIMPLEMENTED; - return TRUE; -} - BOOL WINAPI DnsFlushResolverCacheEntry_A(PCSTR entry) {
5 years, 1 month
1
0
0
0
[reactos] 01/01: [DNSRSLVR] Add the DNS Resolver Cache Service
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d49d7b3282891359a11c7…
commit d49d7b3282891359a11c7ed553e8a31632c5d039 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Oct 27 13:45:52 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Oct 27 13:48:04 2019 +0100 [DNSRSLVR] Add the DNS Resolver Cache Service Patch written by Peter Hater and Christoph von Wittich. Slightly modified by me in order to - fix bit-rot - fix header include issues - disable integration with dnsapi because of confusing use of DnsQweryEx(). Integration with dnsapi will follow in a future commit. CORE-12159 --- base/services/CMakeLists.txt | 1 + base/services/dnsrslvr/CMakeLists.txt | 23 ++++ base/services/dnsrslvr/cache.c | 199 ++++++++++++++++++++++++++++++++++ base/services/dnsrslvr/dnsrslvr.c | 150 +++++++++++++++++++++++++ base/services/dnsrslvr/dnsrslvr.rc | 4 + base/services/dnsrslvr/dnsrslvr.spec | 1 + base/services/dnsrslvr/precomp.h | 45 ++++++++ base/services/dnsrslvr/rpcserver.c | 130 ++++++++++++++++++++++ media/inf/nettcpip.inf | 17 ++- sdk/include/reactos/idl/dnsrslvr.idl | 3 + sdk/include/reactos/windns_undoc.h | 6 + 11 files changed, 578 insertions(+), 1 deletion(-) diff --git a/base/services/CMakeLists.txt b/base/services/CMakeLists.txt index 62b5a90ccd9..2605101c793 100644 --- a/base/services/CMakeLists.txt +++ b/base/services/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(audiosrv) add_subdirectory(dcomlaunch) add_subdirectory(dhcpcsvc) +add_subdirectory(dnsrslvr) add_subdirectory(eventlog) add_subdirectory(netlogon) add_subdirectory(nfsd) diff --git a/base/services/dnsrslvr/CMakeLists.txt b/base/services/dnsrslvr/CMakeLists.txt new file mode 100644 index 00000000000..a2821d93763 --- /dev/null +++ b/base/services/dnsrslvr/CMakeLists.txt @@ -0,0 +1,23 @@ + +include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl) +add_rpc_files(server ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/dnsrslvr.idl) + +list(APPEND SOURCE + cache.c + dnsrslvr.c + rpcserver.c + precomp.h + ${CMAKE_CURRENT_BINARY_DIR}/dnsrslvr_s.c) + +spec2def(dnsrslvr.dll dnsrslvr.spec ADD_IMPORTLIB) + +add_library(dnsrslvr SHARED ${SOURCE} dnsrslvr.rc ${CMAKE_CURRENT_BINARY_DIR}/dnsrslvr.def) + +if(NOT MSVC) + target_link_libraries(dnsrslvr ${PSEH_LIB}) +endif() + +set_module_type(dnsrslvr win32dll UNICODE) +add_importlibs(dnsrslvr advapi32 rpcrt4 dnsapi iphlpapi msvcrt kernel32 ntdll) +add_pch(dnsrslvr precomp.h SOURCE) +add_cd_file(TARGET dnsrslvr DESTINATION reactos/system32 FOR all) diff --git a/base/services/dnsrslvr/cache.c b/base/services/dnsrslvr/cache.c new file mode 100644 index 00000000000..6a6eee4844e --- /dev/null +++ b/base/services/dnsrslvr/cache.c @@ -0,0 +1,199 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: base/services/dnsrslvr/cache.c + * PURPOSE: DNS cache functions + * PROGRAMMER: Peter Hater + */ + +#include "precomp.h" + +//#define NDEBUG +#include <debug.h> + +static RESOLVER_CACHE DnsCache; +static BOOL DnsCacheInitialized = FALSE; + +#define DnsCacheLock() do { EnterCriticalSection(&DnsCache.Lock); } while (0) +#define DnsCacheUnlock() do { LeaveCriticalSection(&DnsCache.Lock); } while (0) + +VOID +DnsIntCacheInitialize(VOID) +{ + DPRINT("DnsIntCacheInitialize\n"); + + /* Check if we're initialized */ + if (DnsCacheInitialized) + return; + + /* Initialize the cache lock and namespace list */ + InitializeCriticalSection((LPCRITICAL_SECTION)&DnsCache.Lock); + InitializeListHead(&DnsCache.RecordList); + DnsCacheInitialized = TRUE; +} + +VOID +DnsIntCacheFree(VOID) +{ + DPRINT("DnsIntCacheFree\n"); + + /* Check if we're initialized */ + if (!DnsCacheInitialized) + return; + + if (!DnsCache.RecordList.Flink) + return; + + DnsIntCacheFlush(); + + DeleteCriticalSection(&DnsCache.Lock); + DnsCacheInitialized = FALSE; +} + +VOID +DnsIntCacheRemoveEntryItem(PRESOLVER_CACHE_ENTRY CacheEntry) +{ + DPRINT("DnsIntCacheRemoveEntryItem %p\n", CacheEntry); + + /* Remove the entry from the list */ + RemoveEntryList(&CacheEntry->CacheLink); + + /* Free record */ + DnsRecordListFree(CacheEntry->Record, DnsFreeRecordList); + + /* Delete us */ + HeapFree(GetProcessHeap(), 0, CacheEntry); +} + +VOID +DnsIntCacheFlush(VOID) +{ + PLIST_ENTRY Entry; + PRESOLVER_CACHE_ENTRY CacheEntry; + + DPRINT("DnsIntCacheFlush\n"); + + /* Lock the cache */ + DnsCacheLock(); + + /* Loop every entry */ + Entry = DnsCache.RecordList.Flink; + while (Entry != &DnsCache.RecordList) + { + /* Get this entry */ + CacheEntry = CONTAINING_RECORD(Entry, RESOLVER_CACHE_ENTRY, CacheLink); + + /* Remove it from list */ + DnsIntCacheRemoveEntryItem(CacheEntry); + + /* Move to the next entry */ + Entry = DnsCache.RecordList.Flink; + } + + /* Unlock the cache */ + DnsCacheUnlock(); +} + +BOOL +DnsIntCacheGetEntryFromName(LPCWSTR Name, + PDNS_RECORDW *Record) +{ + BOOL Ret = FALSE; + PRESOLVER_CACHE_ENTRY CacheEntry; + PLIST_ENTRY NextEntry; + + DPRINT("DnsIntCacheGetEntryFromName %ws %p\n", Name, Record); + + /* Assume failure */ + *Record = NULL; + + /* Lock the cache */ + DnsCacheLock(); + + /* Match the Id with all the entries in the List */ + NextEntry = DnsCache.RecordList.Flink; + while (NextEntry != &DnsCache.RecordList) + { + /* Get the Current Entry */ + CacheEntry = CONTAINING_RECORD(NextEntry, RESOLVER_CACHE_ENTRY, CacheLink); + + /* Check if this is the Catalog Entry ID we want */ + if (_wcsicmp(CacheEntry->Record->pName, Name) == 0) + { + /* Copy the entry and return it */ + *Record = DnsRecordSetCopyEx(CacheEntry->Record, DnsCharSetUnicode, DnsCharSetUnicode); + Ret = TRUE; + break; + } + + NextEntry = NextEntry->Flink; + } + + /* Release the cache */ + DnsCacheUnlock(); + + /* Return */ + return Ret; +} + +BOOL +DnsIntCacheRemoveEntryByName(LPCWSTR Name) +{ + BOOL Ret = FALSE; + PRESOLVER_CACHE_ENTRY CacheEntry; + PLIST_ENTRY NextEntry; + + DPRINT("DnsIntCacheRemoveEntryByName %ws\n", Name); + + /* Lock the cache */ + DnsCacheLock(); + + /* Match the Id with all the entries in the List */ + NextEntry = DnsCache.RecordList.Flink; + while (NextEntry != &DnsCache.RecordList) + { + /* Get the Current Entry */ + CacheEntry = CONTAINING_RECORD(NextEntry, RESOLVER_CACHE_ENTRY, CacheLink); + + /* Check if this is the Catalog Entry ID we want */ + if (_wcsicmp(CacheEntry->Record->pName, Name) == 0) + { + /* Remove the entry */ + DnsIntCacheRemoveEntryItem(CacheEntry); + Ret = TRUE; + break; + } + + NextEntry = NextEntry->Flink; + } + + /* Release the cache */ + DnsCacheUnlock(); + + /* Return */ + return Ret; +} + +VOID +DnsIntCacheAddEntry(PDNS_RECORDW Record) +{ + PRESOLVER_CACHE_ENTRY Entry; + + DPRINT("DnsIntCacheRemoveEntryByName %p\n", Record); + + /* Lock the cache */ + DnsCacheLock(); + + /* Match the Id with all the entries in the List */ + Entry = (PRESOLVER_CACHE_ENTRY)HeapAlloc(GetProcessHeap(), 0, sizeof(*Entry)); + if (!Entry) + return; + + Entry->Record = DnsRecordSetCopyEx(Record, DnsCharSetUnicode, DnsCharSetUnicode); + + /* Insert it to our List */ + InsertTailList(&DnsCache.RecordList, &Entry->CacheLink); + + /* Release the cache */ + DnsCacheUnlock(); +} diff --git a/base/services/dnsrslvr/dnsrslvr.c b/base/services/dnsrslvr/dnsrslvr.c new file mode 100644 index 00000000000..c0384050ca9 --- /dev/null +++ b/base/services/dnsrslvr/dnsrslvr.c @@ -0,0 +1,150 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS DNS Resolver + * FILE: base/services/dnsrslvr/dnsrslvr.c + * PURPOSE: DNS Resolver Service + * PROGRAMMER: Christoph von Wittich + */ + +/* INCLUDES *****************************************************************/ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + +/* GLOBALS ******************************************************************/ + +HINSTANCE hDllInstance; +SERVICE_STATUS_HANDLE ServiceStatusHandle; +SERVICE_STATUS SvcStatus; +static WCHAR ServiceName[] = L"Dnscache"; + +DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter); + +/* FUNCTIONS *****************************************************************/ + +static +VOID +UpdateServiceStatus( + HANDLE hServiceStatus, + DWORD NewStatus, + DWORD Increment) +{ + if (Increment > 0) + SvcStatus.dwCheckPoint += Increment; + else + SvcStatus.dwCheckPoint = 0; + + SvcStatus.dwCurrentState = NewStatus; + SetServiceStatus(hServiceStatus, &SvcStatus); +} + +static +DWORD +WINAPI +ServiceControlHandler( + DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) +{ + switch (dwControl) + { + case SERVICE_CONTROL_SHUTDOWN: + case SERVICE_CONTROL_STOP: + UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOP_PENDING, 1); + RpcMgmtStopServerListening(NULL); + DnsIntCacheFree(); + UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOPPED, 0); + break; + + case SERVICE_CONTROL_INTERROGATE: + return NO_ERROR; + + default: + return ERROR_CALL_NOT_IMPLEMENTED; + } + return NO_ERROR; +} + +VOID +WINAPI +ServiceMain( + DWORD argc, + LPWSTR *argv) +{ + HANDLE hThread; + + UNREFERENCED_PARAMETER(argc); + UNREFERENCED_PARAMETER(argv); + + DPRINT("ServiceMain() called\n"); + + SvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + SvcStatus.dwCurrentState = SERVICE_START_PENDING; + SvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + SvcStatus.dwCheckPoint = 0; + SvcStatus.dwWin32ExitCode = NO_ERROR; + SvcStatus.dwServiceSpecificExitCode = 0; + SvcStatus.dwWaitHint = 4000; + + ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, + ServiceControlHandler, + NULL); + + if (!ServiceStatusHandle) + { + DPRINT1("DNSRSLVR: Unable to register service control handler (%lx)\n", GetLastError()); + return; // FALSE + } + + DnsIntCacheInitialize(); + + hThread = CreateThread(NULL, + 0, + (LPTHREAD_START_ROUTINE) + RpcThreadRoutine, + NULL, + 0, + NULL); + + if (!hThread) + { + DnsIntCacheFree(); + DPRINT("Can't create RpcThread\n"); + UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOPPED, 0); + } + else + { + CloseHandle(hThread); + } + + DPRINT("ServiceMain() done\n"); + UpdateServiceStatus(ServiceStatusHandle, SERVICE_RUNNING, 0); +} + +BOOL +WINAPI +DllMain( + _In_ HINSTANCE hinstDLL, + _In_ DWORD fdwReason, + _In_ PVOID pvReserved) +{ + UNREFERENCED_PARAMETER(pvReserved); + + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + hDllInstance = hinstDLL; + break; + + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +/* EOF */ diff --git a/base/services/dnsrslvr/dnsrslvr.rc b/base/services/dnsrslvr/dnsrslvr.rc new file mode 100644 index 00000000000..482aefe129f --- /dev/null +++ b/base/services/dnsrslvr/dnsrslvr.rc @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "DNS-Client" +#define REACTOS_STR_INTERNAL_NAME "dnsrslvr" +#define REACTOS_STR_ORIGINAL_FILENAME "dnsrslvr.dll" +#include <reactos/version.rc> diff --git a/base/services/dnsrslvr/dnsrslvr.spec b/base/services/dnsrslvr/dnsrslvr.spec new file mode 100644 index 00000000000..1b27fe53864 --- /dev/null +++ b/base/services/dnsrslvr/dnsrslvr.spec @@ -0,0 +1 @@ +@ stdcall ServiceMain(long ptr) diff --git a/base/services/dnsrslvr/precomp.h b/base/services/dnsrslvr/precomp.h new file mode 100644 index 00000000000..0a11db5ee62 --- /dev/null +++ b/base/services/dnsrslvr/precomp.h @@ -0,0 +1,45 @@ +#ifndef _DNSRSLVR_PCH_ +#define _DNSRSLVR_PCH_ + +#include <stdarg.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <windef.h> +#include <winbase.h> +#include <winsvc.h> +#include <windns.h> + +#include <ndk/rtlfuncs.h> +#include <ndk/obfuncs.h> + +#include <dnsrslvr_s.h> + +typedef struct _RESOLVER_CACHE_ENTRY +{ + LIST_ENTRY CacheLink; + PDNS_RECORDW Record; +} RESOLVER_CACHE_ENTRY, *PRESOLVER_CACHE_ENTRY; + +typedef struct _RESOLVER_CACHE +{ + LIST_ENTRY RecordList; + CRITICAL_SECTION Lock; +} RESOLVER_CACHE, *PRESOLVER_CACHE; + + +/* cache.c */ + +VOID DnsIntCacheInitialize(VOID); +VOID DnsIntCacheRemoveEntryItem(PRESOLVER_CACHE_ENTRY CacheEntry); +VOID DnsIntCacheFree(VOID); +VOID DnsIntCacheFlush(VOID); +BOOL DnsIntCacheGetEntryFromName(LPCWSTR Name, + PDNS_RECORDW *Record); +VOID DnsIntCacheAddEntry(PDNS_RECORDW Record); +BOOL DnsIntCacheRemoveEntryByName(LPCWSTR Name); + + +#endif /* _DNSRSLVR_PCH_ */ diff --git a/base/services/dnsrslvr/rpcserver.c b/base/services/dnsrslvr/rpcserver.c new file mode 100644 index 00000000000..0cb5c1f8b59 --- /dev/null +++ b/base/services/dnsrslvr/rpcserver.c @@ -0,0 +1,130 @@ +/* + * PROJECT: ReactOS DNS Resolver + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/services/dnsrslvr/rpcserver.c + * PURPOSE: RPC server interface + * COPYRIGHT: Copyright 2016 Christoph von Wittich + */ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + +DWORD +WINAPI +RpcThreadRoutine(LPVOID lpParameter) +{ + RPC_STATUS Status; + + Status = RpcServerUseProtseqEpW(L"ncalrpc", 20, L"DNSResolver", NULL); + if (Status != RPC_S_OK) + { + DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); + return 0; + } + + Status = RpcServerRegisterIf(DnsResolver_v2_0_s_ifspec, NULL, NULL); + if (Status != RPC_S_OK) + { + DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status); + return 0; + } + + Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, 0); + if (Status != RPC_S_OK) + { + DPRINT("RpcServerListen() failed (Status %lx)\n", Status); + } + + DPRINT("RpcServerListen finished\n"); + return 0; +} + +DWORD +R_ResolverFlushCache( + DNSRSLVR_HANDLE pwszServerName) +{ + // FIXME Should store (and flush) entries by server handle + DnsIntCacheFlush(); + return 0; +} + +DWORD +R_ResolverQuery( + DNSRSLVR_HANDLE pwszServerName, + LPCWSTR pwsName, + WORD wType, + DWORD Flags, + DWORD *dwRecords, + DNS_RECORDW **ppResultRecords) +{ +#if 0 + DNS_QUERY_REQUEST QueryRequest = { 0 }; + DNS_QUERY_RESULT QueryResults = { 0 }; +#endif + DNS_STATUS Status; + PDNS_RECORDW Record; + + DPRINT1("R_ResolverQuery %p %p %x %lx %p %p\n", + pwszServerName, pwsName, wType, Flags, dwRecords, ppResultRecords); + + if (!pwszServerName || !pwsName || !wType || !ppResultRecords) + return ERROR_INVALID_PARAMETER; + + // FIXME Should lookup entries by server handle + if (DnsIntCacheGetEntryFromName(pwsName, ppResultRecords)) + { + Status = ERROR_SUCCESS; + } + else + { +#if 0 + QueryRequest.Version = DNS_QUERY_REQUEST_VERSION1; + QueryRequest.QueryType = wType; + QueryRequest.QueryName = pwsName; + QueryRequest.QueryOptions = Flags; + QueryResults.Version = DNS_QUERY_REQUEST_VERSION1; + + Status = DnsQueryEx(&QueryRequest, &QueryResults, NULL); + if (Status == ERROR_SUCCESS) + { + // FIXME Should store (and flush) entries by server handle + DnsIntCacheAddEntry(QueryResults.pQueryRecords); + *ppResultRecords = QueryResults.pQueryRecords; + } +#endif + } + + if (dwRecords) + *dwRecords = 0; + + if (Status == ERROR_SUCCESS) + { + Record = *ppResultRecords; + while (Record) + { + if (dwRecords) + (*dwRecords)++; + Record = Record->pNext; + } + } + + DPRINT1("R_ResolverQuery result %ld %ld\n", Status, *dwRecords); + + return Status; +} + +void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); +} + +void __RPC_USER midl_user_free(void __RPC_FAR * ptr) +{ + HeapFree(GetProcessHeap(), 0, ptr); +} + +void __RPC_USER WLANSVC_RPC_HANDLE_rundown(DNSRSLVR_HANDLE hClientHandle) +{ +} diff --git a/media/inf/nettcpip.inf b/media/inf/nettcpip.inf index eaf1b7cc9eb..d179e9d0499 100644 --- a/media/inf/nettcpip.inf +++ b/media/inf/nettcpip.inf @@ -27,7 +27,7 @@ AddReg = TCPIP_AddReg_Global.NT HKR,"Ndi","ClsId",0x00000000,"{A907657F-6FDF-11D0-8EFB-00C04FD912B2}" HKR,"Ndi","HelpText",0x00000000,"Transmission Control Protocol/Internet Protocol" HKR,"Ndi","Service",0x00000000,"Tcpip" -HKR,"Ndi","CoServices",0x00010000,"Tcpip","Dhcp" +HKR,"Ndi","CoServices",0x00010000,"Tcpip","Dhcp","Dnscache" ; TCP/IPv4 driver ; NOTE: These settings should be added by the network setup @@ -236,6 +236,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Winsock2\Parameters\Protocol_Catalog9\Ca [MS_TCPIP.PrimaryInstall.Services] AddService = Tcpip, , tcpip_Service_Inst AddService = DHCP, , dhcp_Service_Inst +AddService = Dnscache, , dns_Service_Inst [tcpip_Service_Inst] ServiceType = 1 @@ -275,6 +276,20 @@ AddReg=dhcp_AddReg HKR,,"ObjectName",0x00000000,"LocalSystem" HKR,"Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\dhcpcsvc.dll" +[dns_Service_Inst] +DisplayName = "DNS Client" +Description = "Service that caches local DNS queries" +ServiceType = 0x20 +StartType = 2 +ErrorControl = 1 +ServiceBinary = "%11%\svchost.exe -k netsvcs" +LoadOrderGroup = TDI +AddReg=dns_AddReg + +[dns_AddReg] +HKR,,"ObjectName",0x00000000,"LocalSystem" +HKR,"Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\dnsrslvr.dll" + ;-------------------------------- STRINGS ------------------------------- [Strings] diff --git a/sdk/include/reactos/idl/dnsrslvr.idl b/sdk/include/reactos/idl/dnsrslvr.idl index ee5af553fb5..787e5c71267 100644 --- a/sdk/include/reactos/idl/dnsrslvr.idl +++ b/sdk/include/reactos/idl/dnsrslvr.idl @@ -6,7 +6,10 @@ #define UNICODE #include <sal.h> + +cpp_quote("#ifndef _WINDNS_INCLUDED_") #include <windns.h> +cpp_quote("#endif") typedef [handle, string] LPWSTR DNSRSLVR_HANDLE; diff --git a/sdk/include/reactos/windns_undoc.h b/sdk/include/reactos/windns_undoc.h index 3af80a1dfc5..01e6f412095 100644 --- a/sdk/include/reactos/windns_undoc.h +++ b/sdk/include/reactos/windns_undoc.h @@ -14,6 +14,10 @@ typedef struct _DNS_CACHE_ENTRY unsigned short wFlags; /* DNS Record Flags */ } DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY; + +#ifndef __WIDL__ +// Hack + BOOL WINAPI DnsFlushResolverCache(VOID); @@ -23,6 +27,8 @@ WINAPI DnsGetCacheDataTable( _Out_ PDNS_CACHE_ENTRY *DnsCache); +#endif /* __WIDL__ */ + #ifdef __cplusplus } #endif
5 years, 1 month
1
0
0
0
[reactos] 01/01: [FLOPPY] Make floppy drives letters being handled by the MountMgr
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6889cff5b578296d956e5…
commit 6889cff5b578296d956e5a4a0e9c8c0e46d328cc Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Oct 27 11:35:23 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Oct 27 11:35:23 2019 +0100 [FLOPPY] Make floppy drives letters being handled by the MountMgr This involves many changes/fixes in the floppy driver: - Stop creating ourselves our DOS device, it's up to the MountMgr or to the kernel; - Report each new floppy drive to the MountMgr (this is a hack for now); - As a consequence, stop storing the symlink name into the DRIVE_INFO structure; - Store the device name instead; - On IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, don't return DOS device, but device name; - On IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, properly return if buffer is way too small; - Hackplement IOCTL_MOUNTDEV_QUERY_UNIQUE_ID so that it returns device name. --- drivers/storage/floppy/floppy.c | 134 ++++++++++++++++++++++++++++++++-------- drivers/storage/floppy/floppy.h | 2 +- drivers/storage/floppy/ioctl.c | 40 ++++++++++-- 3 files changed, 142 insertions(+), 34 deletions(-) diff --git a/drivers/storage/floppy/floppy.c b/drivers/storage/floppy/floppy.c index 4234b0f8bb8..b67c6096872 100644 --- a/drivers/storage/floppy/floppy.c +++ b/drivers/storage/floppy/floppy.c @@ -406,9 +406,6 @@ Unload(PDRIVER_OBJECT DriverObject) { UNICODE_STRING Link; - RtlInitUnicodeString(&Link, gControllerInfo[i].DriveInfo[j].SymLinkBuffer); - IoDeleteSymbolicLink(&Link); - RtlInitUnicodeString(&Link, gControllerInfo[i].DriveInfo[j].ArcPathBuffer); IoDeassignArcName(&Link); @@ -811,6 +808,98 @@ InitController(PCONTROLLER_INFO ControllerInfo) } +static VOID NTAPI +ReportToMountMgr(UCHAR ControlerId, UCHAR DriveId) +/* + * FUNCTION: Called to report a new controler to the MountMgr + * ARGUMENTS: + * ControlerId: ID of the controler + * DriveId: ID of the device for the controler + * RETURNS: + * Nothing + * NOTES: + * - This is a hack to allow MountMgr handling our devices + */ +{ + NTSTATUS Status; + UNICODE_STRING MountMgrDevice; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; + PMOUNTMGR_TARGET_NAME MountTarget; + ULONG DeviceLen; + PIRP Irp; + KEVENT Event; + IO_STATUS_BLOCK IoStatus; + + /* First, get MountMgr DeviceObject */ + RtlInitUnicodeString(&MountMgrDevice, MOUNTMGR_DEVICE_NAME); + Status = IoGetDeviceObjectPointer(&MountMgrDevice, FILE_READ_ATTRIBUTES, + &FileObject, &DeviceObject); + + if(!NT_SUCCESS(Status)) + { + WARN_(FLOPPY, "ReportToMountMgr: Can't get MountMgr pointers %lx\n", Status); + return; + } + + DeviceLen = wcslen(&gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer[0]) * sizeof(WCHAR); + + /* Allocate input buffer to report our floppy device */ + MountTarget = ExAllocatePool(NonPagedPool, + sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen); + + if(!MountTarget) + { + WARN_(FLOPPY, "ReportToMountMgr: Allocation of mountTarget failed\n"); + ObDereferenceObject(FileObject); + return; + } + + MountTarget->DeviceNameLength = DeviceLen; + RtlCopyMemory(MountTarget->DeviceName, + gControllerInfo[ControlerId].DriveInfo[DriveId].DeviceNameBuffer, + DeviceLen); + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + /* Build the IRP used to communicate with the MountMgr */ + Irp = IoBuildDeviceIoControlRequest(IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION, + DeviceObject, + MountTarget, + sizeof(MOUNTMGR_TARGET_NAME) + DeviceLen, + NULL, + 0, + FALSE, + &Event, + &IoStatus); + + if(!Irp) + { + WARN_(FLOPPY, "ReportToMountMgr: Allocation of irp failed\n"); + ExFreePool(MountTarget); + ObDereferenceObject(FileObject); + return; + } + + /* Call the MountMgr */ + Status = IoCallDriver(DeviceObject, Irp); + + if (Status == STATUS_PENDING) { + KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); + Status = IoStatus.Status; + } + + /* We're done */ + + INFO_(FLOPPY, "Reported to the MountMgr: %lx\n", Status); + + ExFreePool(MountTarget); + ObDereferenceObject(FileObject); + + return; +} + + static BOOLEAN NTAPI AddControllers(PDRIVER_OBJECT DriverObject) /* @@ -912,9 +1001,7 @@ AddControllers(PDRIVER_OBJECT DriverObject) /* 3: per-drive setup */ for(j = 0; j < gControllerInfo[i].NumberOfDrives; j++) { - WCHAR DeviceNameBuf[MAX_DEVICE_NAME]; UNICODE_STRING DeviceName; - UNICODE_STRING LinkName; UNICODE_STRING ArcPath; UCHAR DriveNumber; @@ -936,9 +1023,8 @@ AddControllers(PDRIVER_OBJECT DriverObject) DriveNumber = (UCHAR)(i*4 + j); /* loss of precision is OK; there are only 16 of 'em */ - RtlZeroMemory(&DeviceNameBuf, MAX_DEVICE_NAME * sizeof(WCHAR)); - swprintf(DeviceNameBuf, L"\\Device\\Floppy%d", DriveNumber); - RtlInitUnicodeString(&DeviceName, DeviceNameBuf); + swprintf(gControllerInfo[i].DriveInfo[j].DeviceNameBuffer, L"\\Device\\Floppy%d", DriveNumber); + RtlInitUnicodeString(&DeviceName, gControllerInfo[i].DriveInfo[j].DeviceNameBuffer); if(IoCreateDevice(DriverObject, sizeof(PVOID), &DeviceName, FILE_DEVICE_DISK, FILE_REMOVABLE_MEDIA | FILE_FLOPPY_DISKETTE, FALSE, @@ -949,7 +1035,9 @@ AddControllers(PDRIVER_OBJECT DriverObject) continue; /* continue on to next drive */ } - INFO_(FLOPPY, "AddControllers: New device: %S (0x%p)\n", DeviceNameBuf, gControllerInfo[i].DriveInfo[j].DeviceObject); + INFO_(FLOPPY, "AddControllers: New device: %S (0x%p)\n", + gControllerInfo[i].DriveInfo[j].DeviceNameBuffer, + gControllerInfo[i].DriveInfo[j].DeviceObject); /* 3b.5: Create an ARC path in case we're booting from this drive */ swprintf(gControllerInfo[i].DriveInfo[j].ArcPathBuffer, @@ -961,38 +1049,30 @@ AddControllers(PDRIVER_OBJECT DriverObject) /* 3c: Set flags up */ gControllerInfo[i].DriveInfo[j].DeviceObject->Flags |= DO_DIRECT_IO; - /* 3d: Create a symlink */ - swprintf(gControllerInfo[i].DriveInfo[j].SymLinkBuffer, L"\\DosDevices\\%c:", DriveNumber + 'A'); - RtlInitUnicodeString(&LinkName, gControllerInfo[i].DriveInfo[j].SymLinkBuffer); - if(IoCreateSymbolicLink(&LinkName, &DeviceName) != STATUS_SUCCESS) - { - WARN_(FLOPPY, "AddControllers: Unable to create a symlink for drive %d\n", DriveNumber); - IoDisconnectInterrupt(gControllerInfo[i].InterruptObject); - IoDeassignArcName(&ArcPath); - continue; /* continue to next drive */ - } - - /* 3e: Increase global floppy drives count */ + /* 3d: Increase global floppy drives count */ IoGetConfigurationInformation()->FloppyCount++; - /* 3f: Set up the DPC */ + /* 3e: Set up the DPC */ IoInitializeDpcRequest(gControllerInfo[i].DriveInfo[j].DeviceObject, (PIO_DPC_ROUTINE)DpcForIsr); - /* 3g: Point the device extension at our DriveInfo struct */ + /* 3f: Point the device extension at our DriveInfo struct */ gControllerInfo[i].DriveInfo[j].DeviceObject->DeviceExtension = &gControllerInfo[i].DriveInfo[j]; - /* 3h: neat comic strip */ + /* 3g: neat comic strip */ - /* 3i: set the initial media type to unknown */ + /* 3h: set the initial media type to unknown */ memset(&gControllerInfo[i].DriveInfo[j].DiskGeometry, 0, sizeof(DISK_GEOMETRY)); gControllerInfo[i].DriveInfo[j].DiskGeometry.MediaType = Unknown; - /* 3j: Now that we're done, set the Initialized flag so we know to free this in Unload */ + /* 3i: Now that we're done, set the Initialized flag so we know to free this in Unload */ gControllerInfo[i].DriveInfo[j].Initialized = TRUE; - /* 3k: Clear the DO_DEVICE_INITIALIZING flag */ + /* 3j: Clear the DO_DEVICE_INITIALIZING flag */ gControllerInfo[i].DriveInfo[j].DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; + /* 3k: Report to the MountMgr */ + ReportToMountMgr(i, j); + /* 3l: Attempt to get drive info - if a floppy is already present */ StartMotor(&gControllerInfo[i].DriveInfo[j]); RWDetermineMediaType(&gControllerInfo[i].DriveInfo[j], TRUE); diff --git a/drivers/storage/floppy/floppy.h b/drivers/storage/floppy/floppy.h index cd0301ca533..3dfd7c63160 100644 --- a/drivers/storage/floppy/floppy.h +++ b/drivers/storage/floppy/floppy.h @@ -48,8 +48,8 @@ typedef struct _DRIVE_INFO CM_FLOPPY_DEVICE_DATA FloppyDeviceData; DISK_GEOMETRY DiskGeometry; UCHAR BytesPerSectorCode; - WCHAR SymLinkBuffer[MAX_DEVICE_NAME]; WCHAR ArcPathBuffer[MAX_ARC_PATH_LEN]; + WCHAR DeviceNameBuffer[MAX_DEVICE_NAME]; ULONG DiskChangeCount; BOOLEAN Initialized; } DRIVE_INFO, *PDRIVE_INFO; diff --git a/drivers/storage/floppy/ioctl.c b/drivers/storage/floppy/ioctl.c index 74a35175cb1..e6073a95299 100644 --- a/drivers/storage/floppy/ioctl.c +++ b/drivers/storage/floppy/ioctl.c @@ -75,6 +75,7 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp) ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode; BOOLEAN DiskChanged; PMOUNTDEV_NAME Name; + PMOUNTDEV_UNIQUE_ID UniqueId; TRACE_(FLOPPY, "DeviceIoctl called\n"); Irp->IoStatus.Status = STATUS_SUCCESS; @@ -256,27 +257,54 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp) Irp->IoStatus.Information = 0; break; + case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID: + if(OutputLength < sizeof(MOUNTDEV_UNIQUE_ID)) + { + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + Irp->IoStatus.Information = 0; + break; + } + + UniqueId = Irp->AssociatedIrp.SystemBuffer; + UniqueId->UniqueIdLength = wcslen(&DriveInfo->DeviceNameBuffer[0]) * sizeof(WCHAR); + + if(OutputLength < FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + UniqueId->UniqueIdLength) + { + Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; + Irp->IoStatus.Information = sizeof(MOUNTDEV_UNIQUE_ID); + break; + } + + RtlCopyMemory(UniqueId->UniqueId, &DriveInfo->DeviceNameBuffer[0], + UniqueId->UniqueIdLength); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + UniqueId->UniqueIdLength; + break; + case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME: - if (OutputLength < sizeof(MOUNTDEV_NAME)) { + if(OutputLength < sizeof(MOUNTDEV_NAME)) + { Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME); + Irp->IoStatus.Information = 0; break; } Name = Irp->AssociatedIrp.SystemBuffer; - Name->NameLength = wcslen(&DriveInfo->SymLinkBuffer[0]) * sizeof(WCHAR); + Name->NameLength = wcslen(&DriveInfo->DeviceNameBuffer[0]) * sizeof(WCHAR); - if (OutputLength < sizeof(USHORT) + Name->NameLength) { + if(OutputLength < FIELD_OFFSET(MOUNTDEV_NAME, Name) + Name->NameLength) + { Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME); break; } - RtlCopyMemory(Name->Name, &DriveInfo->SymLinkBuffer[0], + RtlCopyMemory(Name->Name, &DriveInfo->DeviceNameBuffer[0], Name->NameLength); Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = sizeof(USHORT) + Name->NameLength; + Irp->IoStatus.Information = FIELD_OFFSET(MOUNTDEV_NAME, Name) + Name->NameLength; break; default:
5 years, 1 month
1
0
0
0
[reactos] 01/01: [CMAKE] Use modules instead of shared libraries
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e13381781102457016ddf…
commit e13381781102457016ddf71e6f0e6b86c4df71b7 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Mon Oct 21 17:14:25 2019 +0200 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Sun Oct 27 09:51:28 2019 +0100 [CMAKE] Use modules instead of shared libraries Follow-up to 23373acbb9b5356422657fa8448d2a18270847e2. 2 missed cases: apisets, lunar.msstyles. 4 new cases: w32time, netplwiz, msxml3r, mizu.msstyles. --- base/services/w32time/CMakeLists.txt | 2 +- dll/apisets/CMakeLists.txt.in | 2 +- dll/shellext/netplwiz/CMakeLists.txt | 2 +- dll/win32/msxml3r/CMakeLists.txt | 2 +- media/themes/Lunar/lunar.msstyles/CMakeLists.txt | 2 +- media/themes/Mizu/mizu.msstyles/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/base/services/w32time/CMakeLists.txt b/base/services/w32time/CMakeLists.txt index 5cc5a3b6e1a..080d1fd3e18 100644 --- a/base/services/w32time/CMakeLists.txt +++ b/base/services/w32time/CMakeLists.txt @@ -1,7 +1,7 @@ spec2def(w32time.dll w32time.spec ADD_IMPORTLIB) -add_library(w32time SHARED +add_library(w32time MODULE w32time.c ntpclient.c ${CMAKE_CURRENT_BINARY_DIR}/w32time.def) diff --git a/dll/apisets/CMakeLists.txt.in b/dll/apisets/CMakeLists.txt.in index 6d127583ced..1a12f9e89aa 100644 --- a/dll/apisets/CMakeLists.txt.in +++ b/dll/apisets/CMakeLists.txt.in @@ -17,7 +17,7 @@ function (add_apiset apiset_name baseaddress) -D_WCTYPE_DEFINED -D_CRT_ERRNO_DEFINED) - add_library(${apiset_name} SHARED + add_library(${apiset_name} MODULE ${CMAKE_CURRENT_BINARY_DIR}/${apiset_name}_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/${apiset_name}.def) diff --git a/dll/shellext/netplwiz/CMakeLists.txt b/dll/shellext/netplwiz/CMakeLists.txt index 7d1fc15dc2f..bc90da93a37 100644 --- a/dll/shellext/netplwiz/CMakeLists.txt +++ b/dll/shellext/netplwiz/CMakeLists.txt @@ -5,7 +5,7 @@ list(APPEND SOURCE netplwiz.c SHDisconnectNetDrives.c) -add_library(netplwiz SHARED +add_library(netplwiz MODULE ${SOURCE} netplwiz.rc ${CMAKE_CURRENT_BINARY_DIR}/netplwiz_stubs.c diff --git a/dll/win32/msxml3r/CMakeLists.txt b/dll/win32/msxml3r/CMakeLists.txt index 7589115fd0f..eab0a587596 100644 --- a/dll/win32/msxml3r/CMakeLists.txt +++ b/dll/win32/msxml3r/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(msxml3r SHARED msxml3r.rc) +add_library(msxml3r MODULE msxml3r.rc) set_module_type(msxml3r win32dll ENTRYPOINT 0) add_cd_file(TARGET msxml3r DESTINATION reactos/system32 FOR all) diff --git a/media/themes/Lunar/lunar.msstyles/CMakeLists.txt b/media/themes/Lunar/lunar.msstyles/CMakeLists.txt index 83c5e0be56c..72d1b86d37f 100644 --- a/media/themes/Lunar/lunar.msstyles/CMakeLists.txt +++ b/media/themes/Lunar/lunar.msstyles/CMakeLists.txt @@ -18,7 +18,7 @@ foreach(_file ${TEXTFILES}) endforeach() set_source_files_properties(lunar.rc PROPERTIES OBJECT_DEPENDS "${_converted_files}") -add_library(lunar.msstyles SHARED lunar.rc) +add_library(lunar.msstyles MODULE lunar.rc) set_module_type(lunar.msstyles module) set_target_properties(lunar.msstyles PROPERTIES SUFFIX "") add_cd_file(TARGET lunar.msstyles DESTINATION reactos/Resources/Themes/Lunar FOR all) diff --git a/media/themes/Mizu/mizu.msstyles/CMakeLists.txt b/media/themes/Mizu/mizu.msstyles/CMakeLists.txt index 8629386696d..51f65c31bd2 100644 --- a/media/themes/Mizu/mizu.msstyles/CMakeLists.txt +++ b/media/themes/Mizu/mizu.msstyles/CMakeLists.txt @@ -18,7 +18,7 @@ foreach(_file ${TEXTFILES}) endforeach() set_source_files_properties(mizu.rc PROPERTIES OBJECT_DEPENDS "${_converted_files}") -add_library(mizu.msstyles SHARED mizu.rc) +add_library(mizu.msstyles MODULE mizu.rc) set_module_type(mizu.msstyles module) set_target_properties(mizu.msstyles PROPERTIES SUFFIX "") add_cd_file(TARGET mizu.msstyles DESTINATION reactos/Resources/Themes/Mizu FOR all)
5 years, 1 month
1
0
0
0
[reactos] 01/01: [D3D8][D3D9][DDRAW][WINED3D] Use modules instead of shared libraries
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cef6a5b69183b952c2044…
commit cef6a5b69183b952c2044e37d2ebc038ce6fc877 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Mon Oct 21 00:38:24 2019 +0200 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Sun Oct 27 09:50:38 2019 +0100 [D3D8][D3D9][DDRAW][WINED3D] Use modules instead of shared libraries This reverts part of (revert) commit 81cffd7658765be610e53bcd9489a3d73597e5eb, so restores 23373acbb9b5356422657fa8448d2a18270847e2. --- dll/directx/wine/d3d8/CMakeLists.txt | 2 +- dll/directx/wine/d3d9/CMakeLists.txt | 2 +- dll/directx/wine/ddraw/CMakeLists.txt | 2 +- dll/directx/wine/wined3d/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dll/directx/wine/d3d8/CMakeLists.txt b/dll/directx/wine/d3d8/CMakeLists.txt index 09d7a6c659d..d3d49e2e76d 100644 --- a/dll/directx/wine/d3d8/CMakeLists.txt +++ b/dll/directx/wine/d3d8/CMakeLists.txt @@ -19,7 +19,7 @@ list(APPEND SOURCE volume.c precomp.h) -add_library(d3d8 SHARED +add_library(d3d8 MODULE ${SOURCE} guid.c version.rc diff --git a/dll/directx/wine/d3d9/CMakeLists.txt b/dll/directx/wine/d3d9/CMakeLists.txt index 223606b87ee..14dd3e65320 100644 --- a/dll/directx/wine/d3d9/CMakeLists.txt +++ b/dll/directx/wine/d3d9/CMakeLists.txt @@ -21,7 +21,7 @@ list(APPEND SOURCE volume.c precomp.h) -add_library(d3d9 SHARED +add_library(d3d9 MODULE ${SOURCE} guid.c version.rc diff --git a/dll/directx/wine/ddraw/CMakeLists.txt b/dll/directx/wine/ddraw/CMakeLists.txt index 6141d630f3f..03029bdc8f9 100644 --- a/dll/directx/wine/ddraw/CMakeLists.txt +++ b/dll/directx/wine/ddraw/CMakeLists.txt @@ -29,7 +29,7 @@ if(MSVC) set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "/FIwine/typeof.h") endif() -add_library(ddraw SHARED +add_library(ddraw MODULE ${SOURCE} ddraw.rc ${CMAKE_CURRENT_BINARY_DIR}/ddraw.def) diff --git a/dll/directx/wine/wined3d/CMakeLists.txt b/dll/directx/wine/wined3d/CMakeLists.txt index 235adab9027..29b337e3bd1 100644 --- a/dll/directx/wine/wined3d/CMakeLists.txt +++ b/dll/directx/wine/wined3d/CMakeLists.txt @@ -41,7 +41,7 @@ list(APPEND SOURCE wined3d_main.c precomp.h) -add_library(d3dwine SHARED +add_library(d3dwine MODULE ${SOURCE} version.rc ${CMAKE_CURRENT_BINARY_DIR}/d3dwine.def)
5 years, 1 month
1
0
0
0
[reactos] 01/01: [IPCONFIG] Revert changes that were not meant to be published yet
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f63310b056036fac229e3…
commit f63310b056036fac229e34afb47808ff70811c1c Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Oct 27 09:33:27 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Oct 27 09:33:27 2019 +0100 [IPCONFIG] Revert changes that were not meant to be published yet --- base/applications/network/ipconfig/ipconfig.c | 157 +++++++++++--------------- 1 file changed, 65 insertions(+), 92 deletions(-) diff --git a/base/applications/network/ipconfig/ipconfig.c b/base/applications/network/ipconfig/ipconfig.c index fdebdb1d8b4..1b15e3f5369 100644 --- a/base/applications/network/ipconfig/ipconfig.c +++ b/base/applications/network/ipconfig/ipconfig.c @@ -34,59 +34,6 @@ HINSTANCE hInstance; HANDLE ProcessHeap; -BOOL -DoNamesMatch( - _In_ LPWSTR pszName, - _In_ LPTSTR pszPattern) -{ - if (pszPattern == NULL) - return TRUE; - -// if (_wcsicmp(pszName, pszPattern) == 0) -// return TRUE; -#if 0 - for (;;) - { - if (*pszPattern == L'*') - { - pszPattern++; - if (*pszPattern == L'\0') - return TRUE; - - while (towlower(*pszName) != towlower(*pszPattern)) - { - if (*pszName == L'\0') - return FALSE; - - pszName++; - } - } - else if (*pszPattern == L'?') - { - pszPattern++; - - if (*pszName == L'\0') - return FALSE; - - pszName++; - } - else - { - if (*pszName == L'\0' && *pszPattern == L'\0') - return TRUE; - - if (towlower(*pszName) != towlower(*pszPattern)) - return FALSE; - - pszName++; - pszPattern++; - } - } -#endif - - return FALSE; -} - int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, @@ -660,20 +607,22 @@ VOID Release(LPTSTR Index) IP_ADAPTER_INDEX_MAP AdapterInfo; DWORD ret; DWORD i; - PIP_INTERFACE_INFO pInfo = NULL; - ULONG ulOutBufLen = 0; - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + /* if interface is not given, query GetInterfaceInfo */ + if (Index == NULL) { - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); - if (pInfo == NULL) - return; + PIP_INTERFACE_INFO pInfo = NULL; + ULONG ulOutBufLen = 0; - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR ) + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) { - for (i = 0; i < pInfo->NumAdapters; i++) + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); + if (pInfo == NULL) + return; + + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR ) { - if (DoNamesMatch(pInfo->Adapter[i].Name, Index)) + for (i = 0; i < pInfo->NumAdapters; i++) { CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP)); _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name); @@ -685,57 +634,71 @@ VOID Release(LPTSTR Index) DoFormatMessage(ret); } } - } - HeapFree(ProcessHeap, 0, pInfo); + HeapFree(ProcessHeap, 0, pInfo); + } + else + { + DoFormatMessage(0); + HeapFree(ProcessHeap, 0, pInfo); + return; + } } else { DoFormatMessage(0); - HeapFree(ProcessHeap, 0, pInfo); return; } } else { - DoFormatMessage(0); - return; + ; + /* FIXME: + * we need to be able to release connections by name with support for globbing + * i.e. ipconfig /release Eth* will release all cards starting with Eth... + * ipconfig /release *con* will release all cards with 'con' in their name + */ } } + + + VOID Renew(LPTSTR Index) { IP_ADAPTER_INDEX_MAP AdapterInfo; - PIP_INTERFACE_INFO pInfo; - ULONG ulOutBufLen = 0; DWORD i; - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, sizeof(IP_INTERFACE_INFO)); - if (pInfo == NULL) + /* if interface is not given, query GetInterfaceInfo */ + if (Index == NULL) { - _tprintf(_T("memory allocation error")); - return; - } + PIP_INTERFACE_INFO pInfo; + ULONG ulOutBufLen = 0; - /* Make an initial call to GetInterfaceInfo to get - * the necessary size into the ulOutBufLen variable */ - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) - { - HeapFree(ProcessHeap, 0, pInfo); - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, sizeof(IP_INTERFACE_INFO)); if (pInfo == NULL) { _tprintf(_T("memory allocation error")); return; } - } - /* Make a second call to GetInterfaceInfo to get the actual data we want */ - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR) - { - for (i = 0; i < pInfo->NumAdapters; i++) + /* Make an initial call to GetInterfaceInfo to get + * the necessary size into the ulOutBufLen variable */ + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) { - if (DoNamesMatch(pInfo->Adapter[i].Name, Index)) + HeapFree(ProcessHeap, 0, pInfo); + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); + if (pInfo == NULL) + { + _tprintf(_T("memory allocation error")); + return; + } + } + + /* Make a second call to GetInterfaceInfo to get the actual data we want */ + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR) + { + for (i = 0; i < pInfo->NumAdapters; i++) { CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP)); _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name); @@ -748,14 +711,23 @@ VOID Renew(LPTSTR Index) } } } + else + { + _tprintf(_T("\nGetInterfaceInfo failed : ")); + DoFormatMessage(0); + } + + HeapFree(ProcessHeap, 0, pInfo); } else { - _tprintf(_T("\nGetInterfaceInfo failed : ")); - DoFormatMessage(0); + ; + /* FIXME: + * we need to be able to renew connections by name with support for globbing + * i.e. ipconfig /renew Eth* will renew all cards starting with Eth... + * ipconfig /renew *con* will renew all cards with 'con' in their name + */ } - - HeapFree(ProcessHeap, 0, pInfo); } VOID @@ -1018,9 +990,10 @@ int main(int argc, char *argv[]) break; case 3: /* Process all the options that can have 1 parameter */ if (DoRelease) - Release(argv[2]); + _tprintf(_T("\nSorry /release [adapter] is not implemented yet\n")); + //Release(argv[2]); else if (DoRenew) - Renew(argv[2]); + _tprintf(_T("\nSorry /renew [adapter] is not implemented yet\n")); else if (DoShowclassid) _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n")); else if (DoSetclassid)
5 years, 1 month
1
0
0
0
[reactos] 01/01: [IPCONFIG][DNSAPI][SDK] Renamed DNSCACHEENTRY and fixed its type field(s)
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=789edebfac79fd9da5c74…
commit 789edebfac79fd9da5c74afb17917bfda01b6d55 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Oct 27 08:35:03 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Oct 27 08:35:03 2019 +0100 [IPCONFIG][DNSAPI][SDK] Renamed DNSCACHEENTRY and fixed its type field(s) Now, 'ipconfig /displaydns' displays A- and AAAA-records correctly. --- base/applications/network/ipconfig/ipconfig.c | 344 +++++++++++++++----------- dll/win32/dnsapi/dnsapi/stubs.c | 2 +- sdk/include/reactos/windns_undoc.h | 8 +- 3 files changed, 198 insertions(+), 156 deletions(-) diff --git a/base/applications/network/ipconfig/ipconfig.c b/base/applications/network/ipconfig/ipconfig.c index ced1de7072d..fdebdb1d8b4 100644 --- a/base/applications/network/ipconfig/ipconfig.c +++ b/base/applications/network/ipconfig/ipconfig.c @@ -34,6 +34,59 @@ HINSTANCE hInstance; HANDLE ProcessHeap; +BOOL +DoNamesMatch( + _In_ LPWSTR pszName, + _In_ LPTSTR pszPattern) +{ + if (pszPattern == NULL) + return TRUE; + +// if (_wcsicmp(pszName, pszPattern) == 0) +// return TRUE; +#if 0 + for (;;) + { + if (*pszPattern == L'*') + { + pszPattern++; + if (*pszPattern == L'\0') + return TRUE; + + while (towlower(*pszName) != towlower(*pszPattern)) + { + if (*pszName == L'\0') + return FALSE; + + pszName++; + } + } + else if (*pszPattern == L'?') + { + pszPattern++; + + if (*pszName == L'\0') + return FALSE; + + pszName++; + } + else + { + if (*pszName == L'\0' && *pszPattern == L'\0') + return TRUE; + + if (towlower(*pszName) != towlower(*pszPattern)) + return FALSE; + + pszName++; + pszPattern++; + } + } +#endif + + return FALSE; +} + int LoadStringAndOem(HINSTANCE hInst, UINT uID, LPTSTR szNode, @@ -607,22 +660,20 @@ VOID Release(LPTSTR Index) IP_ADAPTER_INDEX_MAP AdapterInfo; DWORD ret; DWORD i; + PIP_INTERFACE_INFO pInfo = NULL; + ULONG ulOutBufLen = 0; - /* if interface is not given, query GetInterfaceInfo */ - if (Index == NULL) + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) { - PIP_INTERFACE_INFO pInfo = NULL; - ULONG ulOutBufLen = 0; + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); + if (pInfo == NULL) + return; - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR ) { - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); - if (pInfo == NULL) - return; - - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR ) + for (i = 0; i < pInfo->NumAdapters; i++) { - for (i = 0; i < pInfo->NumAdapters; i++) + if (DoNamesMatch(pInfo->Adapter[i].Name, Index)) { CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP)); _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name); @@ -634,71 +685,57 @@ VOID Release(LPTSTR Index) DoFormatMessage(ret); } } - - HeapFree(ProcessHeap, 0, pInfo); - } - else - { - DoFormatMessage(0); - HeapFree(ProcessHeap, 0, pInfo); - return; } + + HeapFree(ProcessHeap, 0, pInfo); } else { DoFormatMessage(0); + HeapFree(ProcessHeap, 0, pInfo); return; } } else { - ; - /* FIXME: - * we need to be able to release connections by name with support for globbing - * i.e. ipconfig /release Eth* will release all cards starting with Eth... - * ipconfig /release *con* will release all cards with 'con' in their name - */ + DoFormatMessage(0); + return; } } - - - VOID Renew(LPTSTR Index) { IP_ADAPTER_INDEX_MAP AdapterInfo; + PIP_INTERFACE_INFO pInfo; + ULONG ulOutBufLen = 0; DWORD i; - /* if interface is not given, query GetInterfaceInfo */ - if (Index == NULL) + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, sizeof(IP_INTERFACE_INFO)); + if (pInfo == NULL) { - PIP_INTERFACE_INFO pInfo; - ULONG ulOutBufLen = 0; + _tprintf(_T("memory allocation error")); + return; + } - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, sizeof(IP_INTERFACE_INFO)); + /* Make an initial call to GetInterfaceInfo to get + * the necessary size into the ulOutBufLen variable */ + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) + { + HeapFree(ProcessHeap, 0, pInfo); + pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); if (pInfo == NULL) { _tprintf(_T("memory allocation error")); return; } + } - /* Make an initial call to GetInterfaceInfo to get - * the necessary size into the ulOutBufLen variable */ - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER) - { - HeapFree(ProcessHeap, 0, pInfo); - pInfo = (IP_INTERFACE_INFO *)HeapAlloc(ProcessHeap, 0, ulOutBufLen); - if (pInfo == NULL) - { - _tprintf(_T("memory allocation error")); - return; - } - } - - /* Make a second call to GetInterfaceInfo to get the actual data we want */ - if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR) + /* Make a second call to GetInterfaceInfo to get the actual data we want */ + if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR) + { + for (i = 0; i < pInfo->NumAdapters; i++) { - for (i = 0; i < pInfo->NumAdapters; i++) + if (DoNamesMatch(pInfo->Adapter[i].Name, Index)) { CopyMemory(&AdapterInfo, &pInfo->Adapter[i], sizeof(IP_ADAPTER_INDEX_MAP)); _tprintf(_T("name - %ls\n"), pInfo->Adapter[i].Name); @@ -711,23 +748,14 @@ VOID Renew(LPTSTR Index) } } } - else - { - _tprintf(_T("\nGetInterfaceInfo failed : ")); - DoFormatMessage(0); - } - - HeapFree(ProcessHeap, 0, pInfo); } else { - ; - /* FIXME: - * we need to be able to renew connections by name with support for globbing - * i.e. ipconfig /renew Eth* will renew all cards starting with Eth... - * ipconfig /renew *con* will renew all cards with 'con' in their name - */ + _tprintf(_T("\nGetInterfaceInfo failed : ")); + DoFormatMessage(0); } + + HeapFree(ProcessHeap, 0, pInfo); } VOID @@ -741,113 +769,130 @@ FlushDns(VOID) DoFormatMessage(GetLastError()); } + +static VOID -DisplayDns(VOID) +DisplayDnsRecord( + PWSTR pszName, + WORD wType) { - PDNSCACHEENTRY DnsEntry = NULL, pThisEntry, pNextEntry; - PDNS_RECORDW pQueryResults, pThisRecord, pNextRecord; + PDNS_RECORDW pQueryResults = NULL, pThisRecord, pNextRecord; + WCHAR szBuffer[48]; IN_ADDR Addr4; IN6_ADDR Addr6; - WCHAR szBuffer[48]; DNS_STATUS Status; - _tprintf(_T("\nReactOS IP Configuration\n\n")); - - if (!DnsGetCacheDataTable(&DnsEntry)) + pQueryResults = NULL; + Status = DnsQuery_W(pszName, + wType, + DNS_QUERY_NO_WIRE_QUERY, + NULL, + (PDNS_RECORD *)&pQueryResults, + NULL); + if (Status != ERROR_SUCCESS) { - DoFormatMessage(GetLastError()); +#if 0 + if (wType != 0) + { + _tprintf(_T("\t%S\n"), pszName); + _tprintf(_T("\t----------------------------------------\n")); + _tprintf(_T("\tNo records of type %hu\n\n"), wType); + } +#endif return; } - if (DnsEntry == NULL) - return; + _tprintf(_T("\t%S\n"), pszName); + _tprintf(_T("\t----------------------------------------\n")); - pThisEntry = DnsEntry; - while (pThisEntry != NULL) + pThisRecord = pQueryResults; + while (pThisRecord != NULL) { - pNextEntry = pThisEntry->pNext; + pNextRecord = pThisRecord->pNext; - pQueryResults = NULL; - Status = DnsQuery_W(pThisEntry->pszName, - pThisEntry->wType, - DNS_QUERY_NO_WIRE_QUERY, - NULL, - (PDNS_RECORD *)&pQueryResults, - NULL); - if (Status == 0) + _tprintf(_T("\tRecord Name . . . . . : %S\n"), pThisRecord->pName); + _tprintf(_T("\tRecord Type . . . . . : %hu\n"), pThisRecord->wType); + _tprintf(_T("\tTime To Live. . . . . : %lu\n"), pThisRecord->dwTtl); + _tprintf(_T("\tData Length . . . . . : %hu\n"), pThisRecord->wDataLength); + + switch (pThisRecord->Flags.S.Section) { - _tprintf(_T("\t%S\n"), pThisEntry->pszName); - _tprintf(_T("\t----------------------------------------\n")); + case DnsSectionQuestion: + _tprintf(_T("\tSection . . . . . . . : Question\n")); + break; - pThisRecord = pQueryResults; - while (pThisRecord != NULL) - { - pNextRecord = pThisRecord->pNext; + case DnsSectionAnswer: + _tprintf(_T("\tSection . . . . . . . : Answer\n")); + break; - _tprintf(_T("\tRecord Name . . . . . : %S\n"), pThisRecord->pName); - _tprintf(_T("\tRecord Type . . . . . : %hu\n"), pThisRecord->wType); - _tprintf(_T("\tTime To Live. . . . . : %lu\n"), pThisRecord->dwTtl); - _tprintf(_T("\tData Length . . . . . : %hu\n"), pThisRecord->wDataLength); + case DnsSectionAuthority: + _tprintf(_T("\tSection . . . . . . . : Authority\n")); + break; - switch (pThisRecord->Flags.S.Section) - { - case DnsSectionQuestion: - _tprintf(_T("\tSection . . . . . . . : Question\n")); - break; + case DnsSectionAdditional: + _tprintf(_T("\tSection . . . . . . . : Additional\n")); + break; + } - case DnsSectionAnswer: - _tprintf(_T("\tSection . . . . . . . : Answer\n")); - break; + switch (pThisRecord->wType) + { + case DNS_TYPE_A: + Addr4.S_un.S_addr = pThisRecord->Data.A.IpAddress; + RtlIpv4AddressToStringW(&Addr4, szBuffer); + _tprintf(_T("\tA (Host) Record . . . : %S\n"), szBuffer); + break; + + case DNS_TYPE_PTR: + _tprintf(_T("\tPTR Record. . . . . . : %S\n"), pThisRecord->Data.PTR.pNameHost); + break; + + case DNS_TYPE_NS: + _tprintf(_T("\tNS Record . . . . . . : %S\n"), pThisRecord->Data.NS.pNameHost); + break; + + case DNS_TYPE_CNAME: + _tprintf(_T("\tCNAME Record. . . . . : %S\n"), pThisRecord->Data.CNAME.pNameHost); + break; + + case DNS_TYPE_AAAA: + RtlCopyMemory(&Addr6, &pThisRecord->Data.AAAA.Ip6Address, sizeof(IN6_ADDR)); + RtlIpv6AddressToStringW(&Addr6, szBuffer); + _tprintf(_T("\tAAAA Record . . . . . : %S\n"), szBuffer); + break; + } + _tprintf(_T("\n\n")); - case DnsSectionAuthority: - _tprintf(_T("\tSection . . . . . . . : Authority\n")); - break; + pThisRecord = pNextRecord; + } - case DnsSectionAdditional: - _tprintf(_T("\tSection . . . . . . . : Additional\n")); - break; - } + DnsRecordListFree((PDNS_RECORD)pQueryResults, DnsFreeRecordList); +} - switch (pThisRecord->wType) - { - case DNS_TYPE_A: - Addr4.S_un.S_addr = pThisRecord->Data.A.IpAddress; - RtlIpv4AddressToStringW(&Addr4, szBuffer); - _tprintf(_T("\tA (Host) Record . . . : %S\n"), szBuffer); - break; - - case DNS_TYPE_PTR: - _tprintf(_T("\tPTR Record. . . . . . : %S\n"), pThisRecord->Data.PTR.pNameHost); - break; - - case DNS_TYPE_NS: - _tprintf(_T("\tNS Record . . . . . . : %S\n"), pThisRecord->Data.NS.pNameHost); - break; - - case DNS_TYPE_CNAME: - _tprintf(_T("\tCNAME Record. . . . . : %S\n"), pThisRecord->Data.CNAME.pNameHost); - break; - - case DNS_TYPE_AAAA: - RtlCopyMemory(&Addr6, &pThisRecord->Data.AAAA.Ip6Address, sizeof(IN6_ADDR)); - RtlIpv6AddressToStringW(&Addr6, szBuffer); - _tprintf(_T("\tAAAA Record . . . . . : %S\n"), szBuffer); - break; - } - _tprintf(_T("\n\n")); - pThisRecord = pNextRecord; - } +VOID +DisplayDns(VOID) +{ + PDNS_CACHE_ENTRY DnsEntry = NULL, pThisEntry, pNextEntry; - DnsRecordListFree((PDNS_RECORD)pQueryResults, DnsFreeRecordList); - pQueryResults = NULL; - } - else if (Status != ERROR_SUCCESS && pThisEntry->wType != 0) - { - _tprintf(_T("\t%S\n"), pThisEntry->pszName); - _tprintf(_T("\t----------------------------------------\n")); - _tprintf(_T("\tNo records of type %hu\n\n"), pThisEntry->wType); - } + _tprintf(_T("\nReactOS IP Configuration\n\n")); + + if (!DnsGetCacheDataTable(&DnsEntry)) + { + DoFormatMessage(GetLastError()); + return; + } + + if (DnsEntry == NULL) + return; + + pThisEntry = DnsEntry; + while (pThisEntry != NULL) + { + pNextEntry = pThisEntry->pNext; + + DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType1); + if (pThisEntry->wType2 != 0) + DisplayDnsRecord(pThisEntry->pszName, pThisEntry->wType2); if (pThisEntry->pszName) LocalFree(pThisEntry->pszName); @@ -890,8 +935,6 @@ VOID Usage(VOID) HeapFree(ProcessHeap, 0, lpUsage); } } - - } int main(int argc, char *argv[]) @@ -975,10 +1018,9 @@ int main(int argc, char *argv[]) break; case 3: /* Process all the options that can have 1 parameter */ if (DoRelease) - _tprintf(_T("\nSorry /release [adapter] is not implemented yet\n")); - //Release(argv[2]); + Release(argv[2]); else if (DoRenew) - _tprintf(_T("\nSorry /renew [adapter] is not implemented yet\n")); + Renew(argv[2]); else if (DoShowclassid) _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n")); else if (DoSetclassid) diff --git a/dll/win32/dnsapi/dnsapi/stubs.c b/dll/win32/dnsapi/dnsapi/stubs.c index 76bb1ef63c5..2832270d36b 100644 --- a/dll/win32/dnsapi/dnsapi/stubs.c +++ b/dll/win32/dnsapi/dnsapi/stubs.c @@ -276,7 +276,7 @@ DnsGetBufferLengthForStringCopy() BOOL WINAPI DnsGetCacheDataTable( - _Out_ PDNSCACHEENTRY *DnsCache) + _Out_ PDNS_CACHE_ENTRY *DnsCache) { UNIMPLEMENTED; return TRUE; diff --git a/sdk/include/reactos/windns_undoc.h b/sdk/include/reactos/windns_undoc.h index af04fabb2c3..3af80a1dfc5 100644 --- a/sdk/include/reactos/windns_undoc.h +++ b/sdk/include/reactos/windns_undoc.h @@ -9,10 +9,10 @@ typedef struct _DNS_CACHE_ENTRY { struct _DNS_CACHE_ENTRY *pNext; /* Pointer to next entry */ PWSTR pszName; /* DNS Record Name */ - unsigned short wType; /* DNS Record Type */ - unsigned short wUnknown; /* Unknown */ + unsigned short wType1; /* DNS Record Type 1 */ + unsigned short wType2; /* DNS Record Type 2 */ unsigned short wFlags; /* DNS Record Flags */ -} DNSCACHEENTRY, *PDNSCACHEENTRY; +} DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY; BOOL WINAPI @@ -21,7 +21,7 @@ DnsFlushResolverCache(VOID); BOOL WINAPI DnsGetCacheDataTable( - _Out_ PDNSCACHEENTRY *DnsCache); + _Out_ PDNS_CACHE_ENTRY *DnsCache); #ifdef __cplusplus }
5 years, 1 month
1
0
0
0
[reactos] 01/01: [NTOS:MM] Add debug print to MiAllocateContiguousMemory in out-of-memory case
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9bf672d4f13baf5230002…
commit 9bf672d4f13baf52300021a0074358c5c52e2f6a Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Fri Oct 4 15:22:27 2019 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Oct 27 06:32:50 2019 +0100 [NTOS:MM] Add debug print to MiAllocateContiguousMemory in out-of-memory case --- ntoskrnl/mm/ARM3/contmem.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/mm/ARM3/contmem.c b/ntoskrnl/mm/ARM3/contmem.c index 506f988b81f..e8895b0a2fe 100644 --- a/ntoskrnl/mm/ARM3/contmem.c +++ b/ntoskrnl/mm/ARM3/contmem.c @@ -444,11 +444,16 @@ MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes, // // Otherwise, we'll go try to find some // - return MiFindContiguousMemory(LowestAcceptablePfn, - HighestAcceptablePfn, - BoundaryPfn, - SizeInPages, - CacheType); + BaseAddress = MiFindContiguousMemory(LowestAcceptablePfn, + HighestAcceptablePfn, + BoundaryPfn, + SizeInPages, + CacheType); + if (!BaseAddress) + { + DPRINT1("Unable to allocate contiguous memory for %d bytes (%d pages), out of memory!\n", NumberOfBytes, SizeInPages); + } + return BaseAddress; } VOID
5 years, 1 month
1
0
0
0
[reactos] 01/01: [COMDLG32] Improve some header inclusions.
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0c64ffd3ab82e1980313a…
commit 0c64ffd3ab82e1980313a9a7cee3ab41595897bf Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Oct 26 23:11:08 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Oct 26 23:11:08 2019 +0100 [COMDLG32] Improve some header inclusions. --- dll/win32/comdlg32/filedlg.c | 3 +++ dll/win32/comdlg32/precomp.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/win32/comdlg32/filedlg.c b/dll/win32/comdlg32/filedlg.c index d82cdf3daf6..1c05df91c22 100644 --- a/dll/win32/comdlg32/filedlg.c +++ b/dll/win32/comdlg32/filedlg.c @@ -77,6 +77,9 @@ #include "wine/debug.h" #include "wine/heap.h" +#ifdef __REACTOS__ +#include "wine/unicode.h" +#endif WINE_DEFAULT_DEBUG_CHANNEL(commdlg); diff --git a/dll/win32/comdlg32/precomp.h b/dll/win32/comdlg32/precomp.h index c108058ff17..819aa101548 100644 --- a/dll/win32/comdlg32/precomp.h +++ b/dll/win32/comdlg32/precomp.h @@ -2,8 +2,6 @@ #ifndef _WINE_COMDLG32_PRECOMP_H #define _WINE_COMDLG32_PRECOMP_H -#include <wine/config.h> - #include <stdio.h> #define WIN32_NO_STATUS @@ -33,7 +31,6 @@ #include <shlwapi.h> #include <wine/heap.h> -#include <wine/unicode.h> #include <wine/debug.h> #include "cdlg.h"
5 years, 1 month
1
0
0
0
[reactos] 01/01: [HID_WINETEST] Sync with Wine Staging 4.18. CORE-16441
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6291990483dc78380036f…
commit 6291990483dc78380036fffa4b9d4f7afd8ba819 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Oct 26 22:57:25 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Oct 26 22:57:25 2019 +0100 [HID_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/hid/device.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/hid/device.c b/modules/rostests/winetests/hid/device.c index f20677fb1b4..bb819cc83f2 100644 --- a/modules/rostests/winetests/hid/device.c +++ b/modules/rostests/winetests/hid/device.c @@ -34,6 +34,7 @@ static void test_device_info(HANDLE device) { PHIDP_PREPARSED_DATA ppd; HIDP_CAPS Caps; + HIDD_ATTRIBUTES attributes; NTSTATUS status; BOOL rc; WCHAR device_name[128]; @@ -47,6 +48,10 @@ static void test_device_info(HANDLE device) trace("Found device %s (%02x, %02x)\n", wine_dbgstr_w(device_name), Caps.UsagePage, Caps.Usage); rc = HidD_FreePreparsedData(ppd); ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError()); + rc = HidD_GetAttributes(device, &attributes); + ok(rc, "Failed to get device attributes (0x%x)\n", GetLastError()); + ok(attributes.Size == sizeof(attributes), "Unexpected HIDD_ATTRIBUTES size: %d\n", attributes.Size); + trace("Device attributes: vid:%04x pid:%04x ver:%04x\n", attributes.VendorID, attributes.ProductID, attributes.VersionNumber); } static void run_for_each_device(device_test *test) @@ -79,10 +84,17 @@ static void run_for_each_device(device_test *test) trace("Not enough permissions to read device %s.\n", wine_dbgstr_w(data->DevicePath)); continue; } + if (file == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION) + { + trace("Device is busy: %s.\n", wine_dbgstr_w(data->DevicePath)); + continue; + } + ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u.\n", wine_dbgstr_w(data->DevicePath), GetLastError()); - test(file); + if (file != INVALID_HANDLE_VALUE) + test(file); CloseHandle(file); }
5 years, 1 month
1
0
0
0
← Newer
1
2
3
4
5
...
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200