Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
77b3864f
Commit
77b3864f
authored
Nov 29, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Convert the dll registration routines to Unicode.
parent
bbaa72de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
50 deletions
+52
-50
cpsf.c
dlls/rpcrt4/cpsf.c
+52
-50
No files found.
dlls/rpcrt4/cpsf.c
View file @
77b3864f
...
...
@@ -36,12 +36,25 @@
#include "rpcproxy.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "cpsf.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
static
void
format_clsid
(
WCHAR
*
buffer
,
const
CLSID
*
clsid
)
{
static
const
WCHAR
clsid_formatW
[]
=
{
'{'
,
'%'
,
'0'
,
'8'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'}'
,
0
};
sprintfW
(
buffer
,
clsid_formatW
,
clsid
->
Data1
,
clsid
->
Data2
,
clsid
->
Data3
,
clsid
->
Data4
[
0
],
clsid
->
Data4
[
1
],
clsid
->
Data4
[
2
],
clsid
->
Data4
[
3
],
clsid
->
Data4
[
4
],
clsid
->
Data4
[
5
],
clsid
->
Data4
[
6
],
clsid
->
Data4
[
7
]
);
}
static
BOOL
FindProxyInfo
(
const
ProxyFileInfo
**
pProxyFileList
,
REFIID
riid
,
const
ProxyFileInfo
**
pProxyInfo
,
int
*
pIndex
)
{
while
(
*
pProxyFileList
)
{
...
...
@@ -197,6 +210,7 @@ HRESULT WINAPI NdrDllCanUnloadNow(CStdPSFactoryBuffer *pPSFactoryBuffer)
return
!
(
pPSFactoryBuffer
->
RefCount
);
}
/***********************************************************************
* NdrDllRegisterProxy [RPCRT4.@]
*/
...
...
@@ -204,13 +218,19 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
const
ProxyFileInfo
**
pProxyFileList
,
const
CLSID
*
pclsid
)
{
LPSTR
clsid
;
char
keyname
[
120
],
module
[
MAX_PATH
];
static
const
WCHAR
bothW
[]
=
{
'B'
,
'o'
,
't'
,
'h'
,
0
};
static
const
WCHAR
clsidW
[]
=
{
'C'
,
'L'
,
'S'
,
'I'
,
'D'
,
'\\'
,
0
};
static
const
WCHAR
clsid32W
[]
=
{
'P'
,
'r'
,
'o'
,
'x'
,
'y'
,
'S'
,
't'
,
'u'
,
'b'
,
'C'
,
'l'
,
's'
,
'i'
,
'd'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
interfaceW
[]
=
{
'I'
,
'n'
,
't'
,
'e'
,
'r'
,
'f'
,
'a'
,
'c'
,
'e'
,
'\\'
,
0
};
static
const
WCHAR
psfactoryW
[]
=
{
'P'
,
'S'
,
'F'
,
'a'
,
'c'
,
't'
,
'o'
,
'r'
,
'y'
,
'B'
,
'u'
,
'f'
,
'f'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
inprocserverW
[]
=
{
'I'
,
'n'
,
'P'
,
'r'
,
'o'
,
'c'
,
'S'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
threadingmodelW
[]
=
{
'T'
,
'h'
,
'r'
,
'e'
,
'a'
,
'd'
,
'i'
,
'n'
,
'g'
,
'M'
,
'o'
,
'd'
,
'e'
,
'l'
,
0
};
WCHAR
clsid
[
39
],
keyname
[
50
],
module
[
MAX_PATH
];
HKEY
key
,
subkey
;
DWORD
len
;
TRACE
(
"(%p,%p,%s)
\n
"
,
hDll
,
pProxyFileList
,
debugstr_guid
(
pclsid
));
UuidToStringA
((
UUID
*
)
pclsid
,
(
unsigned
char
**
)
&
clsid
);
format_clsid
(
clsid
,
pclsid
);
/* register interfaces to point to clsid */
while
(
*
pProxyFileList
)
{
...
...
@@ -218,23 +238,16 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
for
(
u
=
0
;
u
<
(
*
pProxyFileList
)
->
TableSize
;
u
++
)
{
CInterfaceStubVtbl
*
proxy
=
(
*
pProxyFileList
)
->
pStubVtblList
[
u
];
PCInterfaceName
name
=
(
*
pProxyFileList
)
->
pNamesArray
[
u
];
LPSTR
iid
;
TRACE
(
"registering %s %s => %s
\n
"
,
name
,
debugstr_guid
(
proxy
->
header
.
piid
),
clsid
);
TRACE
(
"registering %s %s => %s
\n
"
,
debugstr_a
(
name
),
debugstr_guid
(
proxy
->
header
.
piid
),
debugstr_w
(
clsid
));
UuidToStringA
((
UUID
*
)
proxy
->
header
.
piid
,
(
unsigned
char
**
)
&
iid
);
snprintf
(
keyname
,
sizeof
(
keyname
),
"Interface
\\
{%s}"
,
iid
);
RpcStringFreeA
((
unsigned
char
**
)
&
iid
);
if
(
RegCreateKeyExA
(
HKEY_CLASSES_ROOT
,
keyname
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
key
,
NULL
)
==
ERROR_SUCCESS
)
{
strcpyW
(
keyname
,
interfaceW
);
format_clsid
(
keyname
+
strlenW
(
keyname
),
proxy
->
header
.
piid
);
if
(
RegCreateKeyW
(
HKEY_CLASSES_ROOT
,
keyname
,
&
key
)
==
ERROR_SUCCESS
)
{
if
(
name
)
RegSetValueExA
(
key
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
name
,
strlen
(
name
));
if
(
RegCreateKeyExA
(
key
,
"ProxyStubClsid32"
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
subkey
,
NULL
)
==
ERROR_SUCCESS
)
{
snprintf
(
module
,
sizeof
(
module
),
"{%s}"
,
clsid
);
RegSetValueExA
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
LPBYTE
)
module
,
strlen
(
module
));
RegCloseKey
(
subkey
);
}
RegSetValueExA
(
key
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
name
,
strlen
(
name
)
+
1
);
RegSetValueW
(
key
,
clsid32W
,
REG_SZ
,
clsid
,
0
);
RegCloseKey
(
key
);
}
}
...
...
@@ -242,25 +255,22 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
snprintf
(
keyname
,
sizeof
(
keyname
),
"CLSID
\\
{%s}"
,
clsid
);
len
=
GetModuleFileNameA
(
hDll
,
module
,
sizeof
(
module
));
strcpyW
(
keyname
,
clsidW
);
strcatW
(
keyname
,
clsid
);
len
=
GetModuleFileNameW
(
hDll
,
module
,
sizeof
(
module
)
/
sizeof
(
WCHAR
));
if
(
len
&&
len
<
sizeof
(
module
))
{
TRACE
(
"registering CLSID %s => %s
\n
"
,
clsid
,
module
);
if
(
RegCreateKeyExA
(
HKEY_CLASSES_ROOT
,
keyname
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
key
,
NULL
)
==
ERROR_SUCCESS
)
{
RegSetValueExA
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"PSFactoryBuffer"
,
strlen
(
"PSFactoryBuffer"
));
if
(
RegCreateKeyExA
(
key
,
"InProcServer32"
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
subkey
,
NULL
)
==
ERROR_SUCCESS
)
{
RegSetValueExA
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
LPBYTE
)
module
,
strlen
(
module
)
);
RegSetValueExA
(
subkey
,
"ThreadingModel"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"Both"
,
strlen
(
"Both"
));
RegCloseKey
(
sub
key
);
TRACE
(
"registering CLSID %s => %s
\n
"
,
debugstr_w
(
clsid
),
debugstr_w
(
module
)
);
if
(
RegCreateKeyW
(
HKEY_CLASSES_ROOT
,
keyname
,
&
key
)
==
ERROR_SUCCESS
)
{
RegSetValueExW
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
const
BYTE
*
)
psfactoryW
,
sizeof
(
psfactoryW
));
if
(
RegCreateKeyW
(
key
,
inprocserverW
,
&
subkey
)
==
ERROR_SUCCESS
)
{
RegSetValueExW
(
subkey
,
NULL
,
0
,
REG_SZ
,
(
LPBYTE
)
module
,
(
strlenW
(
module
)
+
1
)
*
sizeof
(
WCHAR
));
RegSetValueExW
(
subkey
,
threadingmodelW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
bothW
,
sizeof
(
bothW
));
RegCloseKey
(
subkey
);
}
RegCloseKey
(
key
);
}
RegCloseKey
(
key
);
}
}
/* done */
RpcStringFreeA
((
unsigned
char
**
)
&
clsid
);
return
S_OK
;
}
...
...
@@ -271,12 +281,11 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
const
ProxyFileInfo
**
pProxyFileList
,
const
CLSID
*
pclsid
)
{
LPSTR
clsid
;
char
keyname
[
120
],
module
[
MAX_PATH
]
;
DWORD
len
;
static
const
WCHAR
clsidW
[]
=
{
'C'
,
'L'
,
'S'
,
'I'
,
'D'
,
'\\'
,
0
}
;
static
const
WCHAR
interfaceW
[]
=
{
'I'
,
'n'
,
't'
,
'e'
,
'r'
,
'f'
,
'a'
,
'c'
,
'e'
,
'\\'
,
0
}
;
WCHAR
keyname
[
50
]
;
TRACE
(
"(%p,%p,%s)
\n
"
,
hDll
,
pProxyFileList
,
debugstr_guid
(
pclsid
));
UuidToStringA
((
UUID
*
)
pclsid
,
(
unsigned
char
**
)
&
clsid
);
/* unregister interfaces */
while
(
*
pProxyFileList
)
{
...
...
@@ -284,27 +293,20 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
for
(
u
=
0
;
u
<
(
*
pProxyFileList
)
->
TableSize
;
u
++
)
{
CInterfaceStubVtbl
*
proxy
=
(
*
pProxyFileList
)
->
pStubVtblList
[
u
];
PCInterfaceName
name
=
(
*
pProxyFileList
)
->
pNamesArray
[
u
];
LPSTR
iid
;
TRACE
(
"unregistering %s %s
<= %s
\n
"
,
name
,
debugstr_guid
(
proxy
->
header
.
piid
),
clsid
);
TRACE
(
"unregistering %s %s
\n
"
,
debugstr_a
(
name
),
debugstr_guid
(
proxy
->
header
.
piid
)
);
UuidToStringA
((
UUID
*
)
proxy
->
header
.
piid
,
(
unsigned
char
**
)
&
iid
);
snprintf
(
keyname
,
sizeof
(
keyname
),
"Interface
\\
{%s}"
,
iid
);
RpcStringFreeA
((
unsigned
char
**
)
&
iid
);
RegDeleteKeyA
(
HKEY_CLASSES_ROOT
,
keyname
);
strcpyW
(
keyname
,
interfaceW
);
format_clsid
(
keyname
+
strlenW
(
keyname
),
proxy
->
header
.
piid
);
RegDeleteKeyW
(
HKEY_CLASSES_ROOT
,
keyname
);
}
pProxyFileList
++
;
}
/* unregister clsid */
snprintf
(
keyname
,
sizeof
(
keyname
),
"CLSID
\\
{%s}"
,
clsid
);
len
=
GetModuleFileNameA
(
hDll
,
module
,
sizeof
(
module
));
if
(
len
&&
len
<
sizeof
(
module
))
{
TRACE
(
"unregistering CLSID %s <= %s
\n
"
,
clsid
,
module
);
RegDeleteKeyA
(
HKEY_CLASSES_ROOT
,
keyname
);
}
strcpyW
(
keyname
,
clsidW
);
format_clsid
(
keyname
+
strlenW
(
keyname
),
pclsid
);
RegDeleteKeyW
(
HKEY_CLASSES_ROOT
,
keyname
);
/* done */
RpcStringFreeA
((
unsigned
char
**
)
&
clsid
);
return
S_OK
;
}
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