diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-10-27 18:53:56 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-10-27 18:53:56 +0000 |
commit | a5cc215f7582ab15d07a6fb5c92d0492ea986188 (patch) | |
tree | 2a309b9f7a5ab3ade758e26a13dbb6dc8b28cff9 /winsup | |
parent | 018a91fa2eaca3d1d9a3bf0f1a604bea2523ceee (diff) | |
download | newlib-a5cc215f7582ab15d07a6fb5c92d0492ea986188.zip newlib-a5cc215f7582ab15d07a6fb5c92d0492ea986188.tar.gz newlib-a5cc215f7582ab15d07a6fb5c92d0492ea986188.tar.bz2 |
* autoload.cc: New file keeping all autoload stuff.
* Makefile.in: Add autoload.o to dependencies.
* dcrt0.cc: Move all autoload stuff to autoload.cc.
* fhandler_mem.cc: Ditto.
* net.cc: Ditto.
* uinfo.cc: Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/Makefile.in | 3 | ||||
-rw-r--r-- | winsup/cygwin/autoload.cc | 314 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 182 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_mem.cc | 40 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 83 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 24 |
7 files changed, 326 insertions, 329 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7b1ba65..6e25e58 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +Fri Oct 27 20:51:00 2000 Corinna Vinschen <corinna@vinschen.de> + + * autoload.cc: New file keeping all autoload stuff. + * Makefile.in: Add autoload.o to dependencies. + * dcrt0.cc: Move all autoload stuff to autoload.cc. + * fhandler_mem.cc: Ditto. + * net.cc: Ditto. + * uinfo.cc: Ditto. + Fri Oct 27 11:37:20 2000 Christopher Faylor <cgf@cygnus.com> * sigproc.cc (wait_sig): Add braces to avoid confusion. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 85a535e..8672759 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -112,7 +112,8 @@ EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o DLL_IMPORTS:=$(w32api_lib)/libkernel32.a -DLL_OFILES:=assert.o cygheap.o dcrt0.o debug.o delqueue.o dir.o dlfcn.o \ +DLL_OFILES:=assert.o autoload.o cygheap.o dcrt0.o debug.o delqueue.o dir.o \ + dlfcn.o \ dll_init.o dtable.o environ.o errno.o exceptions.o exec.o external.o \ fcntl.o fhandler.o fhandler_clipboard.o fhandler_console.o \ fhandler_floppy.o fhandler_mem.o fhandler_random.o fhandler_raw.o \ diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc new file mode 100644 index 0000000..a24ec40 --- /dev/null +++ b/winsup/cygwin/autoload.cc @@ -0,0 +1,314 @@ +/* autoload.cc: all dynamic load stuff. + + Copyright 2000 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include "winsup.h" +#include "autoload.h" + +extern "C" { + +/* This struct is unused, but it illustrates the layout of a DLL + information block. */ +struct DLLinfo +{ + char jmpinst[4]; + HANDLE h; + DWORD flag; + char name[0]; +}; + +/* FIXME: This is not thread-safe! */ +__asm__ (" +msg1: + .ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\" + + .align 32 +noload: + popl %edx # Get the address of the information block + movl 8(%edx),%eax # Should we 'ignore' the lack + test $1,%eax # of this function? + jz 1f # Nope. + decl %eax # Yes. This is the # of bytes + 1 + popl %edx # Caller's caller + addl %eax,%esp # Pop off bytes + xor %eax,%eax # Zero functional return + jmp *%edx # Return +1: + movl 4(%edx),%eax # Handle value + pushl (%eax) + leal 12(%edx),%eax # Location of name of function + push %eax + push $msg1 # The message + call ___api_fatal # Print message. Never returns + + .globl cygwin_dll_func_load +cygwin_dll_func_load: + movl (%esp),%eax # 'Return address' contains load info + addl $12,%eax # Address of name of function to load + pushl %eax # Second argument + movl -8(%eax),%eax # Address of Handle to DLL + pushl (%eax) # Handle to DLL + call _GetProcAddress@8# Load it + test %eax,%eax # Success? + jne gotit # Yes + jmp noload # Issue an error or return +gotit: + popl %ecx # Pointer to 'return address' + movb $0xe0,-1(%ecx) # Turn preceding call to a jmp *%eax + movl %eax,(%ecx) # Point dispatch to address loaded above + jmp *%eax +"); + +LoadDLLinitfunc (advapi32) +{ + HANDLE h; + static NO_COPY LONG here = -1L; + + while (InterlockedIncrement (&here)) + { + InterlockedDecrement (&here); + Sleep (0); + } + + if (advapi32_handle) + /* nothing to do */; + else if ((h = LoadLibrary ("advapi32.dll")) != NULL) + advapi32_handle = h; + else if (!advapi32_handle) + api_fatal ("could not load advapi32.dll, %E"); + + InterlockedDecrement (&here); + return 0; +} + +LoadDLLinitfunc (netapi32) +{ + HANDLE h; + + if ((h = LoadLibrary ("netapi32.dll")) != NULL) + netapi32_handle = h; + else if (! netapi32_handle) + api_fatal ("could not load netapi32.dll. %d", GetLastError ()); + return 0; +} + +LoadDLLinitfunc (ntdll) +{ + HANDLE h; + static NO_COPY LONG here = -1L; + + while (InterlockedIncrement (&here)) + { + InterlockedDecrement (&here); +small_printf ("Multiple tries to read ntdll.dll\n"); + Sleep (0); + } + + if (ntdll_handle) + /* nothing to do */; + else if ((h = LoadLibrary ("ntdll.dll")) != NULL) + ntdll_handle = h; + else if (!ntdll_handle) + api_fatal ("could not load ntdll.dll, %E"); + + InterlockedDecrement (&here); + return 0; +} + +LoadDLLinitfunc (user32) +{ + HANDLE h; + static NO_COPY LONG here = -1L; + + while (InterlockedIncrement (&here)) + { + InterlockedDecrement (&here); + Sleep (0); + } + + if (user32_handle) + /* nothing to do */; + else if ((h = LoadLibrary ("user32.dll")) != NULL) + user32_handle = h; + else if (!user32_handle) + api_fatal ("could not load user32.dll, %E"); + + InterlockedDecrement (&here); + return 0; /* Already done by another thread? */ +} + +LoadDLLinitfunc (wsock32) +{ + extern void wsock_init (); + HANDLE h; + + if ((h = LoadLibrary ("wsock32.dll")) != NULL) + wsock32_handle = h; + else if (!wsock32_handle) + api_fatal ("could not load wsock32.dll. Is TCP/IP installed?"); + else + return 0; /* Already done by another thread? */ + + if (!ws2_32_handle) + wsock_init (); + + return 0; +} + +LoadDLLinitfunc (ws2_32) +{ + extern void wsock_init (); + HANDLE h; + + if ((h = LoadLibrary ("ws2_32.dll")) == NULL) + return 0; /* Already done or not available. */ + ws2_32_handle = h; + + if (!wsock32_handle) + wsock_init (); + + return 0; +} + +static void dummy_autoload (void) __attribute__ ((unused)); +static void +dummy_autoload (void) +{ +LoadDLLinit (advapi32) +LoadDLLfunc (AddAccessAllowedAce, 16, advapi32) +LoadDLLfunc (AddAccessDeniedAce, 16, advapi32) +LoadDLLfunc (AddAce, 20, advapi32) +LoadDLLfunc (AdjustTokenPrivileges, 24, advapi32) +LoadDLLfunc (CopySid, 12, advapi32) +LoadDLLfunc (CreateProcessAsUserA, 44, advapi32) +LoadDLLfuncEx (CryptAcquireContextA, 20, advapi32, 1) +LoadDLLfuncEx (CryptGenRandom, 12, advapi32, 1) +LoadDLLfuncEx (CryptReleaseContext, 8, advapi32, 1) +LoadDLLfunc (DeregisterEventSource, 4, advapi32) +LoadDLLfunc (EqualSid, 8, advapi32) +LoadDLLfunc (GetAce, 12, advapi32) +LoadDLLfunc (GetFileSecurityA, 20, advapi32) +LoadDLLfunc (GetLengthSid, 4, advapi32) +LoadDLLfunc (GetSecurityDescriptorDacl, 16, advapi32) +LoadDLLfunc (GetSecurityDescriptorGroup, 12, advapi32) +LoadDLLfunc (GetSecurityDescriptorOwner, 12, advapi32) +LoadDLLfunc (GetSidIdentifierAuthority, 4, advapi32) +LoadDLLfunc (GetSidSubAuthority, 8, advapi32) +LoadDLLfunc (GetSidSubAuthorityCount, 4, advapi32) +LoadDLLfunc (GetTokenInformation, 20, advapi32) +LoadDLLfunc (GetUserNameA, 8, advapi32) +LoadDLLfunc (ImpersonateLoggedOnUser, 4, advapi32) +LoadDLLfunc (InitializeAcl, 12, advapi32) +LoadDLLfunc (InitializeSecurityDescriptor, 8, advapi32) +LoadDLLfunc (InitializeSid, 12, advapi32) +LoadDLLfunc (IsValidSid, 4, advapi32) +LoadDLLfunc (LogonUserA, 24, advapi32) +LoadDLLfunc (LookupAccountNameA, 28, advapi32) +LoadDLLfunc (LookupAccountSidA, 28, advapi32) +LoadDLLfunc (LookupPrivilegeValueA, 12, advapi32) +LoadDLLfunc (MakeSelfRelativeSD, 12, advapi32) +LoadDLLfunc (OpenProcessToken, 12, advapi32) +LoadDLLfunc (RegCloseKey, 4, advapi32) +LoadDLLfunc (RegCreateKeyExA, 36, advapi32) +LoadDLLfunc (RegDeleteKeyA, 8, advapi32) +LoadDLLfunc (RegDeleteValueA, 8, advapi32) +LoadDLLfunc (RegLoadKeyA, 12, advapi32) +LoadDLLfunc (RegEnumKeyExA, 32, advapi32) +LoadDLLfunc (RegEnumValueA, 32, advapi32) +LoadDLLfunc (RegOpenKeyExA, 20, advapi32) +LoadDLLfunc (RegQueryValueExA, 24, advapi32) +LoadDLLfunc (RegSetValueExA, 24, advapi32) +LoadDLLfunc (RegisterEventSourceA, 8, advapi32) +LoadDLLfunc (ReportEventA, 36, advapi32) +LoadDLLfunc (RevertToSelf, 0, advapi32) +LoadDLLfunc (SetKernelObjectSecurity, 12, advapi32) +LoadDLLfunc (SetSecurityDescriptorDacl, 16, advapi32) +LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32) +LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32) + +LoadDLLinit (netapi32) +LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32) +LoadDLLfunc (NetUserGetInfo, 16, netapi32) +LoadDLLfunc (NetApiBufferFree, 4, netapi32) + +LoadDLLinit (ntdll) +LoadDLLfuncEx (NtMapViewOfSection, 40, ntdll, 1) +LoadDLLfuncEx (NtOpenSection, 12, ntdll, 1) +LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1) +LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1) +LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1) +LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1) + +LoadDLLinit (user32) +LoadDLLfunc (CharToOemBuffA, 12, user32) +LoadDLLfunc (CloseClipboard, 0, user32) +LoadDLLfunc (CreateWindowExA, 48, user32) +LoadDLLfunc (DefWindowProcA, 16, user32) +LoadDLLfunc (DispatchMessageA, 4, user32) +LoadDLLfunc (FindWindowA, 8, user32) +LoadDLLfunc (GetClipboardData, 4, user32) +LoadDLLfunc (GetMessageA, 16, user32) +LoadDLLfunc (GetProcessWindowStation, 0, user32) +LoadDLLfunc (GetThreadDesktop, 4, user32) +LoadDLLfunc (GetUserObjectInformationA, 20, user32) +LoadDLLfunc (KillTimer, 8, user32) +LoadDLLfunc (MessageBoxA, 16, user32) +LoadDLLfunc (MsgWaitForMultipleObjects, 20, user32) +LoadDLLfunc (OemToCharBuffA, 12, user32) +LoadDLLfunc (OpenClipboard, 4, user32) +LoadDLLfunc (PeekMessageA, 20, user32) +LoadDLLfunc (PostMessageA, 16, user32) +LoadDLLfunc (PostQuitMessage, 4, user32) +LoadDLLfunc (RegisterClassA, 4, user32) +LoadDLLfunc (SendMessageA, 16, user32) +LoadDLLfunc (SetTimer, 16, user32) +LoadDLLfunc (SetUserObjectSecurity, 12, user32) + +LoadDLLinit (wsock32) +LoadDLLfunc (WSAAsyncSelect, 16, wsock32) +LoadDLLfunc (WSACleanup, 0, wsock32) +LoadDLLfunc (WSAGetLastError, 0, wsock32) +LoadDLLfunc (WSAStartup, 8, wsock32) +LoadDLLfunc (__WSAFDIsSet, 8, wsock32) +LoadDLLfunc (accept, 12, wsock32) +LoadDLLfunc (bind, 12, wsock32) +LoadDLLfunc (closesocket, 4, wsock32) +LoadDLLfunc (connect, 12, wsock32) +LoadDLLfunc (gethostbyaddr, 12, wsock32) +LoadDLLfunc (gethostbyname, 4, wsock32) +LoadDLLfunc (gethostname, 8, wsock32) +LoadDLLfunc (getpeername, 12, wsock32) +LoadDLLfunc (getprotobyname, 4, wsock32) +LoadDLLfunc (getprotobynumber, 4, wsock32) +LoadDLLfunc (getservbyname, 8, wsock32) +LoadDLLfunc (getservbyport, 8, wsock32) +LoadDLLfunc (getsockname, 12, wsock32) +LoadDLLfunc (getsockopt, 20, wsock32) +LoadDLLfunc (inet_addr, 4, wsock32) +LoadDLLfunc (inet_network, 4, wsock32) +LoadDLLfunc (inet_ntoa, 4, wsock32) +LoadDLLfunc (ioctlsocket, 12, wsock32) +LoadDLLfunc (listen, 8, wsock32) +LoadDLLfunc (rcmd, 24, wsock32) +LoadDLLfunc (recv, 16, wsock32) +LoadDLLfunc (recvfrom, 24, wsock32) +LoadDLLfunc (rexec, 24, wsock32) +LoadDLLfunc (rresvport, 4, wsock32) +LoadDLLfunc (select, 20, wsock32) +LoadDLLfunc (send, 16, wsock32) +LoadDLLfunc (sendto, 24, wsock32) +LoadDLLfunc (setsockopt, 20, wsock32) +LoadDLLfunc (shutdown, 8, wsock32) +LoadDLLfunc (socket, 12, wsock32) + +LoadDLLinit (ws2_32) +LoadDLLfuncEx (WSADuplicateSocketA, 12, ws2_32, 1) +LoadDLLfuncEx (WSASocketA, 24, ws2_32, 1) +} +} diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 98767ab..56873b1 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -13,7 +13,6 @@ details. */ #include <stdlib.h> #include "glob.h" #include "exceptions.h" -#include "autoload.h" #include <ctype.h> #include <limits.h> #include "sync.h" @@ -1103,184 +1102,3 @@ cygbench (const char *s) small_printf ("%05d ***** %s : %10d\n", GetCurrentProcessId (), s, strace.microseconds ()); } #endif - -extern "C" { - -/* This struct is unused, but it illustrates the layout of a DLL - information block. */ -struct DLLinfo -{ - char jmpinst[4]; - HANDLE h; - DWORD flag; - char name[0]; -}; - -/* FIXME: This is not thread-safe! */ -__asm__ (" -msg1: - .ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\" - - .align 32 -noload: - popl %edx # Get the address of the information block - movl 8(%edx),%eax # Should we 'ignore' the lack - test $1,%eax # of this function? - jz 1f # Nope. - decl %eax # Yes. This is the # of bytes + 1 - popl %edx # Caller's caller - addl %eax,%esp # Pop off bytes - xor %eax,%eax # Zero functional return - jmp *%edx # Return -1: - movl 4(%edx),%eax # Handle value - pushl (%eax) - leal 12(%edx),%eax # Location of name of function - push %eax - push $msg1 # The message - call ___api_fatal # Print message. Never returns - - .globl cygwin_dll_func_load -cygwin_dll_func_load: - movl (%esp),%eax # 'Return address' contains load info - addl $12,%eax # Address of name of function to load - pushl %eax # Second argument - movl -8(%eax),%eax # Address of Handle to DLL - pushl (%eax) # Handle to DLL - call _GetProcAddress@8# Load it - test %eax,%eax # Success? - jne gotit # Yes - jmp noload # Issue an error or return -gotit: - popl %ecx # Pointer to 'return address' - movb $0xe0,-1(%ecx) # Turn preceding call to a jmp *%eax - movl %eax,(%ecx) # Point dispatch to address loaded above - jmp *%eax -"); - -LoadDLLinitfunc (user32) -{ - HANDLE h; - static NO_COPY LONG here = -1L; - - while (InterlockedIncrement (&here)) - { - InterlockedDecrement (&here); - Sleep (0); - } - - if (user32_handle) - /* nothing to do */; - else if ((h = LoadLibrary ("user32.dll")) != NULL) - user32_handle = h; - else if (!user32_handle) - api_fatal ("could not load user32.dll, %E"); - - InterlockedDecrement (&here); - return 0; /* Already done by another thread? */ -} - -LoadDLLinitfunc (advapi32) -{ - HANDLE h; - static NO_COPY LONG here = -1L; - - while (InterlockedIncrement (&here)) - { - InterlockedDecrement (&here); - Sleep (0); - } - - if (advapi32_handle) - /* nothing to do */; - else if ((h = LoadLibrary ("advapi32.dll")) != NULL) - advapi32_handle = h; - else if (!advapi32_handle) - api_fatal ("could not load advapi32.dll, %E"); - - InterlockedDecrement (&here); - return 0; -} - -static void dummy_autoload (void) __attribute__ ((unused)); -static void -dummy_autoload (void) -{ -LoadDLLinit (user32) -LoadDLLfunc (CharToOemBuffA, 12, user32) -LoadDLLfunc (CloseClipboard, 0, user32) -LoadDLLfunc (CreateWindowExA, 48, user32) -LoadDLLfunc (DefWindowProcA, 16, user32) -LoadDLLfunc (DispatchMessageA, 4, user32) -LoadDLLfunc (FindWindowA, 8, user32) -LoadDLLfunc (GetClipboardData, 4, user32) -LoadDLLfunc (GetMessageA, 16, user32) -LoadDLLfunc (GetProcessWindowStation, 0, user32) -LoadDLLfunc (GetThreadDesktop, 4, user32) -LoadDLLfunc (GetUserObjectInformationA, 20, user32) -LoadDLLfunc (KillTimer, 8, user32) -LoadDLLfunc (MessageBoxA, 16, user32) -LoadDLLfunc (MsgWaitForMultipleObjects, 20, user32) -LoadDLLfunc (OemToCharBuffA, 12, user32) -LoadDLLfunc (OpenClipboard, 4, user32) -LoadDLLfunc (PeekMessageA, 20, user32) -LoadDLLfunc (PostMessageA, 16, user32) -LoadDLLfunc (PostQuitMessage, 4, user32) -LoadDLLfunc (RegisterClassA, 4, user32) -LoadDLLfunc (SendMessageA, 16, user32) -LoadDLLfunc (SetTimer, 16, user32) -LoadDLLfunc (SetUserObjectSecurity, 12, user32) - -LoadDLLinit (advapi32) -LoadDLLfunc (AddAccessAllowedAce, 16, advapi32) -LoadDLLfunc (AddAccessDeniedAce, 16, advapi32) -LoadDLLfunc (AddAce, 20, advapi32) -LoadDLLfunc (AdjustTokenPrivileges, 24, advapi32) -LoadDLLfunc (CopySid, 12, advapi32) -LoadDLLfunc (CreateProcessAsUserA, 44, advapi32) -LoadDLLfuncEx (CryptAcquireContextA, 20, advapi32, 1) -LoadDLLfuncEx (CryptGenRandom, 12, advapi32, 1) -LoadDLLfuncEx (CryptReleaseContext, 8, advapi32, 1) -LoadDLLfunc (DeregisterEventSource, 4, advapi32) -LoadDLLfunc (EqualSid, 8, advapi32) -LoadDLLfunc (GetAce, 12, advapi32) -LoadDLLfunc (GetFileSecurityA, 20, advapi32) -LoadDLLfunc (GetLengthSid, 4, advapi32) -LoadDLLfunc (GetSecurityDescriptorDacl, 16, advapi32) -LoadDLLfunc (GetSecurityDescriptorGroup, 12, advapi32) -LoadDLLfunc (GetSecurityDescriptorOwner, 12, advapi32) -LoadDLLfunc (GetSidIdentifierAuthority, 4, advapi32) -LoadDLLfunc (GetSidSubAuthority, 8, advapi32) -LoadDLLfunc (GetSidSubAuthorityCount, 4, advapi32) -LoadDLLfunc (GetTokenInformation, 20, advapi32) -LoadDLLfunc (GetUserNameA, 8, advapi32) -LoadDLLfunc (ImpersonateLoggedOnUser, 4, advapi32) -LoadDLLfunc (InitializeAcl, 12, advapi32) -LoadDLLfunc (InitializeSecurityDescriptor, 8, advapi32) -LoadDLLfunc (InitializeSid, 12, advapi32) -LoadDLLfunc (IsValidSid, 4, advapi32) -LoadDLLfunc (LogonUserA, 24, advapi32) -LoadDLLfunc (LookupAccountNameA, 28, advapi32) -LoadDLLfunc (LookupAccountSidA, 28, advapi32) -LoadDLLfunc (LookupPrivilegeValueA, 12, advapi32) -LoadDLLfunc (MakeSelfRelativeSD, 12, advapi32) -LoadDLLfunc (OpenProcessToken, 12, advapi32) -LoadDLLfunc (RegCloseKey, 4, advapi32) -LoadDLLfunc (RegCreateKeyExA, 36, advapi32) -LoadDLLfunc (RegDeleteKeyA, 8, advapi32) -LoadDLLfunc (RegDeleteValueA, 8, advapi32) -LoadDLLfunc (RegLoadKeyA, 12, advapi32) -LoadDLLfunc (RegEnumKeyExA, 32, advapi32) -LoadDLLfunc (RegEnumValueA, 32, advapi32) -LoadDLLfunc (RegOpenKeyExA, 20, advapi32) -LoadDLLfunc (RegQueryValueExA, 24, advapi32) -LoadDLLfunc (RegSetValueExA, 24, advapi32) -LoadDLLfunc (RegisterEventSourceA, 8, advapi32) -LoadDLLfunc (ReportEventA, 36, advapi32) -LoadDLLfunc (RevertToSelf, 0, advapi32) -LoadDLLfunc (SetKernelObjectSecurity, 12, advapi32) -LoadDLLfunc (SetSecurityDescriptorDacl, 16, advapi32) -LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32) -LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32) -} -} diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index 5c9ed1e..f313a02 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -15,7 +15,6 @@ #include <sys/mman.h> #include <ntdef.h> -#include "autoload.h" #include "cygerrno.h" #include "fhandler.h" #include "ntdll.h" @@ -402,42 +401,3 @@ fhandler_dev_mem::dump () { paranoid_printf("here, fhandler_dev_mem"); } - -extern "C" { - -LoadDLLinitfunc (ntdll) -{ - HANDLE h; - static NO_COPY LONG here = -1L; - - while (InterlockedIncrement (&here)) - { - InterlockedDecrement (&here); -small_printf ("Multiple tries to read ntdll.dll\n"); - Sleep (0); - } - - if (ntdll_handle) - /* nothing to do */; - else if ((h = LoadLibrary ("ntdll.dll")) != NULL) - ntdll_handle = h; - else if (!ntdll_handle) - api_fatal ("could not load ntdll.dll, %E"); - - InterlockedDecrement (&here); - return 0; -} - -static void dummy_autoload (void) __attribute__ ((unused)); -static void -dummy_autoload (void) -{ -LoadDLLinit (ntdll) -LoadDLLfuncEx (NtMapViewOfSection, 40, ntdll, 1) -LoadDLLfuncEx (NtOpenSection, 12, ntdll, 1) -LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1) -LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1) -LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1) -LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1) -} -} diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 50c097d..7be9c3d 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -21,7 +21,6 @@ details. */ #include <unistd.h> #include <netdb.h> #include <fcntl.h> -#include "autoload.h" #include <winsock2.h> #include "cygheap.h" #include "cygerrno.h" @@ -1782,7 +1781,7 @@ endhostent (void) { } -static void +extern "C" void wsock_init () { int res = WSAStartup ((2<<8) | 2, &wsadata); @@ -1800,83 +1799,3 @@ wsock_init () debug_printf ("**************** FIONBIO != REAL_FIONBIO"); } -extern "C" { -/* Initialize WinSock */ -LoadDLLinitfunc (wsock32) -{ - HANDLE h; - - if ((h = LoadLibrary ("wsock32.dll")) != NULL) - wsock32_handle = h; - else if (!wsock32_handle) - api_fatal ("could not load wsock32.dll. Is TCP/IP installed?"); - else - return 0; /* Already done by another thread? */ - - if (!ws2_32_handle) - wsock_init (); - - return 0; -} - -/* Initialize WinSock2.0 */ -LoadDLLinitfunc (ws2_32) -{ - HANDLE h; - - if ((h = LoadLibrary ("ws2_32.dll")) == NULL) - return 0; /* Already done or not available. */ - ws2_32_handle = h; - - if (!wsock32_handle) - wsock_init (); - - return 0; -} - -static void dummy_autoload (void) __attribute__ ((unused)); -static void -dummy_autoload (void) -{ -LoadDLLinit (wsock32) -LoadDLLfunc (WSAAsyncSelect, 16, wsock32) -LoadDLLfunc (WSACleanup, 0, wsock32) -LoadDLLfunc (WSAGetLastError, 0, wsock32) -LoadDLLfunc (WSAStartup, 8, wsock32) -LoadDLLfunc (__WSAFDIsSet, 8, wsock32) -LoadDLLfunc (accept, 12, wsock32) -LoadDLLfunc (bind, 12, wsock32) -LoadDLLfunc (closesocket, 4, wsock32) -LoadDLLfunc (connect, 12, wsock32) -LoadDLLfunc (gethostbyaddr, 12, wsock32) -LoadDLLfunc (gethostbyname, 4, wsock32) -LoadDLLfunc (gethostname, 8, wsock32) -LoadDLLfunc (getpeername, 12, wsock32) -LoadDLLfunc (getprotobyname, 4, wsock32) -LoadDLLfunc (getprotobynumber, 4, wsock32) -LoadDLLfunc (getservbyname, 8, wsock32) -LoadDLLfunc (getservbyport, 8, wsock32) -LoadDLLfunc (getsockname, 12, wsock32) -LoadDLLfunc (getsockopt, 20, wsock32) -LoadDLLfunc (inet_addr, 4, wsock32) -LoadDLLfunc (inet_network, 4, wsock32) -LoadDLLfunc (inet_ntoa, 4, wsock32) -LoadDLLfunc (ioctlsocket, 12, wsock32) -LoadDLLfunc (listen, 8, wsock32) -LoadDLLfunc (rcmd, 24, wsock32) -LoadDLLfunc (recv, 16, wsock32) -LoadDLLfunc (recvfrom, 24, wsock32) -LoadDLLfunc (rexec, 24, wsock32) -LoadDLLfunc (rresvport, 4, wsock32) -LoadDLLfunc (select, 20, wsock32) -LoadDLLfunc (send, 16, wsock32) -LoadDLLfunc (sendto, 24, wsock32) -LoadDLLfunc (setsockopt, 20, wsock32) -LoadDLLfunc (shutdown, 8, wsock32) -LoadDLLfunc (socket, 12, wsock32) - -LoadDLLinit (ws2_32) -LoadDLLfuncEx (WSADuplicateSocketA, 12, ws2_32, 1) -LoadDLLfuncEx (WSASocketA, 24, ws2_32, 1) -} -} diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index e0c5d07..c0a0c2c 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -14,7 +14,6 @@ details. */ #include <winnls.h> #include <utmp.h> #include <limits.h> -#include "autoload.h" #include <stdlib.h> #include <wchar.h> #include <lm.h> @@ -252,26 +251,3 @@ cuserid (char *src) return getlogin (); } } - -extern "C" { -LoadDLLinitfunc (netapi32) -{ - HANDLE h; - - if ((h = LoadLibrary ("netapi32.dll")) != NULL) - netapi32_handle = h; - else if (! netapi32_handle) - api_fatal ("could not load netapi32.dll. %d", GetLastError ()); - return 0; -} - -static void dummy_autoload (void) __attribute__ ((unused)); -static void -dummy_autoload (void) -{ -LoadDLLinit (netapi32) -LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32) -LoadDLLfunc (NetUserGetInfo, 16, netapi32) -LoadDLLfunc (NetApiBufferFree, 4, netapi32) -} -} |