X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fwinproc.h;h=3910321d77e7794057160d5809f063d9cdf84448;hb=a5a54c51011a9498e72b2a9341b35333c6beef1a;hp=9619f60d91c0bc620d94629453bf04f15992dace;hpb=8dbf6bb060caed8132faf75e0d7fec250c9653c1;p=oweals%2Fgnunet.git diff --git a/src/include/winproc.h b/src/include/winproc.h index 9619f60d9..3910321d7 100644 --- a/src/include/winproc.h +++ b/src/include/winproc.h @@ -1,28 +1,29 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors) + Copyright (C) 2001, 2002, 2003, 2004, 2005 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @file util/winproc.h - * @brief Definitions for MS Windows * @author Nils Durner - **/ + * + * @file + * Definitions for MS Windows + */ #ifndef _WINPROC_H #define _WINPROC_H @@ -34,16 +35,20 @@ #include #include #include +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024 +#endif +#include +#include #include -#include #include #include #include #include #include /* #define BYTE_ORDER */ -#include +#include #include -#include +#include #ifdef __cplusplus @@ -55,13 +60,16 @@ extern "C" #define MAX_NAME_LENGTH 25 #endif - typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, - PULONG); + typedef DWORD WINAPI (*TNtQuerySystemInformation) (int, PVOID, ULONG, PULONG); typedef DWORD WINAPI (*TGetIfEntry) (PMIB_IFROW pIfRow); typedef DWORD WINAPI (*TGetIpAddrTable) (PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder); typedef DWORD WINAPI (*TGetIfTable) (PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder); + typedef DWORD WINAPI (*TGetBestInterfaceEx) (struct sockaddr *, PDWORD); + /* TODO: Explicitly import -A variants (i.e. TCreateHardLinkA) or -W + * variants (TCreateHardLinkW), etc. + */ typedef DWORD WINAPI (*TCreateHardLink) (LPCTSTR lpFileName, LPCTSTR lpExistingFileName, LPSECURITY_ATTRIBUTES @@ -99,23 +107,19 @@ extern "C" typedef SC_HANDLE WINAPI (*TOpenService) (SC_HANDLE hSCManager, LPCTSTR lpServiceName, DWORD dwDesiredAccess); - typedef DWORD WINAPI (*TGetBestInterface) (IPAddr dwDestAddr, - PDWORD pdwBestIfIndex); typedef DWORD WINAPI (*TGetAdaptersInfo) (PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen); - typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, - PDWORD); + typedef NET_API_STATUS WINAPI (*TNetUserAdd) (LPCWSTR, DWORD, PBYTE, PDWORD); typedef NET_API_STATUS WINAPI (*TNetUserSetInfo) (LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE buf, - LPDWORD parm_err); + LPDWORD param_err); typedef NTSTATUS NTAPI (*TLsaOpenPolicy) (PLSA_UNICODE_STRING, - PLSA_OBJECT_ATTRIBUTES, - ACCESS_MASK, PLSA_HANDLE); + PLSA_OBJECT_ATTRIBUTES, ACCESS_MASK, + PLSA_HANDLE); typedef NTSTATUS NTAPI (*TLsaAddAccountRights) (LSA_HANDLE, PSID, PLSA_UNICODE_STRING, ULONG); - typedef NTSTATUS NTAPI (*TLsaRemoveAccountRights) (LSA_HANDLE, PSID, - BOOLEAN, + typedef NTSTATUS NTAPI (*TLsaRemoveAccountRights) (LSA_HANDLE, PSID, BOOLEAN, PLSA_UNICODE_STRING, ULONG); typedef NTSTATUS NTAPI (*TLsaClose) (LSA_HANDLE); @@ -140,8 +144,7 @@ extern "C" LPBOOL lpbDaclPresent, PACL * pDacl, LPBOOL lpbDaclDefaulted); - typedef BOOL WINAPI (*TGetAclInformation) (PACL pAcl, - LPVOID pAclInformation, + typedef BOOL WINAPI (*TGetAclInformation) (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass); @@ -161,6 +164,7 @@ extern "C" PSID psidGroup, PACL pDacl, PACL pSacl); + extern TGetBestInterfaceEx GNGetBestInterfaceEx; extern TNtQuerySystemInformation GNNtQuerySystemInformation; extern TGetIfEntry GNGetIfEntry; extern TGetIpAddrTable GNGetIpAddrTable; @@ -175,8 +179,7 @@ extern "C" extern TStartServiceCtrlDispatcher GNStartServiceCtrlDispatcher; extern TControlService GNControlService; extern TOpenService GNOpenService; - extern TGetBestInterface GNGetBestInterface; - extern TGetAdaptersInfo GGetAdaptersInfo; + extern TGetAdaptersInfo GNGetAdaptersInfo; extern TNetUserAdd GNNetUserAdd; extern TNetUserSetInfo GNNetUserSetInfo; extern TLsaOpenPolicy GNLsaOpenPolicy; @@ -198,16 +201,34 @@ extern "C" BOOL CreateShortcut (const char *pszSrc, const char *pszDest); BOOL DereferenceShortcut (char *pszShortcut); - long QueryRegistry (HKEY hMainKey, char *pszKey, char *pszSubKey, + long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey, char *pszBuffer, long *pdLength); - int ListNICs (void (*callback) (const char *, int, void *), void *cls); + int ListNICs (void (*callback) (void *, const char *, int), void *cls); BOOL AddPathAccessRights (char *lpszFileName, char *lpszAccountName, DWORD dwAccessMask); char *winErrorStr (const char *prefix, int dwErr); - - void GNInitWinEnv (); + void EnumNICs (PMIB_IFTABLE * pIfTable, PMIB_IPADDRTABLE * pAddrTable); + +#define ENUMNICS3_MASK_OK 0x01 +#define ENUMNICS3_BCAST_OK 0x02 + + struct EnumNICs3_results + { + unsigned char flags; + int is_default; + char pretty_name[1001]; + size_t addr_size; + SOCKADDR_STORAGE address; + SOCKADDR_STORAGE mask; + SOCKADDR_STORAGE broadcast; + }; + + int EnumNICs3 (struct EnumNICs3_results **, int *EnumNICs3_results_count); + void EnumNICs3_free (struct EnumNICs3_results *); + int GNInitWinEnv (); void GNShutdownWinEnv (); + BOOL SafeTerminateProcess (HANDLE hProcess, UINT uExitCode, DWORD dwTimeout); #ifdef __cplusplus } #endif