ReactOS  0.4.14-dev-49-gfb4591c
main.c
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Hans Leidekker for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include "config.h"
20 #include "wine/port.h"
21 
22 #include <stdarg.h>
23 #include <sys/types.h>
24 #ifdef HAVE_SYS_SOCKET_H
25 # include <sys/socket.h>
26 #endif
27 #ifdef HAVE_NETINET_IN_H
28 # include <netinet/in.h>
29 #endif
30 #ifdef HAVE_NETDB_H
31 # include <netdb.h>
32 #endif
33 #ifdef __REACTOS__
34 #define COBJMACROS
35 #endif
36 #if defined(__MINGW32__) || defined (_MSC_VER)
37 # include <ws2tcpip.h>
38 #else
39 # define closesocket close
40 # define ioctlsocket ioctl
41 #endif
42 
43 #include "windef.h"
44 #include "winbase.h"
45 #ifndef __MINGW32__
46 #define USE_WS_PREFIX
47 #endif
48 #include "winsock2.h"
49 #include "ws2ipdef.h"
50 #include "winnls.h"
51 #include "wininet.h"
52 #ifndef __REACTOS__
53 #define COBJMACROS
54 #endif
55 #include "ole2.h"
56 #include "dispex.h"
57 #include "activscp.h"
58 #include "wine/debug.h"
59 #include "wine/heap.h"
60 #include "wine/unicode.h"
61 
63 
65 
68 {
69  0, 0, &cs_jsproxy,
71  0, 0, { (DWORD_PTR)(__FILE__ ": cs_jsproxy") }
72 };
73 static CRITICAL_SECTION cs_jsproxy = { &critsect_debug, -1, 0, 0, 0, 0 };
74 
75 static const WCHAR global_funcsW[] = {'g','l','o','b','a','l','_','f','u','n','c','s',0};
76 static const WCHAR dns_resolveW[] = {'d','n','s','_','r','e','s','o','l','v','e',0};
77 
78 /******************************************************************
79  * DllMain (jsproxy.@)
80  */
82 {
83  switch (reason)
84  {
85  case DLL_PROCESS_ATTACH:
86  instance = hinst;
88  break;
89 
90  case DLL_PROCESS_DETACH:
91  break;
92  }
93  return TRUE;
94 }
95 
96 static inline WCHAR *strdupAW( const char *src, int len )
97 {
98  WCHAR *dst = NULL;
99  if (src)
100  {
101  int dst_len = MultiByteToWideChar( CP_ACP, 0, src, len, NULL, 0 );
102  if ((dst = heap_alloc( (dst_len + 1) * sizeof(WCHAR) )))
103  {
104  len = MultiByteToWideChar( CP_ACP, 0, src, len, dst, dst_len );
105  dst[dst_len] = 0;
106  }
107  }
108  return dst;
109 }
110 
111 static inline char *strdupWA( const WCHAR *src )
112 {
113  char *dst = NULL;
114  if (src)
115  {
116  int len = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
117  if ((dst = heap_alloc( len ))) WideCharToMultiByte( CP_ACP, 0, src, -1, dst, len, NULL, NULL );
118  }
119  return dst;
120 }
121 
122 static struct pac_script
123 {
125 } pac_script;
127 
128 /******************************************************************
129  * InternetDeInitializeAutoProxyDll (jsproxy.@)
130  */
132 {
133  TRACE( "%s, %u\n", debugstr_a(mime), reserved );
134 
136 
137  heap_free( global_script->text );
138  global_script->text = NULL;
139 
141  return TRUE;
142 }
143 
144 static WCHAR *load_script( const char *filename )
145 {
146  HANDLE handle;
147  DWORD size, bytes_read;
148  char *buffer;
149  int len;
150  WCHAR *script = NULL;
151 
153  if (handle == INVALID_HANDLE_VALUE) return NULL;
154 
155  size = GetFileSize( handle, NULL );
156  if (!(buffer = heap_alloc( size ))) goto done;
157  if (!ReadFile( handle, buffer, size, &bytes_read, NULL ) || bytes_read != size) goto done;
158 
160  if (!(script = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto done;
162  script[len] = 0;
163 
164 done:
165  CloseHandle( handle );
166  heap_free( buffer );
167  return script;
168 }
169 
170 /******************************************************************
171  * InternetInitializeAutoProxyDll (jsproxy.@)
172  */
176 {
177  BOOL ret = FALSE;
178 
179  TRACE( "%u, %s, %s, %p, %p\n", version, debugstr_a(tmpfile), debugstr_a(mime), callbacks, buffer );
180 
181  if (callbacks) FIXME( "callbacks not supported\n" );
182 
184 
185  if (buffer && buffer->dwStructSize == sizeof(*buffer) && buffer->lpszScriptBuffer)
186  {
187  if (!buffer->dwScriptBufferSize)
188  {
191  return FALSE;
192  }
193  heap_free( global_script->text );
194  if ((global_script->text = strdupAW( buffer->lpszScriptBuffer,
195  buffer->dwScriptBufferSize ))) ret = TRUE;
196  }
197  else
198  {
199  heap_free( global_script->text );
200  if ((global_script->text = load_script( tmpfile ))) ret = TRUE;
201  }
202 
204  return ret;
205 }
206 
208  IDispatchEx *iface, REFIID riid, void **ppv )
209 {
210  *ppv = NULL;
211 
212  if (IsEqualGUID( riid, &IID_IUnknown ) ||
214  IsEqualGUID( riid, &IID_IDispatchEx ))
215  *ppv = iface;
216  else
217  return E_NOINTERFACE;
218 
219  return S_OK;
220 }
221 
223  IDispatchEx *iface )
224 {
225  return 2;
226 }
227 
229  IDispatchEx *iface )
230 {
231  return 1;
232 }
233 
235  IDispatchEx *iface, UINT *info )
236 {
237  return E_NOTIMPL;
238 }
239 
241  IDispatchEx *iface, UINT info, LCID lcid, ITypeInfo **type_info )
242 {
243  return E_NOTIMPL;
244 }
245 
247  IDispatchEx *iface, REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *id )
248 {
249  return E_NOTIMPL;
250 }
251 
253  IDispatchEx *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
255 {
256  return E_NOTIMPL;
257 }
258 
260  IDispatchEx *iface, BSTR name, DWORD flags )
261 {
262  return E_NOTIMPL;
263 }
264 
266  IDispatchEx *iface, DISPID id )
267 {
268  return E_NOTIMPL;
269 }
270 
272  IDispatchEx *iface, DISPID id, DWORD flags_fetch, DWORD *flags )
273 {
274  return E_NOTIMPL;
275 }
276 
278  IDispatchEx *iface, DISPID id, BSTR *name )
279 {
280  return E_NOTIMPL;
281 }
282 
284  IDispatchEx *iface, DWORD flags, DISPID id, DISPID *next )
285 {
286  return E_NOTIMPL;
287 }
288 
290  IDispatchEx *iface, IUnknown **unk )
291 {
292  return E_NOTIMPL;
293 }
294 
295 #define DISPID_GLOBAL_DNSRESOLVE 0x1000
296 
298  IDispatchEx *iface, BSTR name, DWORD flags, DISPID *id )
299 {
300  if (!strcmpW( name, dns_resolveW ))
301  {
303  return S_OK;
304  }
305  return DISP_E_UNKNOWNNAME;
306 }
307 
308 static char *get_computer_name( COMPUTER_NAME_FORMAT format )
309 {
310  char *ret;
311  DWORD size = 0;
312 
314  if (GetLastError() != ERROR_MORE_DATA) return NULL;
315  if (!(ret = heap_alloc( size ))) return NULL;
316  if (!GetComputerNameExA( format, ret, &size ))
317  {
318  heap_free( ret );
319  return NULL;
320  }
321  return ret;
322 }
323 
324 static void printf_addr( const WCHAR *fmt, WCHAR *buf, struct sockaddr_in *addr )
325 {
326  sprintfW( buf, fmt,
327  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 24 & 0xff),
328  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 16 & 0xff),
329  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 8 & 0xff),
330  (unsigned int)(ntohl( addr->sin_addr.s_addr ) & 0xff) );
331 }
332 
334 {
335 #ifdef HAVE_GETADDRINFO
336  static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
337  WCHAR addr[16];
338  struct addrinfo *ai, *elem;
339  char *hostnameA;
340  int res;
341 
342  if (hostname[0])
343  hostnameA = strdupWA( hostname );
344  else
345  hostnameA = get_computer_name( ComputerNamePhysicalDnsFullyQualified );
346 
347  if (!hostnameA) return E_OUTOFMEMORY;
348  res = getaddrinfo( hostnameA, NULL, NULL, &ai );
349  heap_free( hostnameA );
350  if (res) return S_FALSE;
351 
352  elem = ai;
353  while (elem && elem->ai_family != AF_INET) elem = elem->ai_next;
354  if (!elem)
355  {
356  freeaddrinfo( ai );
357  return S_FALSE;
358  }
359  printf_addr( fmtW, addr, (struct sockaddr_in *)elem->ai_addr );
360  freeaddrinfo( ai );
361  V_VT( result ) = VT_BSTR;
363  return S_OK;
364 #else
365  FIXME("getaddrinfo not found at build time\n");
366  return S_FALSE;
367 #endif
368 }
369 
371  IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
372  VARIANT *result, EXCEPINFO *exep, IServiceProvider *caller )
373 {
374  if (id == DISPID_GLOBAL_DNSRESOLVE)
375  {
376  if (params->cArgs != 1) return DISP_E_BADPARAMCOUNT;
377  if (V_VT(&params->rgvarg[0]) != VT_BSTR) return DISP_E_BADVARTYPE;
378  return dns_resolve( V_BSTR(&params->rgvarg[0]), result );
379  }
380  return DISP_E_MEMBERNOTFOUND;
381 }
382 
383 static const IDispatchExVtbl dispex_vtbl =
384 {
400 };
401 
402 static IDispatchEx global_dispex = { &dispex_vtbl };
403 
405  IActiveScriptSite *iface, REFIID riid, void **ppv )
406 {
407  *ppv = NULL;
408 
409  if (IsEqualGUID( &IID_IUnknown, riid ))
410  *ppv = iface;
411  else if (IsEqualGUID( &IID_IActiveScriptSite, riid ))
412  *ppv = iface;
413  else
414  return E_NOINTERFACE;
415 
416  IUnknown_AddRef( (IUnknown *)*ppv );
417  return S_OK;
418 }
419 
421  IActiveScriptSite *iface )
422 {
423  return 2;
424 }
425 
427  IActiveScriptSite *iface )
428 {
429  return 1;
430 }
431 
433  IActiveScriptSite *iface, LCID *lcid )
434 {
435  return E_NOTIMPL;
436 }
437 
439  IActiveScriptSite *iface, LPCOLESTR name, DWORD mask,
441 {
442  if (!strcmpW( name, global_funcsW ) && mask == SCRIPTINFO_IUNKNOWN)
443  {
444  *item = (IUnknown *)&global_dispex;
445  return S_OK;
446  }
447  return E_NOTIMPL;
448 }
449 
451  IActiveScriptSite *iface, BSTR *version )
452 {
453  return E_NOTIMPL;
454 }
455 
457  IActiveScriptSite *iface, const VARIANT *result, const EXCEPINFO *info )
458 {
459  return E_NOTIMPL;
460 }
461 
464 {
465  return E_NOTIMPL;
466 }
467 
470 {
471  return E_NOTIMPL;
472 }
473 
475  IActiveScriptSite *iface )
476 {
477  return E_NOTIMPL;
478 }
479 
481  IActiveScriptSite *iface )
482 {
483  return E_NOTIMPL;
484 }
485 
486 static const IActiveScriptSiteVtbl site_vtbl =
487 {
489  site_AddRef,
490  site_Release,
491  site_GetLCID,
499 };
500 
502 
504 {
505  static const WCHAR pacjsW[] = {'p','a','c','.','j','s',0};
506  HMODULE hmod = GetModuleHandleA( "jsproxy.dll" );
507  HRSRC rsrc;
508  DWORD size;
509  const char *data;
510  BSTR ret;
511  int len;
512 
513  if (!(rsrc = FindResourceW( hmod, pacjsW, (LPCWSTR)40 ))) return NULL;
514  size = SizeofResource( hmod, rsrc );
515  data = LoadResource( hmod, rsrc );
516 
517  len = MultiByteToWideChar( CP_ACP, 0, data, size, NULL, 0 );
518  if (!(ret = SysAllocStringLen( NULL, len + strlenW( script ) + 1 ))) return NULL;
520  strcpyW( ret + len, script );
521  return ret;
522 }
523 
524 #ifdef _WIN64
525 #define IActiveScriptParse_Release IActiveScriptParse64_Release
526 #define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
527 #define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
528 #else
529 #define IActiveScriptParse_Release IActiveScriptParse32_Release
530 #define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
531 #define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
532 #endif
533 
534 static BOOL run_script( const WCHAR *script, const WCHAR *url, const WCHAR *hostname, char **result_str, DWORD *result_len )
535 {
536  static const WCHAR jscriptW[] = {'J','S','c','r','i','p','t',0};
537  static const WCHAR findproxyW[] = {'F','i','n','d','P','r','o','x','y','F','o','r','U','R','L',0};
538  IActiveScriptParse *parser = NULL;
539  IActiveScript *engine = NULL;
541  BOOL ret = FALSE;
542  CLSID clsid;
543  DISPID dispid;
544  BSTR func = NULL, full_script = NULL;
545  VARIANT args[2], retval;
547  HRESULT hr, init;
548 
549  init = CoInitialize( NULL );
550  hr = CLSIDFromProgID( jscriptW, &clsid );
551  if (hr != S_OK) goto done;
552 
553  hr = CoCreateInstance( &clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
554  &IID_IActiveScript, (void **)&engine );
555  if (hr != S_OK) goto done;
556 
557  hr = IActiveScript_QueryInterface( engine, &IID_IActiveScriptParse, (void **)&parser );
558  if (hr != S_OK) goto done;
559 
561  if (hr != S_OK) goto done;
562 
563  hr = IActiveScript_SetScriptSite( engine, &script_site );
564  if (hr != S_OK) goto done;
565 
566  hr = IActiveScript_AddNamedItem( engine, global_funcsW, SCRIPTITEM_GLOBALMEMBERS );
567  if (hr != S_OK) goto done;
568 
569  if (!(full_script = include_pac_utils( script ))) goto done;
570 
571  hr = IActiveScriptParse_ParseScriptText( parser, full_script, NULL, NULL, NULL, 0, 0, 0, NULL, NULL );
572  if (hr != S_OK) goto done;
573 
574  hr = IActiveScript_SetScriptState( engine, SCRIPTSTATE_STARTED );
575  if (hr != S_OK) goto done;
576 
577  hr = IActiveScript_GetScriptDispatch( engine, NULL, &dispatch );
578  if (hr != S_OK) goto done;
579 
580  if (!(func = SysAllocString( findproxyW ))) goto done;
581  hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &func, 1, LOCALE_SYSTEM_DEFAULT, &dispid );
582  if (hr != S_OK) goto done;
583 
584  V_VT( &args[0] ) = VT_BSTR;
585  V_BSTR( &args[0] ) = SysAllocString( hostname );
586  V_VT( &args[1] ) = VT_BSTR;
587  V_BSTR( &args[1] ) = SysAllocString( url );
588 
589  params.rgvarg = args;
590  params.rgdispidNamedArgs = NULL;
591  params.cArgs = 2;
592  params.cNamedArgs = 0;
593  hr = IDispatch_Invoke( dispatch, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
594  &params, &retval, NULL, NULL );
595  VariantClear( &args[0] );
596  VariantClear( &args[1] );
597  if (hr != S_OK)
598  {
599  WARN("script failed 0x%08x\n", hr);
600  goto done;
601  }
602  if ((*result_str = strdupWA( V_BSTR( &retval ) )))
603  {
604  TRACE( "result: %s\n", debugstr_a(*result_str) );
605  *result_len = strlen( *result_str ) + 1;
606  ret = TRUE;
607  }
608  VariantClear( &retval );
609 
610 done:
611  SysFreeString( full_script );
612  SysFreeString( func );
613  if (dispatch) IDispatch_Release( dispatch );
615  if (engine) IActiveScript_Release( engine );
616  if (SUCCEEDED( init )) CoUninitialize();
617  return ret;
618 }
619 
620 /******************************************************************
621  * InternetGetProxyInfo (jsproxy.@)
622  */
624  LPDWORD len_proxy )
625 {
626  WCHAR *urlW = NULL, *hostnameW = NULL;
627  BOOL ret = FALSE;
628 
629  TRACE( "%s, %u, %s, %u, %p, %p\n", debugstr_a(url), len_url, hostname, len_hostname, proxy, len_proxy );
630 
632 
633  if (!global_script->text)
634  {
636  goto done;
637  }
638  if (hostname && len_hostname < strlen( hostname ))
639  {
641  goto done;
642  }
643  if (!(urlW = strdupAW( url, -1 ))) goto done;
644  if (hostname && !(hostnameW = strdupAW( hostname, -1 ))) goto done;
645 
646  TRACE( "%s\n", debugstr_w(global_script->text) );
647  ret = run_script( global_script->text, urlW, hostnameW, proxy, len_proxy );
648 
649 done:
650  heap_free( hostnameW );
651  heap_free( urlW );
653  return ret;
654 }
static HRESULT WINAPI dispex_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *exep, IServiceProvider *caller)
Definition: main.c:370
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
GLenum func
Definition: glext.h:6028
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
static HRESULT WINAPI site_OnScriptTerminate(IActiveScriptSite *iface, const VARIANT *result, const EXCEPINFO *info)
Definition: main.c:456
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define E_NOINTERFACE
Definition: winerror.h:2364
#define freeaddrinfo
Definition: wspiapi.h:46
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define DWORD_PTR
Definition: treelist.c:76
#define WideCharToMultiByte
Definition: compat.h:101
static HRESULT WINAPI dispex_GetTypeInfoCount(IDispatchEx *iface, UINT *info)
Definition: main.c:234
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
WINE_DEFAULT_DEBUG_CHANNEL(wmic)
const WCHAR * mime
Definition: mimefilter.c:512
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: main.c:67
REFIID riid
Definition: precomp.h:44
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT dns_resolve(const WCHAR *hostname, VARIANT *result)
Definition: main.c:333
#define IActiveScriptParse_Release
Definition: main.c:529
#define WARN(fmt,...)
Definition: debug.h:111
static IActiveScriptSite script_site
Definition: main.c:501
static HRESULT WINAPI dispex_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: main.c:207
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
static WCHAR * strdupAW(const char *src, int len)
Definition: main.c:96
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const WCHAR global_funcsW[]
Definition: main.c:75
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
static HRESULT WINAPI site_OnEnterScript(IActiveScriptSite *iface)
Definition: main.c:474
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static HRESULT WINAPI site_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR name, DWORD mask, IUnknown **item, ITypeInfo **type_info)
Definition: main.c:438
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1934
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
Definition: compname.c:370
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
char * LPSTR
Definition: xmlstorage.h:182
const char * filename
Definition: ioapi.h:135
static LPOLESTR
Definition: stg_prop.c:27
Definition: match.c:390
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2511
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static HRESULT WINAPI site_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
Definition: main.c:404
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FILE_SHARE_READ
Definition: compat.h:125
#define DISPATCH_METHOD
Definition: oleauto.h:1006
static ULONG WINAPI site_Release(IActiveScriptSite *iface)
Definition: main.c:426
char * hostname
Definition: ftp.c:88
static HRESULT WINAPI dispex_GetNextDispID(IDispatchEx *iface, DWORD flags, DISPID id, DISPID *next)
Definition: main.c:283
static HRESULT WINAPI dispex_DeleteMemberByName(IDispatchEx *iface, BSTR name, DWORD flags)
Definition: main.c:259
#define DISPID_GLOBAL_DNSRESOLVE
Definition: main.c:295
GLuint GLuint * names
Definition: glext.h:11545
GLenum GLint GLuint mask
Definition: glext.h:6028
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
static struct pac_script * global_script
Definition: main.c:126
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
static ULONG WINAPI dispex_Release(IDispatchEx *iface)
Definition: main.c:228
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI dispex_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD flags_fetch, DWORD *flags)
Definition: main.c:271
r reserved
Definition: btrfs.c:2893
#define S_FALSE
Definition: winerror.h:2357
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
static const IActiveScriptSiteVtbl site_vtbl
Definition: main.c:486
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
script
Definition: msipriv.h:374
BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll(DWORD version, LPSTR tmpfile, LPSTR mime, AutoProxyHelperFunctions *callbacks, LPAUTO_PROXY_SCRIPT_BUFFER buffer)
Definition: main.c:173
const char * LPCSTR
Definition: xmlstorage.h:183
#define OPEN_EXISTING
Definition: compat.h:426
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static BOOL run_script(const WCHAR *script, const WCHAR *url, const WCHAR *hostname, char **result_str, DWORD *result_len)
Definition: main.c:534
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
#define IActiveScriptParse_InitNew
Definition: main.c:530
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static HRESULT WINAPI dispex_GetDispID(IDispatchEx *iface, BSTR name, DWORD flags, DISPID *id)
Definition: main.c:297
__wchar_t WCHAR
Definition: xmlstorage.h:180
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: main.c:308
static HRESULT WINAPI site_OnLeaveScript(IActiveScriptSite *iface)
Definition: main.c:480
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
const GUID IID_IUnknown
#define IActiveScriptParse_ParseScriptText
Definition: main.c:531
static HINSTANCE instance
Definition: main.c:62
#define WINAPI
Definition: msvc.h:8
#define LOCALE_SYSTEM_DEFAULT
unsigned short WORD
Definition: ntddk_ex.h:93
static WCHAR * load_script(const char *filename)
Definition: main.c:144
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
#define SetLastError(x)
Definition: compat.h:409
static BSTR include_pac_utils(const WCHAR *script)
Definition: main.c:503
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
char * args[]
Definition: main.c:34
GLbitfield flags
Definition: glext.h:7161
const GUID IID_IDispatch
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
static HRESULT WINAPI site_GetLCID(IActiveScriptSite *iface, LCID *lcid)
Definition: main.c:432
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
int ret
static BOOL init(void)
Definition: main.c:59
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
GLenum const GLvoid * addr
Definition: glext.h:9621
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
static int state
Definition: maze.c:121
GLenum GLsizei len
Definition: glext.h:6722
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GENERIC_READ
Definition: compat.h:124
GLenum src
Definition: glext.h:6340
#define err(...)
static HRESULT WINAPI dispex_Invoke(IDispatchEx *iface, DISPID member, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep, UINT *err)
Definition: main.c:252
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:66
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define V_BSTR(A)
Definition: oleauto.h:226
static HRESULT WINAPI site_GetDocVersionString(IActiveScriptSite *iface, BSTR *version)
Definition: main.c:450
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static unsigned __int64 next
Definition: rand_nt.c:6
static ATOM item
Definition: dde.c:856
static char * strdupWA(const WCHAR *src)
Definition: main.c:111
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static void printf_addr(const WCHAR *fmt, WCHAR *buf, struct sockaddr_in *addr)
Definition: main.c:324
WCHAR * text
Definition: main.c:124
#define E_NOTIMPL
Definition: ddrawi.h:99
GLenum GLenum dst
Definition: glext.h:6340
#define sprintfW
Definition: unicode.h:58
static struct pac_script pac_script
SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION enum tagSCRIPTSTATE SCRIPTSTATE
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static HRESULT WINAPI dispex_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *id)
Definition: main.c:246
static HRESULT WINAPI dispex_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: main.c:265
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define DISP_E_BADPARAMCOUNT
Definition: winerror.h:2523
#define MultiByteToWideChar
Definition: compat.h:100
static HRESULT WINAPI site_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE state)
Definition: main.c:462
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
Definition: import.c:86
static IDispatchEx global_dispex
Definition: main.c:402
Definition: name.c:36
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
uint32_t * LPDWORD
Definition: typedefs.h:57
unsigned int ULONG
Definition: retypes.h:1
#define AF_INET
Definition: tcpip.h:117
static HINSTANCE hinst
Definition: edit.c:551
static HRESULT WINAPI dispex_GetNameSpaceParent(IDispatchEx *iface, IUnknown **unk)
Definition: main.c:289
BOOL WINAPI InternetGetProxyInfo(LPCSTR url, DWORD len_url, LPCSTR hostname, DWORD len_hostname, LPSTR *proxy, LPDWORD len_proxy)
Definition: main.c:623
static CRITICAL_SECTION cs_jsproxy
Definition: main.c:66
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI dispex_GetTypeInfo(IDispatchEx *iface, UINT info, LCID lcid, ITypeInfo **type_info)
Definition: main.c:240
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
static int callbacks
Definition: xmllint.c:873
static HRESULT WINAPI dispex_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *name)
Definition: main.c:277
int proxy
Definition: main.c:67
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
static const IDispatchExVtbl dispex_vtbl
Definition: main.c:383
GLuint64EXT * result
Definition: glext.h:11304
Definition: dsound.c:943
static const WCHAR dns_resolveW[]
Definition: main.c:76
static ULONG WINAPI dispex_AddRef(IDispatchEx *iface)
Definition: main.c:222
static ULONG WINAPI site_AddRef(IActiveScriptSite *iface)
Definition: main.c:420
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
static HRESULT WINAPI site_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *error)
Definition: main.c:468
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define getaddrinfo
Definition: wspiapi.h:44
#define ntohl(x)
Definition: module.h:203
BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR mime, DWORD reserved)
Definition: main.c:131