[PATCH] ntdll: Add dummy apiset to PEB.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed May 1 23:56:44 CDT 2019


Hi Vijay,

The main reason I haven't pushed this commit is that it should have some 
tests.

I was thinking of using ApiSetQueryApiSetPresence to test the ApiSet change.


Regards

Alistair.


On 2/5/19 11:01 am, Vijay Kiran Kamuju wrote:
> From: Michael Müller <michael at fds-team.de>
>
> Wine-Bug: https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.winehq.org%2Fshow_bug.cgi%3Fid%3D44658&data=02%7C01%7C%7C90603468a8eb46f474bb08d6ce99d459%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636923557419910653&sdata=Swmos5%2Bd8WXSKhfNasBGuDhNd0Nujv1Vdw0tOUM0U7Y%3D&reserved=0
> From: Michael Müller <michael at fds-team.de>
> Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
> ---
>   dlls/ntdll/thread.c |  2 ++
>   include/Makefile.in |  1 +
>   include/apiset.h    | 37 +++++++++++++++++++++++++++++++++++++
>   include/winternl.h  |  3 ++-
>   4 files changed, 42 insertions(+), 1 deletion(-)
>   create mode 100644 include/apiset.h
>
> diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
> index be4621819bc..d687043f51b 100644
> --- a/dlls/ntdll/thread.c
> +++ b/dlls/ntdll/thread.c
> @@ -70,6 +70,7 @@ static PEB_LDR_DATA ldr;
>   static RTL_BITMAP tls_bitmap;
>   static RTL_BITMAP tls_expansion_bitmap;
>   static RTL_BITMAP fls_bitmap;
> +static API_SET_NAMESPACE_ARRAY apiset_map;
>   static int nb_threads = 1;
>   
>   static RTL_CRITICAL_SECTION peb_lock;
> @@ -189,6 +190,7 @@ void thread_init(void)
>       peb = addr;
>   
>       peb->FastPebLock        = &peb_lock;
> +    peb->ApiSetMap          = &apiset_map;
>       peb->TlsBitmap          = &tls_bitmap;
>       peb->TlsExpansionBitmap = &tls_expansion_bitmap;
>       peb->FlsBitmap          = &fls_bitmap;
> diff --git a/include/Makefile.in b/include/Makefile.in
> index 6c8d39ab76b..6ec4c51f18e 100644
> --- a/include/Makefile.in
> +++ b/include/Makefile.in
> @@ -14,6 +14,7 @@ SOURCES = \
>   	amsi.idl \
>   	amstream.idl \
>   	amvideo.idl \
> +	apiset.h \
>   	appcompatapi.h \
>   	appmgmt.h \
>   	appmodel.h \
> diff --git a/include/apiset.h b/include/apiset.h
> new file mode 100644
> index 00000000000..6801cd5f509
> --- /dev/null
> +++ b/include/apiset.h
> @@ -0,0 +1,37 @@
> +/*
> + * Copyright (C) 2017 Michael Müller
> + *
> + * 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 _API_SET_H_
> +#define _API_SET_H_
> +
> +#include <windef.h>
> +
> +typedef struct _API_SET_NAMESPACE_ENTRY
> +{
> +    ULONG NameOffset;
> +    ULONG NameLength;
> +    ULONG DataOffset;
> +} API_SET_NAMESPACE_ENTRY, *PAPI_SET_NAMESPACE_ENTRY;
> +
> +typedef struct _API_SET_NAMESPACE_ARRAY
> +{
> +    ULONG Version;
> +    ULONG Count;
> +    API_SET_NAMESPACE_ENTRY Array[1];
> +} API_SET_NAMESPACE_ARRAY, *PAPI_SET_NAMESPACE_ARRAY;
> +
> +#endif
> diff --git a/include/winternl.h b/include/winternl.h
> index 2b3fb947b9b..1832f49994c 100644
> --- a/include/winternl.h
> +++ b/include/winternl.h
> @@ -23,6 +23,7 @@
>   
>   #include <ntdef.h>
>   #include <windef.h>
> +#include <apiset.h>
>   
>   #ifdef __cplusplus
>   extern "C" {
> @@ -286,7 +287,7 @@ typedef struct _PEB
>       ULONG                        EnvironmentUpdateCount;            /* 028/050 */
>       PVOID                        KernelCallbackTable;               /* 02c/058 */
>       ULONG                        Reserved[2];                       /* 030/060 */
> -    PVOID /*PPEB_FREE_BLOCK*/    FreeList;                          /* 038/068 */
> +    PAPI_SET_NAMESPACE_ARRAY     ApiSetMap;                         /* 038/068 */
>       ULONG                        TlsExpansionCounter;               /* 03c/070 */
>       PRTL_BITMAP                  TlsBitmap;                         /* 040/078 */
>       ULONG                        TlsBitmapBits[2];                  /* 044/080 */


More information about the wine-devel mailing list