Signed-off-by: Huw Davies huw@codeweavers.com --- include/Makefile.in | 1 + include/netiodef.h | 68 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 include/netiodef.h
diff --git a/include/Makefile.in b/include/Makefile.in index 5b84d7858ff..4a8c261bb8f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -524,6 +524,7 @@ SOURCES = \ netcon.idl \ netfw.idl \ netioapi.h \ + netiodef.h \ netlistmgr.idl \ newdev.h \ nldef.h \ diff --git a/include/netiodef.h b/include/netiodef.h new file mode 100644 index 00000000000..4d8d469b138 --- /dev/null +++ b/include/netiodef.h @@ -0,0 +1,68 @@ +/* + * Copyright 2021 Huw Davies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_NETIODEF_H +#define __WINE_NETIODEF_H + +typedef enum _NPI_MODULEID_TYPE +{ + MIT_GUID = 1, + MIT_IF_LUID +} NPI_MODULEID_TYPE; + +typedef struct _NPI_MODULEID +{ + USHORT Length; + NPI_MODULEID_TYPE Type; + union + { + GUID Guid; + LUID IfLuid; + } DUMMYUNIONNAME; +} NPI_MODULEID; + +typedef const NPI_MODULEID *PNPI_MODULEID; + +#ifdef NONAMELESSUNION +#define _U(x) (x).u +#else +#define _U(x) (x) +#endif + +static inline BOOLEAN NmrIsEqualNpiModuleId( const NPI_MODULEID *mod1, const NPI_MODULEID *mod2 ) +{ + if (mod1->Type == mod2->Type) + { + if (mod1->Type == MIT_GUID) + { +#ifdef __cplusplus + return IsEqualGUID( _U(*mod1).Guid, _U(*mod2).Guid ); +#else + return IsEqualGUID( &_U(*mod1).Guid, &_U(*mod2).Guid ); +#endif + } + else if (mod1->Type == MIT_IF_LUID) + return _U(*mod1).IfLuid.HighPart == _U(*mod2).IfLuid.HighPart && + _U(*mod1).IfLuid.LowPart == _U(*mod2).IfLuid.LowPart; + } + return FALSE; +} + +#undef _U + +#endif /* __WINE_NETIODEF_H */