Author: pschweitzer
Date: Sat Feb 20 15:56:49 2016
New Revision: 70759
URL:
http://svn.reactos.org/svn/reactos?rev=70759&view=rev
Log:
[NP_ENUM]
Add a test application that allows checking that currently network places enumeration is
broken in ReactOS
Added:
trunk/rostests/tests/np_enum/
trunk/rostests/tests/np_enum/CMakeLists.txt (with props)
trunk/rostests/tests/np_enum/np_enum.c (with props)
Added: trunk/rostests/tests/np_enum/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/np_enum/CMakeLists.…
==============================================================================
--- trunk/rostests/tests/np_enum/CMakeLists.txt (added)
+++ trunk/rostests/tests/np_enum/CMakeLists.txt [iso-8859-1] Sat Feb 20 15:56:49 2016
@@ -0,0 +1,4 @@
+add_executable(np_enum np_enum.c)
+set_module_type(np_enum win32cui UNICODE)
+add_importlibs(np_enum msvcrt kernel32 mpr)
+add_cd_file(TARGET np_enum DESTINATION reactos/bin FOR all)
Propchange: trunk/rostests/tests/np_enum/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/tests/np_enum/np_enum.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/np_enum/np_enum.c?r…
==============================================================================
--- trunk/rostests/tests/np_enum/np_enum.c (added)
+++ trunk/rostests/tests/np_enum/np_enum.c [iso-8859-1] Sat Feb 20 15:56:49 2016
@@ -0,0 +1,76 @@
+#include <windows.h>
+#include <stdio.h>
+
+DWORD debug_shift = 0;
+
+#define INC_SHIFT ++debug_shift;
+#define DEC_SHIFT --debug_shift;
+#define PRT_SHIFT do { DWORD cur = 0; for (; cur < debug_shift; ++cur)
printf("\t"); } while (0);
+
+void np_enum(NETRESOURCEW * resource)
+{
+ DWORD ret;
+ HANDLE handle;
+ DWORD size = 0x1000;
+ NETRESOURCEW * out;
+ BOOL check = FALSE;
+
+ if (resource && resource->lpRemoteName)
+ check = TRUE;
+
+ ret = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, resource, &handle);
+ if (ret != WN_SUCCESS)
+ return;
+
+ out = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+ if (!out)
+ {
+ WNetCloseEnum(handle);
+ return;
+ }
+
+ INC_SHIFT
+
+ if (check)
+ {
+ printf("Called with lpRemoteName not null, current value: %S\n",
resource->lpRemoteName);
+ }
+
+ do
+ {
+ DWORD count = -1;
+
+ ret = WNetEnumResource(handle, &count, out, &size);
+ if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
+ {
+ NETRESOURCEW * current;
+
+ current = out;
+ for (; count; count--)
+ {
+ PRT_SHIFT;
+ printf("lpRemoteName: %S\n", current->lpRemoteName);
+
+ if ((current->dwUsage & RESOURCEUSAGE_CONTAINER) ==
RESOURCEUSAGE_CONTAINER)
+ {
+ PRT_SHIFT;
+ printf("Found provider: %S\n", current->lpProvider);
+ np_enum(current);
+ }
+
+ current++;
+ }
+ }
+ } while (ret != WN_NO_MORE_ENTRIES);
+ DEC_SHIFT;
+
+ HeapFree(GetProcessHeap(), 0, out);
+ WNetCloseEnum(handle);
+}
+
+int wmain(int argc, const WCHAR *argv[])
+{
+ np_enum(NULL);
+
+ return 0;
+}
Propchange: trunk/rostests/tests/np_enum/np_enum.c
------------------------------------------------------------------------------
svn:eol-style = native