Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8545a971
Commit
8545a971
authored
May 15, 2014
by
Hans Leidekker
Committed by
Alexandre Julliard
May 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsproxy: Implement InternetInitializeAutoProxyDll and InternetDeinitializeAutoProxyDll.
parent
ae542221
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
2 deletions
+111
-2
jsproxy.spec
dlls/jsproxy/jsproxy.spec
+2
-2
main.c
dlls/jsproxy/main.c
+109
-0
No files found.
dlls/jsproxy/jsproxy.spec
View file @
8545a971
@ st
ub
InternetInitializeAutoProxyDll
@ st
dcall InternetInitializeAutoProxyDll(long str str ptr ptr) JSPROXY_
InternetInitializeAutoProxyDll
@ stub InternetInitializeExAutoProxyDll
@ st
ub InternetDeInitializeAutoProxyDll
@ st
dcall InternetDeInitializeAutoProxyDll(str long)
@ stub InternetDeInitializeExAutoProxyDll
@ stub InternetGetProxyInfo
dlls/jsproxy/main.c
View file @
8545a971
...
...
@@ -23,12 +23,23 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wininet.h"
#include "wine/debug.h"
static
HINSTANCE
instance
;
WINE_DEFAULT_DEBUG_CHANNEL
(
jsproxy
);
static
CRITICAL_SECTION
cs_jsproxy
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
cs_jsproxy
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": cs_jsproxy"
)
}
};
static
CRITICAL_SECTION
cs_jsproxy
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/******************************************************************
* DllMain (jsproxy.@)
*/
...
...
@@ -46,3 +57,101 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
}
return
TRUE
;
}
static
inline
void
*
heap_alloc
(
SIZE_T
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
}
static
inline
BOOL
heap_free
(
LPVOID
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
WCHAR
*
strdupAW
(
const
char
*
src
,
DWORD
len
)
{
WCHAR
*
dst
=
NULL
;
if
(
src
)
{
int
dst_len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
len
,
NULL
,
0
);
if
((
dst
=
heap_alloc
(
(
dst_len
+
1
)
*
sizeof
(
WCHAR
)
)))
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
len
,
dst
,
dst_len
);
dst
[
dst_len
]
=
0
;
}
return
dst
;
}
static
struct
pac_script
{
WCHAR
*
text
;
}
pac_script
;
static
struct
pac_script
*
global_script
=
&
pac_script
;
/******************************************************************
* InternetDeInitializeAutoProxyDll (jsproxy.@)
*/
BOOL
WINAPI
InternetDeInitializeAutoProxyDll
(
LPSTR
mime
,
DWORD
reserved
)
{
TRACE
(
"%s, %u
\n
"
,
debugstr_a
(
mime
),
reserved
);
EnterCriticalSection
(
&
cs_jsproxy
);
heap_free
(
global_script
->
text
);
global_script
->
text
=
NULL
;
LeaveCriticalSection
(
&
cs_jsproxy
);
return
TRUE
;
}
static
WCHAR
*
load_script
(
const
char
*
filename
)
{
HANDLE
handle
;
DWORD
size
,
bytes_read
;
char
*
buffer
;
int
len
;
WCHAR
*
script
=
NULL
;
handle
=
CreateFileA
(
filename
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
return
NULL
;
size
=
GetFileSize
(
handle
,
NULL
);
if
(
!
(
buffer
=
heap_alloc
(
size
)))
goto
done
;
if
(
!
ReadFile
(
handle
,
buffer
,
size
,
&
bytes_read
,
NULL
)
||
bytes_read
!=
size
)
goto
done
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
size
,
NULL
,
0
);
if
(
!
(
script
=
heap_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
goto
done
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
size
,
script
,
len
);
script
[
len
]
=
0
;
done:
CloseHandle
(
handle
);
heap_free
(
buffer
);
return
script
;
}
/******************************************************************
* InternetInitializeAutoProxyDll (jsproxy.@)
*/
BOOL
WINAPI
JSPROXY_InternetInitializeAutoProxyDll
(
DWORD
version
,
LPSTR
tmpfile
,
LPSTR
mime
,
AutoProxyHelperFunctions
*
callbacks
,
LPAUTO_PROXY_SCRIPT_BUFFER
buffer
)
{
BOOL
ret
=
FALSE
;
TRACE
(
"%u, %s, %s, %p, %p
\n
"
,
version
,
debugstr_a
(
tmpfile
),
debugstr_a
(
mime
),
callbacks
,
buffer
);
if
(
callbacks
)
FIXME
(
"callbacks not supported
\n
"
);
EnterCriticalSection
(
&
cs_jsproxy
);
if
(
global_script
->
text
)
{
LeaveCriticalSection
(
&
cs_jsproxy
);
return
FALSE
;
}
if
(
buffer
&&
buffer
->
dwStructSize
==
sizeof
(
*
buffer
)
&&
buffer
->
lpszScriptBuffer
&&
(
global_script
->
text
=
strdupAW
(
buffer
->
lpszScriptBuffer
,
buffer
->
dwScriptBufferSize
)))
ret
=
TRUE
;
else
if
((
global_script
->
text
=
load_script
(
tmpfile
)))
ret
=
TRUE
;
LeaveCriticalSection
(
&
cs_jsproxy
);
return
ret
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment