Author: akhaldi
Date: Sun Sep 17 12:34:03 2017
New Revision: 75870
URL:
http://svn.reactos.org/svn/reactos?rev=75870&view=rev
Log:
[FUSION_WINETEST] Sync with Wine Staging 2.16. CORE-13762
Modified:
trunk/rostests/winetests/fusion/asmenum.c
trunk/rostests/winetests/fusion/asmname.c
Modified: trunk/rostests/winetests/fusion/asmenum.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/fusion/asmenum.…
==============================================================================
--- trunk/rostests/winetests/fusion/asmenum.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/fusion/asmenum.c [iso-8859-1] Sun Sep 17 12:34:03 2017
@@ -225,79 +225,80 @@
typedef struct _tagASMNAME
{
struct list entry;
- LPSTR data;
+ char data[1];
} ASMNAME;
-static BOOL enum_gac_assemblies(struct list *assemblies, int depth, LPSTR path)
-{
+static void enum_gac_assembly_dirs(struct list *assemblies, const char *parent, char
path[MAX_PATH])
+{
+ static const char format[] = "%s, Version=%s, Culture=%s,
PublicKeyToken=%s";
WIN32_FIND_DATAA ffd;
- CHAR buf[MAX_PATH];
- CHAR disp[MAX_PATH];
ASMNAME *name;
HANDLE hfind;
- LPSTR ptr;
-
- static CHAR parent[MAX_PATH];
-
- sprintf(buf, "%s\\*", path);
- hfind = FindFirstFileA(buf, &ffd);
- if (hfind == INVALID_HANDLE_VALUE)
- return FALSE;
+ int len;
+ char *ptr, *end = path + strlen( path );
+
+ lstrcpynA( end, "\\*", path + MAX_PATH - end );
+ hfind = FindFirstFileA(path, &ffd);
+ if (hfind == INVALID_HANDLE_VALUE) return;
+ end++;
do
{
- if (!lstrcmpA(ffd.cFileName, ".") || !lstrcmpA(ffd.cFileName,
".."))
- continue;
-
- if (depth == 0)
+ char culture[MAX_PATH];
+
+ if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName,
"..")) continue;
+
+ *end = 0;
+ /* Directories with no dll or exe will not be enumerated */
+ snprintf(end, path + MAX_PATH - end, "%s\\%s.dll", ffd.cFileName,
parent);
+ if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)
{
- lstrcpyA(parent, ffd.cFileName);
+ snprintf(end, path + MAX_PATH - end, "%s\\%s.exe", ffd.cFileName,
parent);
+ if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES) continue;
}
- else if (depth == 1)
+
+ if (!(ptr = strchr(ffd.cFileName, '_'))) continue;
+ *ptr++ = 0;
+
+ if (*ptr != '_')
{
- char culture[MAX_PATH];
- char dll[MAX_PATH], exe[MAX_PATH];
-
- /* Directories with no dll or exe will not be enumerated */
- sprintf(dll, "%s\\%s\\%s.dll", path, ffd.cFileName, parent);
- sprintf(exe, "%s\\%s\\%s.exe", path, ffd.cFileName, parent);
- if (GetFileAttributesA(dll) == INVALID_FILE_ATTRIBUTES &&
- GetFileAttributesA(exe) == INVALID_FILE_ATTRIBUTES)
- continue;
-
- ptr = strstr(ffd.cFileName, "_");
- *ptr = '\0';
- ptr++;
-
- if (*ptr != '_')
- {
- lstrcpyA(culture, ptr);
- *strstr(culture, "_") = '\0';
- }
- else
- lstrcpyA(culture, "neutral");
-
- ptr = strchr(ptr, '_');
- ptr++;
- sprintf(buf, ", Version=%s, Culture=%s, PublicKeyToken=%s",
- ffd.cFileName, culture, ptr);
- lstrcpyA(disp, parent);
- lstrcatA(disp, buf);
-
- name = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME));
- name->data = HeapAlloc(GetProcessHeap(), 0, lstrlenA(disp) + 1);
- lstrcpyA(name->data, disp);
- list_add_tail(assemblies, &name->entry);
-
- continue;
+ lstrcpyA(culture, ptr);
+ *strchr(culture, '_') = 0;
}
-
- sprintf(buf, "%s\\%s", path, ffd.cFileName);
- enum_gac_assemblies(assemblies, depth + 1, buf);
+ else
+ lstrcpyA(culture, "neutral");
+
+ ptr = strchr(ptr, '_');
+ ptr++;
+ len = sizeof(format) + strlen(parent) + strlen(ffd.cFileName) + strlen(culture) +
strlen(ptr);
+
+ name = HeapAlloc(GetProcessHeap(), 0, offsetof( ASMNAME, data[len] ));
+ sprintf( name->data, format, parent, ffd.cFileName, culture, ptr);
+ list_add_tail(assemblies, &name->entry);
} while (FindNextFileA(hfind, &ffd) != 0);
FindClose(hfind);
- return TRUE;
+}
+
+static void enum_gac_assemblies(struct list *assemblies, char path[MAX_PATH])
+{
+ WIN32_FIND_DATAA ffd;
+ HANDLE hfind;
+ char *end = path + strlen( path );
+
+ lstrcpynA( end, "\\*", path + MAX_PATH - end );
+ hfind = FindFirstFileA(path, &ffd);
+ if (hfind == INVALID_HANDLE_VALUE) return;
+ end++;
+
+ do
+ {
+ if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName,
"..")) continue;
+ lstrcpynA( end, ffd.cFileName, path + MAX_PATH - end );
+ enum_gac_assembly_dirs( assemblies, ffd.cFileName, path );
+ } while (FindNextFileA(hfind, &ffd) != 0);
+
+ FindClose(hfind);
}
static void test_enumerate(void)
@@ -319,18 +320,18 @@
to_multibyte(path, buf);
lstrcatA(path, "_32");
- enum_gac_assemblies(&assemblies, 0, path);
+ enum_gac_assemblies(&assemblies, path);
to_multibyte(path, buf);
lstrcatA(path, "_64");
- enum_gac_assemblies(&assemblies, 0, path);
+ enum_gac_assemblies(&assemblies, path);
to_multibyte(path, buf);
lstrcatA(path, "_MSIL");
- enum_gac_assemblies(&assemblies, 0, path);
+ enum_gac_assemblies(&assemblies, path);
to_multibyte(path, buf);
- enum_gac_assemblies(&assemblies, 0, path);
+ enum_gac_assemblies(&assemblies, path);
asmenum = NULL;
hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL);
@@ -353,7 +354,6 @@
found = TRUE;
list_remove(&asmname->entry);
- HeapFree(GetProcessHeap(), 0, asmname->data);
HeapFree(GetProcessHeap(), 0, asmname);
break;
}
@@ -377,7 +377,6 @@
ok(FALSE, "Assembly not enumerated: %s\n", asmname->data);
list_remove(&asmname->entry);
- HeapFree(GetProcessHeap(), 0, asmname->data);
HeapFree(GetProcessHeap(), 0, asmname);
}
Modified: trunk/rostests/winetests/fusion/asmname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/fusion/asmname.…
==============================================================================
--- trunk/rostests/winetests/fusion/asmname.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/fusion/asmname.c [iso-8859-1] Sun Sep 17 12:34:03 2017
@@ -360,16 +360,14 @@
DWORD i, size;
WCHAR expect[MAX_PATH];
WCHAR str[MAX_PATH];
- CHAR val[MAX_PATH];
for (i = 0; i < ASM_NAME_MAX_PARAMS; i++)
{
to_widechar(expect, vals[i].val);
size = MAX_PATH;
- ZeroMemory(str, MAX_PATH);
+ memset( str, 0xcc, sizeof(str) );
hr = IAssemblyName_GetProperty(name, i, str, &size);
- to_multibyte(val, str);
ok(hr == vals[i].hr ||
broken(i >= ASM_NAME_CONFIG_MASK && hr == E_INVALIDARG) || /* .NET
1.1 */
@@ -377,11 +375,15 @@
"%d: prop %d: Expected %08x, got %08x\n", line, i, vals[i].hr, hr);
if (hr != E_INVALIDARG)
{
- if (i == ASM_NAME_PUBLIC_KEY_TOKEN)
- ok(!memcmp(vals[i].val, str, size), "Expected a correct
ASM_NAME_PUBLIC_KEY_TOKEN\n");
- else
- ok(!lstrcmpA(vals[i].val, val), "%d: prop %d: Expected
\"%s\", got \"%s\"\n", line, i, vals[i].val, val);
ok(size == vals[i].size, "%d: prop %d: Expected %d, got %d\n",
line, i, vals[i].size, size);
+ if (size && size != MAX_PATH)
+ {
+ if (i != ASM_NAME_NAME && i != ASM_NAME_CULTURE)
+ ok( !memcmp( vals[i].val, str, size ), "%d: prop %d: wrong
value\n", line, i );
+ else
+ ok( !lstrcmpW( expect, str ), "%d: prop %d: Expected %s, got
%s\n",
+ line, i, wine_dbgstr_w(expect), wine_dbgstr_w(str) );
+ }
}
}
}