mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:13:56 +00:00
Change the RPC code to use the unicode versions of the CLSID &
registry functions.
This commit is contained in:
parent
f419880d64
commit
5807cb79f0
1 changed files with 29 additions and 25 deletions
|
@ -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[200];
|
||||
WCHAR pipefn[100];
|
||||
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));
|
||||
|
||||
WaitNamedPipeA( pipefn, NMPWAIT_WAIT_FOREVER );
|
||||
hPipe = CreateFileA(pipefn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
|
||||
WaitNamedPipeW( pipefn, NMPWAIT_WAIT_FOREVER );
|
||||
hPipe = CreateFileW(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[200];
|
||||
WCHAR pipefn[100];
|
||||
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 = CreateNamedPipeA( pipefn, PIPE_ACCESS_DUPLEX,
|
||||
hPipe = CreateNamedPipeW( 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue