Avoid a few more GetModuleHandle calls.
[wine] / dlls / kernel / flatthunk.h
1 /*
2  * Win95 Flat Thunk data structures
3  *
4  * Copyright 1998 Ulrich Weigand
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_FLATTHUNK_H
22 #define __WINE_FLATTHUNK_H
23
24 #include <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28
29 struct ThunkDataCommon
30 {
31     char                   magic[4];         /* 00 */
32     DWORD                  checksum;         /* 04 */
33 };
34
35 struct ThunkDataLS16
36 {
37     struct ThunkDataCommon common;           /* 00 */
38     SEGPTR                 targetTable;      /* 08 */
39     DWORD                  firstTime;        /* 0C */
40 };
41
42 struct ThunkDataLS32
43 {
44     struct ThunkDataCommon common;           /* 00 */
45     DWORD *                targetTable;      /* 08 */
46     char                   lateBinding[4];   /* 0C */
47     DWORD                  flags;            /* 10 */
48     DWORD                  reserved1;        /* 14 */
49     DWORD                  reserved2;        /* 18 */
50     DWORD                  offsetQTThunk;    /* 1C */
51     DWORD                  offsetFTProlog;   /* 20 */
52 };
53
54 struct ThunkDataSL16
55 {
56     struct ThunkDataCommon common;            /* 00 */
57     DWORD                  flags1;            /* 08 */
58     DWORD                  reserved1;         /* 0C */
59     struct ThunkDataSL *   fpData;            /* 10 */
60     SEGPTR                 spData;            /* 14 */
61     DWORD                  reserved2;         /* 18 */
62     char                   lateBinding[4];    /* 1C */
63     DWORD                  flags2;            /* 20 */
64     DWORD                  reserved3;         /* 20 */
65     SEGPTR                 apiDatabase;       /* 28 */
66 };
67
68 struct ThunkDataSL32
69 {
70     struct ThunkDataCommon common;            /* 00 */
71     DWORD                  reserved1;         /* 08 */
72     struct ThunkDataSL *   data;              /* 0C */
73     char                   lateBinding[4];    /* 10 */
74     DWORD                  flags;             /* 14 */
75     DWORD                  reserved2;         /* 18 */
76     DWORD                  reserved3;         /* 1C */
77     DWORD                  offsetTargetTable; /* 20 */
78 };
79
80 struct ThunkDataSL
81 {
82 #if 0
83     This structure differs from the Win95 original,
84     but this should not matter since it is strictly internal to
85     the thunk handling routines in KRNL386 / KERNEL32.
86
87     For reference, here is the Win95 layout:
88
89     struct ThunkDataCommon common;            /* 00 */
90     DWORD                  flags1;            /* 08 */
91     SEGPTR                 apiDatabase;       /* 0C */
92     WORD                   exePtr;            /* 10 */
93     WORD                   segMBA;            /* 12 */
94     DWORD                  lenMBATotal;       /* 14 */
95     DWORD                  lenMBAUsed;        /* 18 */
96     DWORD                  flags2;            /* 1C */
97     char                   pszDll16[256];     /* 20 */
98     char                   pszDll32[256];     /*120 */
99
100     We do it differently since all our thunk handling is done
101     by 32-bit code. Therefore we do not need do provide
102     easy access to this data, especially the process target
103     table database, for 16-bit code.
104 #endif
105
106     struct ThunkDataCommon common;
107     DWORD                  flags1;
108     struct SLApiDB *       apiDB;
109     struct SLTargetDB *    targetDB;
110     DWORD                  flags2;
111     char                   pszDll16[256];
112     char                   pszDll32[256];
113 };
114
115 struct SLTargetDB
116 {
117      struct SLTargetDB *   next;
118      DWORD                 process;
119      DWORD *               targetTable;
120 };
121
122 struct SLApiDB
123 {
124     DWORD                  nrArgBytes;
125     DWORD                  errorReturnValue;
126 };
127
128
129 #endif /* __WINE_FLATTHUNK_H */
130