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
5807cb79
Commit
5807cb79
authored
Jun 20, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Jun 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the RPC code to use the unicode versions of the CLSID &
registry functions.
parent
f419880d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
25 deletions
+29
-25
rpc.c
dlls/ole32/rpc.c
+29
-25
No files found.
dlls/ole32/rpc.c
View file @
5807cb79
...
...
@@ -569,24 +569,27 @@ void RPC_StartRemoting(struct apartment *apt)
static
HRESULT
create_server
(
REFCLSID
rclsid
)
{
static
const
WCHAR
wszLocalServer32
[]
=
{
'L'
,
'o'
,
'c'
,
'a'
,
'l'
,
'S'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
embedding
[]
=
{
' '
,
'-'
,
'E'
,
'm'
,
'b'
,
'e'
,
'd'
,
'd'
,
'i'
,
'n'
,
'g'
,
0
};
HKEY
hkeyclsid
;
HKEY
key
;
char
buf
[
200
];
HRESULT
hres
=
E_UNEXPECTED
;
char
xclsid
[
80
];
WCHAR
exe
[
MAX_PATH
+
1
];
DWORD
exelen
=
sizeof
(
exe
);
WCHAR
command
[
MAX_PATH
+
sizeof
(
embedding
)
/
sizeof
(
WCHAR
)];
STARTUPINFOW
sinfo
;
PROCESS_INFORMATION
pinfo
;
WINE_StringFromCLSID
((
LPCLSID
)
rclsid
,
xclsid
);
hres
=
HRESULT_FROM_WIN32
(
COM_OpenKeyForCLSID
(
rclsid
,
KEY_READ
,
&
hkeyclsid
));
if
(
hres
!=
S_OK
)
{
ERR
(
"class %s not registered
\n
"
,
debugstr_guid
(
rclsid
));
return
REGDB_E_READREGDB
;
}
sprintf
(
buf
,
"CLSID
\\
%s
\\
LocalServer32"
,
xclsid
);
hres
=
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
buf
,
0
,
KEY_READ
,
&
key
);
hres
=
RegOpenKeyExW
(
hkeyclsid
,
wszLocalServer32
,
0
,
KEY_READ
,
&
key
);
if
(
hres
!=
ERROR_SUCCESS
)
{
WARN
(
"
CLSID %s not registered as LocalServer32
\n
"
,
xclsid
);
WARN
(
"
class %s not registered as LocalServer32
\n
"
,
debugstr_guid
(
rclsid
)
);
return
REGDB_E_READREGDB
;
/* Probably */
}
...
...
@@ -608,7 +611,7 @@ static HRESULT create_server(REFCLSID rclsid)
strcpyW
(
command
,
exe
);
strcatW
(
command
,
embedding
);
TRACE
(
"activating local server
'%s' for %s
\n
"
,
debugstr_w
(
command
),
xclsid
);
TRACE
(
"activating local server
%s for %s
\n
"
,
debugstr_w
(
command
),
debugstr_guid
(
rclsid
)
);
if
(
!
CreateProcessW
(
exe
,
command
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
sinfo
,
&
pinfo
))
{
WARN
(
"failed to run local server %s
\n
"
,
debugstr_w
(
exe
));
...
...
@@ -663,8 +666,7 @@ static DWORD start_local_service(LPCWSTR name, DWORD num, LPWSTR *params)
static
HRESULT
create_local_service
(
REFCLSID
rclsid
)
{
HRESULT
hres
=
REGDB_E_READREGDB
;
WCHAR
buf
[
40
],
keyname
[
50
];
static
const
WCHAR
szClsId
[]
=
{
'C'
,
'L'
,
'S'
,
'I'
,
'D'
,
'\\'
,
0
};
WCHAR
buf
[
CHARS_IN_GUID
],
keyname
[
50
];
static
const
WCHAR
szAppId
[]
=
{
'A'
,
'p'
,
'p'
,
'I'
,
'd'
,
0
};
static
const
WCHAR
szAppIdKey
[]
=
{
'A'
,
'p'
,
'p'
,
'I'
,
'd'
,
'\\'
,
0
};
static
const
WCHAR
szLocalService
[]
=
{
'L'
,
'o'
,
'c'
,
'a'
,
'l'
,
'S'
,
'e'
,
'r'
,
'v'
,
'i'
,
'c'
,
'e'
,
0
};
...
...
@@ -676,9 +678,7 @@ static HRESULT create_local_service(REFCLSID rclsid)
TRACE
(
"Attempting to start Local service for %s
\n
"
,
debugstr_guid
(
rclsid
));
/* read the AppID value under the class's key */
strcpyW
(
keyname
,
szClsId
);
StringFromGUID2
(
rclsid
,
&
keyname
[
6
],
39
);
r
=
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
keyname
,
0
,
KEY_READ
,
&
hkey
);
r
=
COM_OpenKeyForCLSID
(
rclsid
,
KEY_READ
,
&
hkey
);
if
(
r
!=
ERROR_SUCCESS
)
return
hres
;
sz
=
sizeof
buf
;
...
...
@@ -725,14 +725,20 @@ static HRESULT create_local_service(REFCLSID rclsid)
return
hres
;
}
#define PIPEPREF "\\\\.\\pipe\\"
static
void
get_localserver_pipe_name
(
WCHAR
*
pipefn
,
REFCLSID
rclsid
)
{
static
const
WCHAR
wszPipeRef
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
'\\'
,
0
};
strcpyW
(
pipefn
,
wszPipeRef
);
StringFromGUID2
(
rclsid
,
pipefn
+
sizeof
(
wszPipeRef
)
/
sizeof
(
wszPipeRef
[
0
])
-
1
,
CHARS_IN_GUID
);
}
/* FIXME: should call to rpcss instead */
HRESULT
RPC_GetLocalClassObject
(
REFCLSID
rclsid
,
REFIID
iid
,
LPVOID
*
ppv
)
{
HRESULT
hres
;
HANDLE
hPipe
;
char
pipefn
[
2
00
];
WCHAR
pipefn
[
1
00
];
DWORD
res
,
bufferlen
;
char
marshalbuffer
[
200
];
IStream
*
pStm
;
...
...
@@ -744,14 +750,13 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
TRACE
(
"rclsid=%s, iid=%s
\n
"
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
iid
));
strcpy
(
pipefn
,
PIPEPREF
);
WINE_StringFromCLSID
(
rclsid
,
pipefn
+
strlen
(
PIPEPREF
));
get_localserver_pipe_name
(
pipefn
,
rclsid
);
while
(
tries
++
<
MAXTRIES
)
{
TRACE
(
"waiting for %s
\n
"
,
pipefn
);
TRACE
(
"waiting for %s
\n
"
,
debugstr_w
(
pipefn
)
);
WaitNamedPipe
A
(
pipefn
,
NMPWAIT_WAIT_FOREVER
);
hPipe
=
CreateFile
A
(
pipefn
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
WaitNamedPipe
W
(
pipefn
,
NMPWAIT_WAIT_FOREVER
);
hPipe
=
CreateFile
W
(
pipefn
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
hPipe
==
INVALID_HANDLE_VALUE
)
{
if
(
tries
==
1
)
{
if
(
(
hres
=
create_server
(
rclsid
))
&&
...
...
@@ -759,7 +764,7 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
return
hres
;
Sleep
(
1000
);
}
else
{
WARN
(
"Connecting to %s, no response yet, retrying: le is %lx
\n
"
,
pipefn
,
GetLastError
());
WARN
(
"Connecting to %s, no response yet, retrying: le is %lx
\n
"
,
debugstr_w
(
pipefn
),
GetLastError
());
Sleep
(
1000
);
}
continue
;
...
...
@@ -804,7 +809,7 @@ static DWORD WINAPI local_server_thread(LPVOID param)
{
struct
local_server_params
*
lsp
=
(
struct
local_server_params
*
)
param
;
HANDLE
hPipe
;
char
pipefn
[
2
00
];
WCHAR
pipefn
[
1
00
];
HRESULT
hres
;
IStream
*
pStm
=
lsp
->
stream
;
STATSTG
ststg
;
...
...
@@ -816,18 +821,17 @@ static DWORD WINAPI local_server_thread(LPVOID param)
TRACE
(
"Starting threader for %s.
\n
"
,
debugstr_guid
(
&
lsp
->
clsid
));
strcpy
(
pipefn
,
PIPEPREF
);
WINE_StringFromCLSID
(
&
lsp
->
clsid
,
pipefn
+
strlen
(
PIPEPREF
));
get_localserver_pipe_name
(
pipefn
,
&
lsp
->
clsid
);
HeapFree
(
GetProcessHeap
(),
0
,
lsp
);
hPipe
=
CreateNamedPipe
A
(
pipefn
,
PIPE_ACCESS_DUPLEX
,
hPipe
=
CreateNamedPipe
W
(
pipefn
,
PIPE_ACCESS_DUPLEX
,
PIPE_TYPE_BYTE
|
PIPE_WAIT
,
PIPE_UNLIMITED_INSTANCES
,
4096
,
4096
,
500
/* 0.5 second timeout */
,
NULL
);
if
(
hPipe
==
INVALID_HANDLE_VALUE
)
{
FIXME
(
"pipe creation failed for %s, le is %ld
\n
"
,
pipefn
,
GetLastError
());
FIXME
(
"pipe creation failed for %s, le is %ld
\n
"
,
debugstr_w
(
pipefn
),
GetLastError
());
return
1
;
}
...
...
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