diff --git a/reactos/lib/userenv/desktop.c b/reactos/lib/userenv/desktop.c index 942b5ac4df6..b7be157e1a8 100644 --- a/reactos/lib/userenv/desktop.c +++ b/reactos/lib/userenv/desktop.c @@ -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 @@ AddDesktopItemW (BOOL bCommonDesktop, 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 @@ AddItemW (LPCWSTR lpGroupName, 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); diff --git a/reactos/lib/userenv/internal.h b/reactos/lib/userenv/internal.h index fdeecd9924a..f540e1922b6 100644 --- a/reactos/lib/userenv/internal.h +++ b/reactos/lib/userenv/internal.h @@ -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_FUNCS 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; diff --git a/reactos/lib/userenv/misc.c b/reactos/lib/userenv/misc.c index 1e1eb99ac24..3830baec420 100644 --- a/reactos/lib/userenv/misc.c +++ b/reactos/lib/userenv/misc.c @@ -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 @@ GetUserSidFromToken (HANDLE hToken, /* 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 @@ DYN_MODULE DynOle32 = BOOL LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs) { - int i; + LPSTR *fname; PVOID *fn; ZeroMemory(DynFuncs, sizeof(DYN_FUNCS)); @@ -132,9 +129,9 @@ LoadDynamicImports(PDYN_MODULE Module, PDYN_FUNCS DynFuncs) 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);