gio2 0.90.4-x86-mingw32 → 0.90.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,290 +0,0 @@
1
- # This is a shell script that calls functions and scripts from
2
- # tml@iki.fi's personal work environment. It is not expected to be
3
- # usable unmodified by others, and is included only for reference.
4
-
5
- MOD=glib
6
- VER=2.24.2
7
- REV=2
8
- ARCH=win32
9
-
10
- THIS=${MOD}_${VER}-${REV}_${ARCH}
11
-
12
- RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
13
- DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
14
-
15
- HEX=`echo $THIS | md5sum | cut -d' ' -f1`
16
- TARGET=c:/devel/target/$HEX
17
-
18
- usedev
19
- usemsvs6
20
-
21
- (
22
-
23
- set -x
24
-
25
- dos2unix glib/win_iconv.c
26
-
27
- patch --verbose --fuzz=0 -p1 <<'EOF'
28
- commit 86156c28b3b5a6cc2a3e22def530c355e9606504
29
- Author: Tor Lillqvist <tml@iki.fi>
30
- Date: Thu Sep 2 22:55:43 2010 +0300
31
-
32
- Reduce DLL hijack risk on Windows
33
-
34
- Don't call LoadLibrary() on shell32.dll or kernel32.dll. kernel32.dll
35
- is always loaded. Shell32.dll is also already loaded as glib links to
36
- functions in it. So just call GetModuleHandle() on them.
37
-
38
- For mlang.dll in win_iconv.c and winhttp.dll in gwinhttpvfs.c, always
39
- try loading them from a complete path, from the Windows system
40
- directory.
41
-
42
- Use the "tool help" API to enumerate modules in gmodule-win32.c. It is
43
- present in all Windows versions since Windows 2000, which is all we
44
- support anyway. Thus no need to look that API up dynamically. Just
45
- link to it normally. We can bin the fallback code that attempts to use
46
- the psapi API.
47
-
48
- diff --git a/gio/win32/gwinhttpvfs.c b/gio/win32/gwinhttpvfs.c
49
- index 494f53f..1e40324 100644
50
- --- a/gio/win32/gwinhttpvfs.c
51
- +++ b/gio/win32/gwinhttpvfs.c
52
- @@ -42,12 +42,23 @@ static GWinHttpDllFuncs funcs;
53
- static void
54
- lookup_funcs (void)
55
- {
56
- - HMODULE winhttp;
57
- + HMODULE winhttp = NULL;
58
- + char winhttp_dll[MAX_PATH + 100];
59
- + int n;
60
-
61
- if (lookup_done)
62
- return;
63
-
64
- - winhttp = LoadLibrary ("winhttp.dll");
65
- + n = GetSystemDirectory (winhttp_dll, MAX_PATH);
66
- + if (n > 0 && n < MAX_PATH)
67
- + {
68
- + if (winhttp_dll[n-1] != '\\' &&
69
- + winhttp_dll[n-1] != '/')
70
- + strcat (winhttp_dll, "\\");
71
- + strcat (winhttp_dll, "winhttp.dll");
72
- + winhttp = LoadLibrary (winhttp_dll);
73
- + }
74
- +
75
- if (winhttp != NULL)
76
- {
77
- funcs.pWinHttpCloseHandle = (BOOL (WINAPI *) (HINTERNET)) GetProcAddress (winhttp, "WinHttpCloseHandle");
78
- diff --git a/glib/gutils.c b/glib/gutils.c
79
- index 8698746..b89351b 100644
80
- --- a/glib/gutils.c
81
- +++ b/glib/gutils.c
82
- @@ -2262,13 +2262,15 @@ load_user_special_dirs (void)
83
- HANDLE hToken,
84
- PWSTR *ppszPath);
85
- t_SHGetKnownFolderPath p_SHGetKnownFolderPath;
86
- +
87
- static const GUID FOLDERID_Downloads =
88
- { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } };
89
- static const GUID FOLDERID_Public =
90
- { 0xDFDF76A2, 0xC82A, 0x4D63, { 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85 } };
91
- +
92
- wchar_t *wcp;
93
-
94
- - p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (LoadLibrary ("shell32.dll"),
95
- + p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (GetModuleHandle ("shell32.dll"),
96
- "SHGetKnownFolderPath");
97
-
98
- g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = get_special_folder (CSIDL_DESKTOPDIRECTORY);
99
- @@ -2594,7 +2596,7 @@ get_module_for_address (gconstpointer address)
100
- if (!beenhere)
101
- {
102
- p_GetModuleHandleExA =
103
- - (t_GetModuleHandleExA) GetProcAddress (LoadLibrary ("kernel32.dll"),
104
- + (t_GetModuleHandleExA) GetProcAddress (GetModuleHandle ("kernel32.dll"),
105
- "GetModuleHandleExA");
106
- beenhere = TRUE;
107
- }
108
- diff --git a/glib/win_iconv.c b/glib/win_iconv.c
109
- index ea19240..6d726d7 100644
110
- --- a/glib/win_iconv.c
111
- +++ b/glib/win_iconv.c
112
- @@ -706,10 +706,20 @@ static RFC1766TOLCIDA Rfc1766ToLcidA;
113
- static int
114
- load_mlang()
115
- {
116
- - HMODULE h;
117
- + HMODULE h = NULL;
118
- + char mlang_dll[MAX_PATH + 100];
119
- + int n;
120
- if (ConvertINetString != NULL)
121
- return TRUE;
122
- - h = LoadLibrary("mlang.dll");
123
- + n = GetSystemDirectory(mlang_dll, MAX_PATH);
124
- + if (n > 0 && n < MAX_PATH)
125
- + {
126
- + if (mlang_dll[n-1] != '\\' &&
127
- + mlang_dll[n-1] != '/')
128
- + strcat(mlang_dll, "\\");
129
- + strcat(mlang_dll, "mlang.dll");
130
- + h = LoadLibrary(mlang_dll);
131
- + }
132
- if (!h)
133
- return FALSE;
134
- ConvertINetString = (CONVERTINETSTRING)GetProcAddress(h, "ConvertINetString");
135
- diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c
136
- index 98d3fb9..439fb5d 100644
137
- --- a/gmodule/gmodule-win32.c
138
- +++ b/gmodule/gmodule-win32.c
139
- @@ -110,45 +110,22 @@ _g_module_close (gpointer handle,
140
- static gpointer
141
- find_in_any_module_using_toolhelp (const gchar *symbol_name)
142
- {
143
- - typedef HANDLE (WINAPI *PFNCREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
144
- - static PFNCREATETOOLHELP32SNAPSHOT pfnCreateToolhelp32Snapshot = NULL;
145
- -
146
- - typedef BOOL (WINAPI *PFNMODULE32FIRST)(HANDLE, MODULEENTRY32*);
147
- - static PFNMODULE32FIRST pfnModule32First= NULL;
148
- -
149
- - typedef BOOL (WINAPI *PFNMODULE32NEXT)(HANDLE, MODULEENTRY32*);
150
- - static PFNMODULE32NEXT pfnModule32Next = NULL;
151
- -
152
- - static HMODULE kernel32;
153
- -
154
- HANDLE snapshot;
155
- MODULEENTRY32 me32;
156
-
157
- gpointer p;
158
-
159
- - if (!pfnCreateToolhelp32Snapshot || !pfnModule32First || !pfnModule32Next)
160
- - {
161
- - if (!kernel32)
162
- - if (!(kernel32 = GetModuleHandle ("kernel32.dll")))
163
- - return NULL;
164
- -
165
- - if (!(pfnCreateToolhelp32Snapshot = (PFNCREATETOOLHELP32SNAPSHOT) GetProcAddress (kernel32, "CreateToolhelp32Snapshot"))
166
- - || !(pfnModule32First = (PFNMODULE32FIRST) GetProcAddress (kernel32, "Module32First"))
167
- - || !(pfnModule32Next = (PFNMODULE32NEXT) GetProcAddress (kernel32, "Module32Next")))
168
- - return NULL;
169
- - }
170
- -
171
- - if ((snapshot = (*pfnCreateToolhelp32Snapshot) (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1)
172
- + if ((snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1)
173
- return NULL;
174
-
175
- me32.dwSize = sizeof (me32);
176
- p = NULL;
177
- - if ((*pfnModule32First) (snapshot, &me32))
178
- + if (Module32First (snapshot, &me32))
179
- {
180
- do {
181
- if ((p = GetProcAddress (me32.hModule, symbol_name)) != NULL)
182
- break;
183
- - } while ((*pfnModule32Next) (snapshot, &me32));
184
- + } while (Module32Next (snapshot, &me32));
185
- }
186
-
187
- CloseHandle (snapshot);
188
- @@ -157,62 +134,11 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name)
189
- }
190
-
191
- static gpointer
192
- -find_in_any_module_using_psapi (const gchar *symbol_name)
193
- -{
194
- - static HMODULE psapi = NULL;
195
- -
196
- - typedef BOOL (WINAPI *PFNENUMPROCESSMODULES) (HANDLE, HMODULE *, DWORD, LPDWORD) ;
197
- - static PFNENUMPROCESSMODULES pfnEnumProcessModules = NULL;
198
- -
199
- - HMODULE *modules;
200
- - HMODULE dummy;
201
- - gint i, size;
202
- - DWORD needed;
203
- -
204
- - gpointer p;
205
- -
206
- - if (!pfnEnumProcessModules)
207
- - {
208
- - if (!psapi)
209
- - if ((psapi = LoadLibrary ("psapi.dll")) == NULL)
210
- - return NULL;
211
- -
212
- - if (!(pfnEnumProcessModules = (PFNENUMPROCESSMODULES) GetProcAddress (psapi, "EnumProcessModules")))
213
- - return NULL;
214
- - }
215
- -
216
- - if (!(*pfnEnumProcessModules) (GetCurrentProcess (), &dummy,
217
- - sizeof (HMODULE), &needed))
218
- - return NULL;
219
- -
220
- - size = needed + 10 * sizeof (HMODULE);
221
- - modules = g_malloc (size);
222
- -
223
- - if (!(*pfnEnumProcessModules) (GetCurrentProcess (), modules,
224
- - size, &needed)
225
- - || needed > size)
226
- - {
227
- - g_free (modules);
228
- - return NULL;
229
- - }
230
- -
231
- - p = NULL;
232
- - for (i = 0; i < needed / sizeof (HMODULE); i++)
233
- - if ((p = GetProcAddress (modules[i], symbol_name)) != NULL)
234
- - break;
235
- -
236
- - g_free (modules);
237
- -
238
- - return p;
239
- -}
240
- -
241
- -static gpointer
242
- find_in_any_module (const gchar *symbol_name)
243
- {
244
- gpointer result;
245
-
246
- - if ((result = find_in_any_module_using_toolhelp (symbol_name)) == NULL
247
- - && (result = find_in_any_module_using_psapi (symbol_name)) == NULL)
248
- + if ((result = find_in_any_module_using_toolhelp (symbol_name)) == NULL)
249
- return NULL;
250
- else
251
- return result;
252
- EOF
253
-
254
- DEPS=`latest --arch=${ARCH} gettext-runtime gettext-tools glib pkg-config`
255
- PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
256
- ZLIB=`latest --arch=${ARCH} zlib`
257
-
258
- PKG_CONFIG_PATH=/dummy
259
- for D in $DEPS; do
260
- PATH=/devel/dist/${ARCH}/$D/bin:$PATH
261
- [ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
262
- done
263
-
264
- lt_cv_deplibs_check_method='pass_all' \
265
- CC='gcc -mtune=pentium3 -mthreads' \
266
- CPPFLAGS="-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include \
267
- -I/devel/dist/${ARCH}/${ZLIB}/include" \
268
- LDFLAGS="-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a -Wl,--enable-auto-image-base \
269
- -L/devel/dist/${ARCH}/${ZLIB}/lib" \
270
- CFLAGS=-O2 \
271
- ./configure \
272
- --enable-silent-rules \
273
- --disable-gtk-doc \
274
- --prefix=$TARGET &&
275
-
276
- make glibconfig.h.win32 &&
277
- make glibconfig.h &&
278
- mv glibconfig.h glibconfig.h.autogened &&
279
- cp glibconfig.h.win32 glibconfig.h &&
280
- PATH="/devel/target/$HEX/bin:$PATH" make -j3 install &&
281
-
282
- ./glib-zip &&
283
-
284
- mv /tmp/glib-$VER.zip /tmp/$RUNZIP &&
285
- mv /tmp/glib-dev-$VER.zip /tmp/$DEVZIP
286
-
287
- ) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
288
-
289
- (cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
290
- manifestify /tmp/$RUNZIP /tmp/$DEVZIP