From 43b0bdc2bfbb8ce198a0f031e394bcc35cde12f3 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 28 Sep 2011 20:55:18 +0000 Subject: [PATCH] Moved LoadFuncs/UnloadFuncs() to windows/lib Signed-off-by: Alexey Melnikov git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25257 dc483132-0cff-0310-8789-dd5450dbe970 --- .../leashdll => }/include/loadfuncs.h | 0 src/windows/kfwlogon/Makefile.in | 4 +- src/windows/kfwlogon/kfwcommon.c | 69 ------------------- src/windows/kfwlogon/kfwlogon.h | 4 -- src/windows/leashdll/Makefile.in | 5 +- src/windows/lib/Makefile.in | 7 +- src/windows/{leashdll => lib}/loadfuncs.c | 0 7 files changed, 9 insertions(+), 80 deletions(-) rename src/{windows/leashdll => }/include/loadfuncs.h (100%) rename src/windows/{leashdll => lib}/loadfuncs.c (100%) diff --git a/src/windows/leashdll/include/loadfuncs.h b/src/include/loadfuncs.h similarity index 100% rename from src/windows/leashdll/include/loadfuncs.h rename to src/include/loadfuncs.h diff --git a/src/windows/kfwlogon/Makefile.in b/src/windows/kfwlogon/Makefile.in index f6e523d22..f05c85387 100644 --- a/src/windows/kfwlogon/Makefile.in +++ b/src/windows/kfwlogon/Makefile.in @@ -29,11 +29,11 @@ $(EXERES): $(VERSIONRC) all-windows:: $(OUTPRE)kfwlogon.dll $(OUTPRE)kfwcpcc.exe $(KFWLOGON): $(OUTPRE)kfwlogon.obj $(OUTPRE)kfwcommon.obj $(LIBRES) - link $(DLL_LINKOPTS) -out:$@ $(OUTPRE)kfwlogon.obj $(OUTPRE)kfwcommon.obj -entry:DllEntryPoint -def:kfwlogon.def $(SYSLIBS) $(KLIB) $(CLIB) $(SCLIB) $(LIBRES) + link $(DLL_LINKOPTS) -out:$@ $(OUTPRE)kfwlogon.obj $(OUTPRE)kfwcommon.obj -entry:DllEntryPoint -def:kfwlogon.def $(SYSLIBS) $(KLIB) $(CLIB) $(SCLIB) ../lib/$(OUTPRE)libwin.lib $(LIBRES) $(_VC_MANIFEST_EMBED_DLL) $(KFWCPCC): $(OUTPRE)kfwcpcc.obj $(OUTPRE)kfwcommon.obj $(EXERES) - link $(EXE_LINKOPTS) -out:$@ $(OUTPRE)kfwcpcc.obj $(OUTPRE)kfwcommon.obj $(SYSLIBS) $(KLIB) $(CLIB) $(SCLIB) $(EXERES) + link $(EXE_LINKOPTS) -out:$@ $(OUTPRE)kfwcpcc.obj $(OUTPRE)kfwcommon.obj $(SYSLIBS) $(KLIB) $(CLIB) $(SCLIB) ../lib/$(OUTPRE)libwin.lib $(EXERES) $(_VC_MANIFEST_EMBED_EXE) install:: diff --git a/src/windows/kfwlogon/kfwcommon.c b/src/windows/kfwlogon/kfwcommon.c index bd09fcd4b..a34822193 100644 --- a/src/windows/kfwlogon/kfwcommon.c +++ b/src/windows/kfwlogon/kfwcommon.c @@ -350,75 +350,6 @@ void DebugEvent(char *b,...) } } -void -UnloadFuncs( - FUNC_INFO fi[], - HINSTANCE h - ) -{ - int n; - if (fi) - for (n = 0; fi[n].func_ptr_var; n++) - *(fi[n].func_ptr_var) = 0; - if (h) FreeLibrary(h); -} - -int -LoadFuncs( - const char* dll_name, - FUNC_INFO fi[], - HINSTANCE* ph, // [out, optional] - DLL handle - int* pindex, // [out, optional] - index of last func loaded (-1 if none) - int cleanup, // cleanup function pointers and unload on error - int go_on, // continue loading even if some functions cannot be loaded - int silent // do not pop-up a system dialog if DLL cannot be loaded - ) -{ - HINSTANCE h; - int i, n, last_i; - int error = 0; - UINT em; - - if (ph) *ph = 0; - if (pindex) *pindex = -1; - - for (n = 0; fi[n].func_ptr_var; n++) - *(fi[n].func_ptr_var) = 0; - - if (silent) - em = SetErrorMode(SEM_FAILCRITICALERRORS); - h = LoadLibrary(dll_name); - if (silent) - SetErrorMode(em); - - if (!h) - return 0; - - last_i = -1; - for (i = 0; (go_on || !error) && (i < n); i++) - { - void* p = (void*)GetProcAddress(h, fi[i].func_name); - if (!p) - error = 1; - else - { - last_i = i; - *(fi[i].func_ptr_var) = p; - } - } - if (pindex) *pindex = last_i; - if (error && cleanup && !go_on) { - for (i = 0; i < n; i++) { - *(fi[i].func_ptr_var) = 0; - } - FreeLibrary(h); - return 0; - } - if (ph) *ph = h; - if (error) return 0; - return 1; -} - static HANDLE hInitMutex = NULL; static BOOL bInit = FALSE; diff --git a/src/windows/kfwlogon/kfwlogon.h b/src/windows/kfwlogon/kfwlogon.h index 141b9c36b..9d2616258 100644 --- a/src/windows/kfwlogon/kfwlogon.h +++ b/src/windows/kfwlogon/kfwlogon.h @@ -188,10 +188,6 @@ DWORD APIENTRY NPPasswordChangeNotify( extern "C" { #endif -void UnloadFuncs(FUNC_INFO [], HINSTANCE); - -int LoadFuncs(const char*, FUNC_INFO [], HINSTANCE*, int*, int, int, int); - void DebugEvent0(char *a); void DebugEvent(char *b,...); diff --git a/src/windows/leashdll/Makefile.in b/src/windows/leashdll/Makefile.in index 12f281bd2..8846b5ec6 100644 --- a/src/windows/leashdll/Makefile.in +++ b/src/windows/leashdll/Makefile.in @@ -32,8 +32,7 @@ OBJS= $(OUTPRE)AFSroutines.$(OBJEXT) \ $(OUTPRE)timesync.$(OBJEXT) \ $(OUTPRE)winerr.$(OBJEXT) \ $(OUTPRE)winutil.$(OBJEXT) \ - $(OUTPRE)registry.$(OBJEXT) \ - $(OUTPRE)loadfuncs.$(OBJEXT) + $(OUTPRE)registry.$(OBJEXT) #TODO: Fix resource compilation RESFILE = $(OUTPRE)lsh_pwd.res @@ -75,7 +74,7 @@ clean-windows:: $(OUTPRE)$(DLL_NAME).dll: $(DEF_FILE) $(OBJS) $(XOBJS) link $(WINDLLFLAGS) -def:$(DEF_FILE) -out:$*.dll \ - $(OBJS) $(XOBJS) $(WINLIBS) $(SCLIB) + $(OBJS) $(XOBJS) $(WINLIBS) ../lib/$(OUTPRE)libwin.lib $(SCLIB) $(_VC_MANIFEST_EMBED_DLL) #TODO: Add dependencies on include files here diff --git a/src/windows/lib/Makefile.in b/src/windows/lib/Makefile.in index c911de701..119db8902 100644 --- a/src/windows/lib/Makefile.in +++ b/src/windows/lib/Makefile.in @@ -2,9 +2,12 @@ BUILDTOP = ..\.. lib-windows: $(OUTPRE)libwin.lib -SRCS= vardlg.c gic.c registry.c +SRCS= vardlg.c gic.c registry.c loadfuncs.c + + +OBJS= $(OUTPRE)vardlg.obj $(OUTPRE)gic.obj $(OUTPRE)registry.obj \ + $(OUTPRE)loadfuncs.obj -OBJS= $(OUTPRE)vardlg.obj $(OUTPRE)gic.obj $(OUTPRE)registry.obj $(OUTPRE)libwin.lib: $(OBJS) lib /nologo /out:$*.lib $(OBJS) diff --git a/src/windows/leashdll/loadfuncs.c b/src/windows/lib/loadfuncs.c similarity index 100% rename from src/windows/leashdll/loadfuncs.c rename to src/windows/lib/loadfuncs.c -- 2.26.2