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
70edf2d2
Commit
70edf2d2
authored
Aug 12, 2007
by
Misha Koshelev
Committed by
Alexandre Julliard
Aug 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebrowser: Add support for XTYP_REQUEST in DDE callback.
parent
308da631
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
16 deletions
+38
-16
main.c
programs/winebrowser/main.c
+38
-16
No files found.
programs/winebrowser/main.c
View file @
70edf2d2
...
@@ -125,15 +125,16 @@ static int open_mailto_url( const char *url )
...
@@ -125,15 +125,16 @@ static int open_mailto_url( const char *url )
* DDE helper functions.
* DDE helper functions.
*/
*/
static
char
*
ddeExec
=
NULL
;
static
char
*
ddeString
=
NULL
;
static
HSZ
hszTopic
=
0
;
static
HSZ
hszTopic
=
0
,
hszReturn
=
0
;
static
DWORD
ddeInst
=
0
;
/* Dde callback, save the execute string for processing */
/* Dde callback, save the execute
or request
string for processing */
static
HDDEDATA
CALLBACK
ddeCb
(
UINT
uType
,
UINT
uFmt
,
HCONV
hConv
,
static
HDDEDATA
CALLBACK
ddeCb
(
UINT
uType
,
UINT
uFmt
,
HCONV
hConv
,
HSZ
hsz1
,
HSZ
hsz2
,
HDDEDATA
hData
,
HSZ
hsz1
,
HSZ
hsz2
,
HDDEDATA
hData
,
ULONG_PTR
dwData1
,
ULONG_PTR
dwData2
)
ULONG_PTR
dwData1
,
ULONG_PTR
dwData2
)
{
{
DWORD
size
=
0
;
DWORD
size
=
0
,
ret
=
0
;
WINE_TRACE
(
"dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx
\n
"
,
WINE_TRACE
(
"dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx
\n
"
,
uType
,
uFmt
,
hConv
,
hsz1
,
hsz2
,
hData
,
dwData1
,
dwData2
);
uType
,
uFmt
,
hConv
,
hsz1
,
hsz2
,
hData
,
dwData1
,
dwData2
);
...
@@ -148,13 +149,26 @@ static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv,
...
@@ -148,13 +149,26 @@ static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv,
case
XTYP_EXECUTE
:
case
XTYP_EXECUTE
:
if
(
!
(
size
=
DdeGetData
(
hData
,
NULL
,
0
,
0
)))
if
(
!
(
size
=
DdeGetData
(
hData
,
NULL
,
0
,
0
)))
WINE_ERR
(
"DdeGetData returned zero size of execute string
\n
"
);
WINE_ERR
(
"DdeGetData returned zero size of execute string
\n
"
);
else
if
(
!
(
dde
Exec
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
else
if
(
!
(
dde
String
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
WINE_ERR
(
"Out of memory
\n
"
);
WINE_ERR
(
"Out of memory
\n
"
);
else
if
(
DdeGetData
(
hData
,
(
LPBYTE
)
dde
Exec
,
size
,
0
)
!=
size
)
else
if
(
DdeGetData
(
hData
,
(
LPBYTE
)
dde
String
,
size
,
0
)
!=
size
)
WINE_WARN
(
"DdeGetData did not return %d bytes
\n
"
,
size
);
WINE_WARN
(
"DdeGetData did not return %d bytes
\n
"
,
size
);
DdeFreeDataHandle
(
hData
);
DdeFreeDataHandle
(
hData
);
return
(
HDDEDATA
)
DDE_FACK
;
return
(
HDDEDATA
)
DDE_FACK
;
case
XTYP_REQUEST
:
ret
=
-
3
;
/* error */
if
(
!
(
size
=
DdeQueryString
(
ddeInst
,
hsz2
,
NULL
,
0
,
CP_WINANSI
)))
WINE_ERR
(
"DdeQueryString returned zero size of request string
\n
"
);
else
if
(
!
(
ddeString
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
+
1
)))
WINE_ERR
(
"Out of memory
\n
"
);
else
if
(
DdeQueryString
(
ddeInst
,
hsz2
,
ddeString
,
size
+
1
,
CP_WINANSI
)
!=
size
)
WINE_WARN
(
"DdeQueryString did not return %d bytes
\n
"
,
size
);
else
ret
=
-
2
;
/* acknowledgment */
return
DdeCreateDataHandle
(
ddeInst
,
(
LPBYTE
)
&
ret
,
sizeof
(
ret
),
0
,
hszReturn
,
CF_TEXT
,
0
);
default:
default:
return
NULL
;
return
NULL
;
}
}
...
@@ -164,15 +178,15 @@ static char *get_url_from_dde(void)
...
@@ -164,15 +178,15 @@ static char *get_url_from_dde(void)
{
{
static
const
char
szApplication
[]
=
"IExplore"
;
static
const
char
szApplication
[]
=
"IExplore"
;
static
const
char
szTopic
[]
=
"WWW_OpenURL"
;
static
const
char
szTopic
[]
=
"WWW_OpenURL"
;
static
const
char
szReturn
[]
=
"Return"
;
HSZ
hszApplication
=
0
;
HSZ
hszApplication
=
0
;
DWORD
ddeInst
=
0
;
UINT_PTR
timer
=
0
;
UINT_PTR
timer
=
0
;
int
rc
;
int
rc
;
char
*
ret
=
NULL
;
char
*
ret
=
NULL
;
rc
=
DdeInitializeA
(
&
ddeInst
,
ddeCb
,
CBF_SKIP_ALLNOTIFICATIONS
|
CBF_FAIL_ADVISES
|
rc
=
DdeInitializeA
(
&
ddeInst
,
ddeCb
,
CBF_SKIP_ALLNOTIFICATIONS
|
CBF_FAIL_ADVISES
|
CBF_FAIL_POKES
|
CBF_FAIL_REQUESTS
,
0
);
CBF_FAIL_POKES
,
0
);
if
(
rc
!=
DMLERR_NO_ERROR
)
if
(
rc
!=
DMLERR_NO_ERROR
)
{
{
WINE_ERR
(
"Unable to initialize DDE, DdeInitialize returned %d
\n
"
,
rc
);
WINE_ERR
(
"Unable to initialize DDE, DdeInitialize returned %d
\n
"
,
rc
);
...
@@ -193,6 +207,13 @@ static char *get_url_from_dde(void)
...
@@ -193,6 +207,13 @@ static char *get_url_from_dde(void)
goto
done
;
goto
done
;
}
}
hszReturn
=
DdeCreateStringHandleA
(
ddeInst
,
szReturn
,
CP_WINANSI
);
if
(
!
hszReturn
)
{
WINE_ERR
(
"Unable to initialize DDE, DdeCreateStringHandle failed
\n
"
);
goto
done
;
}
if
(
!
DdeNameService
(
ddeInst
,
hszApplication
,
0
,
DNS_REGISTER
))
if
(
!
DdeNameService
(
ddeInst
,
hszApplication
,
0
,
DNS_REGISTER
))
{
{
WINE_ERR
(
"Unable to initialize DDE, DdeNameService failed
\n
"
);
WINE_ERR
(
"Unable to initialize DDE, DdeNameService failed
\n
"
);
...
@@ -206,7 +227,7 @@ static char *get_url_from_dde(void)
...
@@ -206,7 +227,7 @@ static char *get_url_from_dde(void)
goto
done
;
goto
done
;
}
}
while
(
!
dde
Exec
)
while
(
!
dde
String
)
{
{
MSG
msg
;
MSG
msg
;
if
(
!
GetMessage
(
&
msg
,
NULL
,
0
,
0
))
break
;
if
(
!
GetMessage
(
&
msg
,
NULL
,
0
,
0
))
break
;
...
@@ -214,21 +235,21 @@ static char *get_url_from_dde(void)
...
@@ -214,21 +235,21 @@ static char *get_url_from_dde(void)
DispatchMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
}
}
if
(
dde
Exec
)
if
(
dde
String
)
{
{
if
(
*
dde
Exec
==
'"'
)
if
(
*
dde
String
==
'"'
)
{
{
char
*
endquote
=
strchr
(
dde
Exec
+
1
,
'"'
);
char
*
endquote
=
strchr
(
dde
String
+
1
,
'"'
);
if
(
!
endquote
)
if
(
!
endquote
)
{
{
WINE_ERR
(
"Unabled to retrieve URL from string '%s'
\n
"
,
dde
Exec
);
WINE_ERR
(
"Unabled to retrieve URL from string '%s'
\n
"
,
dde
String
);
goto
done
;
goto
done
;
}
}
*
endquote
=
0
;
*
endquote
=
0
;
ret
=
dde
Exec
+
1
;
ret
=
dde
String
+
1
;
}
}
else
else
ret
=
dde
Exec
;
ret
=
dde
String
;
}
}
done:
done:
...
@@ -236,6 +257,7 @@ done:
...
@@ -236,6 +257,7 @@ done:
if
(
ddeInst
)
if
(
ddeInst
)
{
{
if
(
hszTopic
&&
hszApplication
)
DdeNameService
(
ddeInst
,
hszApplication
,
0
,
DNS_UNREGISTER
);
if
(
hszTopic
&&
hszApplication
)
DdeNameService
(
ddeInst
,
hszApplication
,
0
,
DNS_UNREGISTER
);
if
(
hszReturn
)
DdeFreeStringHandle
(
ddeInst
,
hszReturn
);
if
(
hszTopic
)
DdeFreeStringHandle
(
ddeInst
,
hszTopic
);
if
(
hszTopic
)
DdeFreeStringHandle
(
ddeInst
,
hszTopic
);
if
(
hszApplication
)
DdeFreeStringHandle
(
ddeInst
,
hszApplication
);
if
(
hszApplication
)
DdeFreeStringHandle
(
ddeInst
,
hszApplication
);
DdeUninitialize
(
ddeInst
);
DdeUninitialize
(
ddeInst
);
...
@@ -332,6 +354,6 @@ int main(int argc, char *argv[])
...
@@ -332,6 +354,6 @@ int main(int argc, char *argv[])
ret
=
open_http_url
(
url
);
ret
=
open_http_url
(
url
);
done:
done:
HeapFree
(
GetProcessHeap
(),
0
,
dde
Exec
);
HeapFree
(
GetProcessHeap
(),
0
,
dde
String
);
return
ret
;
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