Commit in reactos/lib/userenv on MAIN
desktop.c+11-31.7 -> 1.8
internal.h+2-31.7 -> 1.8
misc.c+10-131.4 -> 1.5
+23-19
3 modified files
simplified dynamic loading of dlls

reactos/lib/userenv
desktop.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- desktop.c	11 Jul 2004 22:35:07 -0000	1.7
+++ desktop.c	12 Jul 2004 10:33:04 -0000	1.8
@@ -1,4 +1,4 @@
-/* $Id: desktop.c,v 1.7 2004/07/11 22:35:07 weiden Exp $
+/* $Id: desktop.c,v 1.8 2004/07/12 10:33:04 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -218,7 +218,11 @@
   DPRINT ("szArguments: '%S'\n", szArguments);
 
   /* dynamically load ole32.dll */
-  LoadDynamicImports(&DynOle32, &Ole32);
+  if(!LoadDynamicImports(&DynOle32, &Ole32))
+  {
+    DPRINT1("USERENV: Unable to load OLE32.DLL\n");
+    return FALSE;
+  }
 
   Ole32.fn.CoInitialize(NULL);
 
@@ -508,7 +512,11 @@
   DPRINT ("szArguments: '%S'\n", szArguments);
 
   /* dynamically load ole32.dll */
-  LoadDynamicImports(&DynOle32, &Ole32);
+  if(!LoadDynamicImports(&DynOle32, &Ole32))
+  {
+    DPRINT1("USERENV: Unable to load OLE32.DLL\n");
+    return FALSE;
+  }
 
   Ole32.fn.CoInitialize(NULL);
 

reactos/lib/userenv
internal.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- internal.h	11 Jul 2004 22:35:07 -0000	1.7
+++ internal.h	12 Jul 2004 10:33:04 -0000	1.8
@@ -1,4 +1,4 @@
-/* $Id: internal.h,v 1.7 2004/07/11 22:35:07 weiden Exp $ 
+/* $Id: internal.h,v 1.8 2004/07/12 10:33:04 weiden Exp $ 
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -55,8 +55,7 @@
 typedef struct _DYN_MODULE
 {
   LPWSTR Library;    /* dll file name */
-  int nFunctions;    /* number of functions in the Functions array */
-  LPSTR *Functions;  /* function names */
+  LPSTR Functions[]; /* function names */
 } DYN_MODULE, *PDYN_MODULE;
 
 extern DYN_MODULE DynOle32;

reactos/lib/userenv
misc.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- misc.c	11 Jul 2004 23:08:31 -0000	1.4
+++ misc.c	12 Jul 2004 10:33:04 -0000	1.5
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.4 2004/07/11 23:08:31 weiden Exp $
+/* $Id: misc.c,v 1.5 2004/07/12 10:33:04 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -94,18 +94,15 @@
 /* Dynamic DLL loading interface **********************************************/
 
 /* OLE32.DLL import table */
-LPSTR Ole32Imports[] =
-{
-  "CoInitialize",
-  "CoCreateInstance",
-  "CoUninitialize",
-};
-
 DYN_MODULE DynOle32 = 
 {
   L"ole32.dll",
-  sizeof(Ole32Imports) / sizeof(LPSTR),
-  Ole32Imports
+  {
+    "CoInitialize",
+    "CoCreateInstance",
+    "CoUninitialize",
+    NULL
+  }
 };
 
 /*
@@ -118,7 +115,7 @@
 BOOL
 LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs)
 {
-  int i;
+  LPSTR *fname;
   PVOID *fn;
   
   ZeroMemory(DynFuncs, sizeof(DYN_FUNCS));
@@ -132,9 +129,9 @@
   fn = &DynFuncs->fn.foo;
   
   /* load the imports */
-  for(i = 0; i < Module->nFunctions; i++)
+  for(fname = Module->Functions; *fname != NULL; fname++)
   {
-    *fn = GetProcAddress(DynFuncs->hModule, Module->Functions[i]);
+    *fn = GetProcAddress(DynFuncs->hModule, *fname);
     if(*fn == NULL)
     {
       FreeLibrary(DynFuncs->hModule);
CVSspam 0.2.8