ReactOS  0.4.14-dev-599-g2d4d3f5
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 <stdarg.h>
20 #ifdef __REACTOS__
21 #include <stdio.h>
22 #define COBJMACROS
23 #endif
24 #include <sys/types.h>
25 
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winsock2.h"
29 #include "ws2ipdef.h"
30 #include "ws2tcpip.h"
31 #include "winnls.h"
32 #include "wininet.h"
33 #ifndef __REACTOS__
34 #define COBJMACROS
35 #endif
36 #include "ole2.h"
37 #include "dispex.h"
38 #include "activscp.h"
39 #include "wine/debug.h"
40 #include "wine/heap.h"
41 
43 
45 
48 {
49  0, 0, &cs_jsproxy,
51  0, 0, { (DWORD_PTR)(__FILE__ ": cs_jsproxy") }
52 };
53 static CRITICAL_SECTION cs_jsproxy = { &critsect_debug, -1, 0, 0, 0, 0 };
54 
55 static const WCHAR global_funcsW[] = {'g','l','o','b','a','l','_','f','u','n','c','s',0};
56 static const WCHAR dns_resolveW[] = {'d','n','s','_','r','e','s','o','l','v','e',0};
57 
58 /******************************************************************
59  * DllMain (jsproxy.@)
60  */
62 {
63  switch (reason)
64  {
65  case DLL_PROCESS_ATTACH:
66  instance = hinst;
68  break;
69 
70  case DLL_PROCESS_DETACH:
71  break;
72  }
73  return TRUE;
74 }
75 
76 static inline WCHAR *strdupAW( const char *src, int len )
77 {
78  WCHAR *dst = NULL;
79  if (src)
80  {
81  int dst_len = MultiByteToWideChar( CP_ACP, 0, src, len, NULL, 0 );
82  if ((dst = heap_alloc( (dst_len + 1) * sizeof(WCHAR) )))
83  {
84  len = MultiByteToWideChar( CP_ACP, 0, src, len, dst, dst_len );
85  dst[dst_len] = 0;
86  }
87  }
88  return dst;
89 }
90 
91 static inline char *strdupWA( const WCHAR *src )
92 {
93  char *dst = NULL;
94  if (src)
95  {
96  int len = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
97  if ((dst = heap_alloc( len ))) WideCharToMultiByte( CP_ACP, 0, src, -1, dst, len, NULL, NULL );
98  }
99  return dst;
100 }
101 
102 static struct pac_script
103 {
105 } pac_script;
107 
108 /******************************************************************
109  * InternetDeInitializeAutoProxyDll (jsproxy.@)
110  */
112 {
113  TRACE( "%s, %u\n", debugstr_a(mime), reserved );
114 
116 
117  heap_free( global_script->text );
118  global_script->text = NULL;
119 
121  return TRUE;
122 }
123 
124 static WCHAR *load_script( const char *filename )
125 {
126  HANDLE handle;
127  DWORD size, bytes_read;
128  char *buffer;
129  int len;
130  WCHAR *script = NULL;
131 
133  if (handle == INVALID_HANDLE_VALUE) return NULL;
134 
135  size = GetFileSize( handle, NULL );
136  if (!(buffer = heap_alloc( size ))) goto done;
137  if (!ReadFile( handle, buffer, size, &bytes_read, NULL ) || bytes_read != size) goto done;
138 
140  if (!(script = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto done;
142  script[len] = 0;
143 
144 done:
145  CloseHandle( handle );
146  heap_free( buffer );
147  return script;
148 }
149 
150 /******************************************************************
151  * InternetInitializeAutoProxyDll (jsproxy.@)
152  */
156 {
157  BOOL ret = FALSE;
158 
159  TRACE( "%u, %s, %s, %p, %p\n", version, debugstr_a(tmpfile), debugstr_a(mime), callbacks, buffer );
160 
161  if (callbacks) FIXME( "callbacks not supported\n" );
162 
164 
165  if (buffer && buffer->dwStructSize == sizeof(*buffer) && buffer->lpszScriptBuffer)
166  {
167  if (!buffer->dwScriptBufferSize)
168  {
171  return FALSE;
172  }
173  heap_free( global_script->text );
174  if ((global_script->text = strdupAW( buffer->lpszScriptBuffer,
175  buffer->dwScriptBufferSize ))) ret = TRUE;
176  }
177  else
178  {
179  heap_free( global_script->text );
180  if ((global_script->text = load_script( tmpfile ))) ret = TRUE;
181  }
182 
184  return ret;
185 }
186 
188  IDispatchEx *iface, REFIID riid, void **ppv )
189 {
190  *ppv = NULL;
191 
192  if (IsEqualGUID( riid, &IID_IUnknown ) ||
194  IsEqualGUID( riid, &IID_IDispatchEx ))
195  *ppv = iface;
196  else
197  return E_NOINTERFACE;
198 
199  return S_OK;
200 }
201 
203  IDispatchEx *iface )
204 {
205  return 2;
206 }
207 
209  IDispatchEx *iface )
210 {
211  return 1;
212 }
213 
215  IDispatchEx *iface, UINT *info )
216 {
217  return E_NOTIMPL;
218 }
219 
221  IDispatchEx *iface, UINT info, LCID lcid, ITypeInfo **type_info )
222 {
223  return E_NOTIMPL;
224 }
225 
227  IDispatchEx *iface, REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *id )
228 {
229  return E_NOTIMPL;
230 }
231 
233  IDispatchEx *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
235 {
236  return E_NOTIMPL;
237 }
238 
240  IDispatchEx *iface, BSTR name, DWORD flags )
241 {
242  return E_NOTIMPL;
243 }
244 
246  IDispatchEx *iface, DISPID id )
247 {
248  return E_NOTIMPL;
249 }
250 
252  IDispatchEx *iface, DISPID id, DWORD flags_fetch, DWORD *flags )
253 {
254  return E_NOTIMPL;
255 }
256 
258  IDispatchEx *iface, DISPID id, BSTR *name )
259 {
260  return E_NOTIMPL;
261 }
262 
264  IDispatchEx *iface, DWORD flags, DISPID id, DISPID *next )
265 {
266  return E_NOTIMPL;
267 }
268 
270  IDispatchEx *iface, IUnknown **unk )
271 {
272  return E_NOTIMPL;
273 }
274 
275 #define DISPID_GLOBAL_DNSRESOLVE 0x1000
276 
278  IDispatchEx *iface, BSTR name, DWORD flags, DISPID *id )
279 {
280  if (!lstrcmpW( name, dns_resolveW ))
281  {
283  return S_OK;
284  }
285  return DISP_E_UNKNOWNNAME;
286 }
287 
288 static char *get_computer_name( COMPUTER_NAME_FORMAT format )
289 {
290  char *ret;
291  DWORD size = 0;
292 
294  if (GetLastError() != ERROR_MORE_DATA) return NULL;
295  if (!(ret = heap_alloc( size ))) return NULL;
296  if (!GetComputerNameExA( format, ret, &size ))
297  {
298  heap_free( ret );
299  return NULL;
300  }
301  return ret;
302 }
303 
304 static void printf_addr( const WCHAR *fmt, WCHAR *buf, SIZE_T size, struct sockaddr_in *addr )
305 {
306  swprintf( buf, fmt,
307  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 24 & 0xff),
308  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 16 & 0xff),
309  (unsigned int)(ntohl( addr->sin_addr.s_addr ) >> 8 & 0xff),
310  (unsigned int)(ntohl( addr->sin_addr.s_addr ) & 0xff) );
311 }
312 
314 {
315  static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
316  WCHAR addr[16];
317  struct addrinfo *ai, *elem;
318  char *hostnameA;
319  int res;
320 
321  if (hostname[0])
322  hostnameA = strdupWA( hostname );
323  else
324  hostnameA = get_computer_name( ComputerNamePhysicalDnsFullyQualified );
325 
326  if (!hostnameA) return E_OUTOFMEMORY;
327  res = getaddrinfo( hostnameA, NULL, NULL, &ai );
328  heap_free( hostnameA );
329  if (res) return S_FALSE;
330 
331  elem = ai;
332  while (elem && elem->ai_family != AF_INET) elem = elem->ai_next;
333  if (!elem)
334  {
335  freeaddrinfo( ai );
336  return S_FALSE;
337  }
338  printf_addr( fmtW, addr, ARRAY_SIZE(addr), (struct sockaddr_in *)elem->ai_addr );
339  freeaddrinfo( ai );
340  V_VT( result ) = VT_BSTR;
342  return S_OK;
343 }
344 
346  IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
347  VARIANT *result, EXCEPINFO *exep, IServiceProvider *caller )
348 {
349  if (id == DISPID_GLOBAL_DNSRESOLVE)
350  {
351  if (params->cArgs != 1) return DISP_E_BADPARAMCOUNT;
352  if (V_VT(&params->rgvarg[0]) != VT_BSTR) return DISP_E_BADVARTYPE;
353  return dns_resolve( V_BSTR(&params->rgvarg[0]), result );
354  }
355  return DISP_E_MEMBERNOTFOUND;
356 }
357 
358 static const IDispatchExVtbl dispex_vtbl =
359 {
375 };
376 
377 static IDispatchEx global_dispex = { &dispex_vtbl };
378 
380  IActiveScriptSite *iface, REFIID riid, void **ppv )
381 {
382  *ppv = NULL;
383 
384  if (IsEqualGUID( &IID_IUnknown, riid ))
385  *ppv = iface;
386  else if (IsEqualGUID( &IID_IActiveScriptSite, riid ))
387  *ppv = iface;
388  else
389  return E_NOINTERFACE;
390 
391  IUnknown_AddRef( (IUnknown *)*ppv );
392  return S_OK;
393 }
394 
396  IActiveScriptSite *iface )
397 {
398  return 2;
399 }
400 
402  IActiveScriptSite *iface )
403 {
404  return 1;
405 }
406 
408  IActiveScriptSite *iface, LCID *lcid )
409 {
410  return E_NOTIMPL;
411 }
412 
414  IActiveScriptSite *iface, LPCOLESTR name, DWORD mask,
416 {
417  if (!lstrcmpW( name, global_funcsW ) && mask == SCRIPTINFO_IUNKNOWN)
418  {
419  *item = (IUnknown *)&global_dispex;
420  return S_OK;
421  }
422  return E_NOTIMPL;
423 }
424 
426  IActiveScriptSite *iface, BSTR *version )
427 {
428  return E_NOTIMPL;
429 }
430 
432  IActiveScriptSite *iface, const VARIANT *result, const EXCEPINFO *info )
433 {
434  return E_NOTIMPL;
435 }
436 
439 {
440  return E_NOTIMPL;
441 }
442 
445 {
446  return E_NOTIMPL;
447 }
448 
450  IActiveScriptSite *iface )
451 {
452  return E_NOTIMPL;
453 }
454 
456  IActiveScriptSite *iface )
457 {
458  return E_NOTIMPL;
459 }
460 
461 static const IActiveScriptSiteVtbl site_vtbl =
462 {
464  site_AddRef,
465  site_Release,
466  site_GetLCID,
474 };
475 
477 
479 {
480  static const WCHAR pacjsW[] = {'p','a','c','.','j','s',0};
481  HMODULE hmod = GetModuleHandleA( "jsproxy.dll" );
482  HRSRC rsrc;
483  DWORD size;
484  const char *data;
485  BSTR ret;
486  int len;
487 
488  if (!(rsrc = FindResourceW( hmod, pacjsW, (LPCWSTR)40 ))) return NULL;
489  size = SizeofResource( hmod, rsrc );
490  data = LoadResource( hmod, rsrc );
491 
492  len = MultiByteToWideChar( CP_ACP, 0, data, size, NULL, 0 );
493  if (!(ret = SysAllocStringLen( NULL, len + lstrlenW( script ) + 1 ))) return NULL;
495  lstrcpyW( ret + len, script );
496  return ret;
497 }
498 
499 #ifdef _WIN64
500 #define IActiveScriptParse_Release IActiveScriptParse64_Release
501 #define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
502 #define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
503 #else
504 #define IActiveScriptParse_Release IActiveScriptParse32_Release
505 #define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
506 #define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
507 #endif
508 
509 static BOOL run_script( const WCHAR *script, const WCHAR *url, const WCHAR *hostname, char **result_str, DWORD *result_len )
510 {
511  static const WCHAR jscriptW[] = {'J','S','c','r','i','p','t',0};
512  static const WCHAR findproxyW[] = {'F','i','n','d','P','r','o','x','y','F','o','r','U','R','L',0};
513  IActiveScriptParse *parser = NULL;
514  IActiveScript *engine = NULL;
516  BOOL ret = FALSE;
517  CLSID clsid;
518  DISPID dispid;
519  BSTR func = NULL, full_script = NULL;
520  VARIANT args[2], retval;
522  HRESULT hr, init;
523 
524  init = CoInitialize( NULL );
525  hr = CLSIDFromProgID( jscriptW, &clsid );
526  if (hr != S_OK) goto done;
527 
528  hr = CoCreateInstance( &clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
529  &IID_IActiveScript, (void **)&engine );
530  if (hr != S_OK) goto done;
531 
532  hr = IActiveScript_QueryInterface( engine, &IID_IActiveScriptParse, (void **)&parser );
533  if (hr != S_OK) goto done;
534 
536  if (hr != S_OK) goto done;
537 
538  hr = IActiveScript_SetScriptSite( engine, &script_site );
539  if (hr != S_OK) goto done;
540 
541  hr = IActiveScript_AddNamedItem( engine, global_funcsW, SCRIPTITEM_GLOBALMEMBERS );
542  if (hr != S_OK) goto done;
543 
544  if (!(full_script = include_pac_utils( script ))) goto done;
545 
546  hr = IActiveScriptParse_ParseScriptText( parser, full_script, NULL, NULL, NULL, 0, 0, 0, NULL, NULL );
547  if (hr != S_OK) goto done;
548 
549  hr = IActiveScript_SetScriptState( engine, SCRIPTSTATE_STARTED );
550  if (hr != S_OK) goto done;
551 
552  hr = IActiveScript_GetScriptDispatch( engine, NULL, &dispatch );
553  if (hr != S_OK) goto done;
554 
555  if (!(func = SysAllocString( findproxyW ))) goto done;
556  hr = IDispatch_GetIDsOfNames( dispatch, &IID_NULL, &func, 1, LOCALE_SYSTEM_DEFAULT, &dispid );
557  if (hr != S_OK) goto done;
558 
559  V_VT( &args[0] ) = VT_BSTR;
560  V_BSTR( &args[0] ) = SysAllocString( hostname );
561  V_VT( &args[1] ) = VT_BSTR;
562  V_BSTR( &args[1] ) = SysAllocString( url );
563 
564  params.rgvarg = args;
565  params.rgdispidNamedArgs = NULL;
566  params.cArgs = 2;
567  params.cNamedArgs = 0;
568  hr = IDispatch_Invoke( dispatch, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
569  &params, &retval, NULL, NULL );
570  VariantClear( &args[0] );
571  VariantClear( &args[1] );
572  if (hr != S_OK)
573  {
574  WARN("script failed 0x%08x\n", hr);
575  goto done;
576  }
577  if ((*result_str = strdupWA( V_BSTR( &retval ) )))
578  {
579  TRACE( "result: %s\n", debugstr_a(*result_str) );
580  *result_len = strlen( *result_str ) + 1;
581  ret = TRUE;
582  }
583  VariantClear( &retval );
584 
585 done:
586  SysFreeString( full_script );
587  SysFreeString( func );
588  if (dispatch) IDispatch_Release( dispatch );
590  if (engine) IActiveScript_Release( engine );
591  if (SUCCEEDED( init )) CoUninitialize();
592  return ret;
593 }
594 
595 /******************************************************************
596  * InternetGetProxyInfo (jsproxy.@)
597  */
599  LPDWORD len_proxy )
600 {
601  WCHAR *urlW = NULL, *hostnameW = NULL;
602  BOOL ret = FALSE;
603 
604  TRACE( "%s, %u, %s, %u, %p, %p\n", debugstr_a(url), len_url, hostname, len_hostname, proxy, len_proxy );
605 
607 
608  if (!global_script->text)
609  {
611  goto done;
612  }
613  if (hostname && len_hostname < strlen( hostname ))
614  {
616  goto done;
617  }
618  if (!(urlW = strdupAW( url, -1 ))) goto done;
619  if (hostname && !(hostnameW = strdupAW( hostname, -1 ))) goto done;
620 
621  TRACE( "%s\n", debugstr_w(global_script->text) );
622  ret = run_script( global_script->text, urlW, hostnameW, proxy, len_proxy );
623 
624 done:
625  heap_free( hostnameW );
626  heap_free( urlW );
628  return ret;
629 }
static HRESULT WINAPI dispex_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *exep, IServiceProvider *caller)
Definition: main.c:345
#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:431
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:406
#define E_NOINTERFACE
Definition: winerror.h:2364
#define freeaddrinfo
Definition: wspiapi.h:46
#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:214
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:339
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:47
REFIID riid
Definition: precomp.h:44
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT dns_resolve(const WCHAR *hostname, VARIANT *result)
Definition: main.c:313
#define IActiveScriptParse_Release
Definition: main.c:504
#define WARN(fmt,...)
Definition: debug.h:111
static IActiveScriptSite script_site
Definition: main.c:476
static HRESULT WINAPI dispex_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
Definition: main.c:187
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
static WCHAR * strdupAW(const char *src, int len)
Definition: main.c:76
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const WCHAR global_funcsW[]
Definition: main.c:55
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
static HRESULT WINAPI site_OnEnterScript(IActiveScriptSite *iface)
Definition: main.c:449
#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:413
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1942
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
#define lstrlenW
Definition: compat.h:415
Definition: match.c:390
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
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:379
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:401
char * hostname
Definition: ftp.c:88
static HRESULT WINAPI dispex_GetNextDispID(IDispatchEx *iface, DWORD flags, DISPID id, DISPID *next)
Definition: main.c:263
static HRESULT WINAPI dispex_DeleteMemberByName(IDispatchEx *iface, BSTR name, DWORD flags)
Definition: main.c:239
#define DISPID_GLOBAL_DNSRESOLVE
Definition: main.c:275
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:106
#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:208
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI dispex_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD flags_fetch, DWORD *flags)
Definition: main.c:251
r reserved
Definition: btrfs.c:2865
#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:66
static const IActiveScriptSiteVtbl site_vtbl
Definition: main.c:461
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
script
Definition: msipriv.h:374
enum tagSCRIPTSTATE SCRIPTSTATE
BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll(DWORD version, LPSTR tmpfile, LPSTR mime, AutoProxyHelperFunctions *callbacks, LPAUTO_PROXY_SCRIPT_BUFFER buffer)
Definition: main.c:153
const char * LPCSTR
Definition: xmlstorage.h:183
#define OPEN_EXISTING
Definition: compat.h:434
#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:509
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
#define IActiveScriptParse_InitNew
Definition: main.c:505
#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:277
__wchar_t WCHAR
Definition: xmlstorage.h:180
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: main.c:288
static HRESULT WINAPI site_OnLeaveScript(IActiveScriptSite *iface)
Definition: main.c:455
#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:506
static HINSTANCE instance
Definition: main.c:42
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:6
#define LOCALE_SYSTEM_DEFAULT
unsigned short WORD
Definition: ntddk_ex.h:93
static WCHAR * load_script(const char *filename)
Definition: main.c:124
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:417
static BSTR include_pac_utils(const WCHAR *script)
Definition: main.c:478
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
static void printf_addr(const WCHAR *fmt, WCHAR *buf, SIZE_T size, struct sockaddr_in *addr)
Definition: main.c:304
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:407
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
int ret
static BOOL init(void)
Definition: main.c:59
REFCLSID clsid
Definition: msctf.c:82
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
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:232
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855
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:425
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:3325
ULONG_PTR SIZE_T
Definition: typedefs.h:78
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
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:91
#define lstrcpyW
Definition: compat.h:414
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR * text
Definition: main.c:104
#define E_NOTIMPL
Definition: ddrawi.h:99
GLenum GLenum dst
Definition: glext.h:6340
static struct pac_script pac_script
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static HRESULT WINAPI dispex_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *names, UINT count, LCID lcid, DISPID *id)
Definition: main.c:226
static HRESULT WINAPI dispex_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
Definition: main.c:245
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:437
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
Definition: import.c:86
static IDispatchEx global_dispex
Definition: main.c:377
Definition: name.c:38
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:269
BOOL WINAPI InternetGetProxyInfo(LPCSTR url, DWORD len_url, LPCSTR hostname, DWORD len_hostname, LPSTR *proxy, LPDWORD len_proxy)
Definition: main.c:598
static CRITICAL_SECTION cs_jsproxy
Definition: main.c:46
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT WINAPI dispex_GetTypeInfo(IDispatchEx *iface, UINT info, LCID lcid, ITypeInfo **type_info)
Definition: main.c:220
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
static int callbacks
Definition: xmllint.c:873
static HRESULT WINAPI dispex_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *name)
Definition: main.c:257
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:358
GLuint64EXT * result
Definition: glext.h:11304
Definition: dsound.c:943
static const WCHAR dns_resolveW[]
Definition: main.c:56
static ULONG WINAPI dispex_AddRef(IDispatchEx *iface)
Definition: main.c:202
static ULONG WINAPI site_AddRef(IActiveScriptSite *iface)
Definition: main.c:395
#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:443
#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:111