[ros-diffs] [gedmurphy] 34024: Add all modules within a test to the treeview

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Jun 19 13:57:14 CEST 2008


Author: gedmurphy
Date: Thu Jun 19 06:57:14 2008
New Revision: 34024

URL: http://svn.reactos.org/svn/reactos?rev=34024&view=rev
Log:
Add all modules within a test to the treeview

Modified:
    trunk/rostests/winetests/GUI/browsewnd.c
    trunk/rostests/winetests/GUI/misc.c
    trunk/rostests/winetests/GUI/precomp.h

Modified: trunk/rostests/winetests/GUI/browsewnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/GUI/browsewnd.c?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- trunk/rostests/winetests/GUI/browsewnd.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/GUI/browsewnd.c [iso-8859-1] Thu Jun 19 06:57:14 2008
@@ -14,6 +14,7 @@
 #define IL_TEST 1
 
 typedef wchar_t *(__cdecl *DLLNAME)();
+typedef int (_cdecl *MODULES)(char **);
 
 static INT
 GetNumberOfDllsInFolder(LPWSTR lpFolder)
@@ -135,6 +136,7 @@
     HTREEITEM hRoot;
     HIMAGELIST hImgList;
     DLLNAME GetTestName;
+    MODULES GetModulesInTest;
     HMODULE hDll;
     LPWSTR lpDllPath;
     LPWSTR lpTestName;
@@ -171,16 +173,47 @@
             GetTestName = (DLLNAME)GetProcAddress(hDll, "GetTestName");
             if (GetTestName)
             {
+                HTREEITEM hParent;
+                LPSTR lpModules, ptr;
+                LPWSTR lpModW;
+                INT numMods;
+
                 lpTestName = GetTestName();
 
-                InsertIntoTreeView(pInfo->hBrowseTV,
-                                   hRoot,
-                                   lpTestName,
-                                   lpDllPath,
-                                   IL_TEST);
-
-                // add individual tests as children
-
+                hParent = InsertIntoTreeView(pInfo->hBrowseTV,
+                                             hRoot,
+                                             lpTestName,
+                                             lpDllPath,
+                                             IL_TEST);
+
+                if (hParent)
+                {
+                    GetModulesInTest = (MODULES)GetProcAddress(hDll, "GetModulesInTest");
+                    if ((numMods = GetModulesInTest(&lpModules)))
+                    {
+                        ptr = lpModules;
+                        while (numMods && *ptr != '\0')
+                        {
+                            if (AnsiToUnicode(ptr, &lpModW))
+                            {
+                                InsertIntoTreeView(pInfo->hBrowseTV,
+                                                   hParent,
+                                                   lpModW,
+                                                   lpModW,
+                                                   IL_TEST);
+
+                                HeapFree(GetProcessHeap(), 0, lpModW);
+                            }
+
+                            while (*(ptr++) != '\0')
+                                ;
+
+                            numMods--;
+                        }
+
+                        HeapFree(GetProcessHeap(), 0, lpModules);
+                    }
+                }
             }
 
             FreeLibrary(hDll);

Modified: trunk/rostests/winetests/GUI/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/GUI/misc.c?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- trunk/rostests/winetests/GUI/misc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/GUI/misc.c [iso-8859-1] Thu Jun 19 06:57:14 2008
@@ -24,7 +24,7 @@
     }
 
     /* There are always blocks of 16 strings */
-    lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
+    lpName = (LPWSTR)MAKEINTRESOURCEW((uID >> 4) + 1);
 
     /* Find the string table block */
     if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
@@ -238,12 +238,12 @@
     /* Add all icons to the image list */
     for (i = StartResource; i <= EndResource; i++)
     {
-        hIcon = (HBITMAP)LoadImage(hInstance,
-                                   MAKEINTRESOURCE(i),
-                                   IMAGE_ICON,
-                                   Width,
-                                   Height,
-                                   LR_DEFAULTCOLOR);
+        hIcon = (HBITMAP)LoadImageW(hInstance,
+                                    MAKEINTRESOURCEW(i),
+                                    IMAGE_ICON,
+                                    Width,
+                                    Height,
+                                    LR_DEFAULTCOLOR);
         if (hIcon == NULL)
             goto fail;
 
@@ -261,3 +261,21 @@
     ImageList_Destroy(hImageList);
     return NULL;
 }
+
+DWORD
+AnsiToUnicode(LPCSTR lpSrcStr,
+              LPWSTR *lpDstStr)
+{
+    INT length;
+    INT ret = 0;
+
+    length = strlen(lpSrcStr) + 1;
+
+    *lpDstStr = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR));
+    if (*lpDstStr)
+    {
+        ret = MultiByteToWideChar(CP_ACP, 0, lpSrcStr, -1, *lpDstStr, length);
+    }
+
+    return ret;
+}

Modified: trunk/rostests/winetests/GUI/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/GUI/precomp.h?rev=34024&r1=34023&r2=34024&view=diff
==============================================================================
--- trunk/rostests/winetests/GUI/precomp.h [iso-8859-1] (original)
+++ trunk/rostests/winetests/GUI/precomp.h [iso-8859-1] Thu Jun 19 06:57:14 2008
@@ -32,6 +32,7 @@
 
 /* dll exports */
 wchar_t *GetTestName();
+int GetModulesInTest(char **modules);
 
 
 /* browsewnd.c */
@@ -41,5 +42,6 @@
 HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height);
 VOID DisplayString(LPWSTR lpMsg);
 VOID DisplayError(INT err);
+DWORD AnsiToUnicode(LPCSTR lpSrcStr, LPWSTR *lpDstStr);
 
 #endif /* __WINETESTGUI_PRECOMP_H */



More information about the Ros-diffs mailing list