Fixed incorrect pointer-cast arithmetic.

Extended ole trace information.
Don't lose the existing pipes on alloc failure.
This commit is contained in:
Bill Medland 2002-06-04 00:53:21 +00:00 committed by Alexandre Julliard
parent bbbc18b12c
commit 978a934245

View File

@ -94,7 +94,7 @@ _xread(HANDLE hf, LPVOID ptr, DWORD size) {
return E_FAIL;
}
if (res!=size) {
FIXME("Read only %ld of %ld bytes.\n",res,size);
FIXME("Read only %ld of %ld bytes from %x.\n",res,size,hf);
return E_FAIL;
}
return S_OK;
@ -130,7 +130,7 @@ _xwrite(HANDLE hf, LPVOID ptr, DWORD size) {
return E_FAIL;
}
if (res!=size) {
FIXME("Wrote only %ld of %ld bytes.\n",res,size);
FIXME("Wrote only %ld of %ld bytes to %x.\n",res,size,hf);
return E_FAIL;
}
return S_OK;
@ -142,22 +142,24 @@ static HRESULT
PIPE_RegisterPipe(wine_marshal_id *mid, HANDLE hPipe, BOOL startreader) {
int i;
char pipefn[100];
wine_pipe *new_pipes;
for (i=0;i<nrofpipes;i++)
if (pipes[i].mid.processid==mid->processid)
return S_OK;
if (pipes)
pipes=(wine_pipe*)HeapReAlloc(GetProcessHeap(),0,pipes,sizeof(pipes[0])*(nrofpipes+1));
new_pipes=(wine_pipe*)HeapReAlloc(GetProcessHeap(),0,pipes,sizeof(pipes[0])*(nrofpipes+1));
else
pipes=(wine_pipe*)HeapAlloc(GetProcessHeap(),0,sizeof(pipes[0]));
if (!pipes) return E_OUTOFMEMORY;
new_pipes=(wine_pipe*)HeapAlloc(GetProcessHeap(),0,sizeof(pipes[0]));
if (!new_pipes) return E_OUTOFMEMORY;
pipes = new_pipes;
sprintf(pipefn,OLESTUBMGR"_%08lx",mid->processid);
memcpy(&(pipes[nrofpipes].mid),mid,sizeof(*mid));
pipes[nrofpipes].hPipe = hPipe;
InitializeCriticalSection(&(pipes[nrofpipes].crit));
nrofpipes++;
if (startreader) {
pipes[nrofpipes-1].hThread = CreateThread(NULL,0,_StubReaderThread,(LPVOID)pipes+(nrofpipes-1),0,&(pipes[nrofpipes-1].tid));
pipes[nrofpipes-1].hThread = CreateThread(NULL,0,_StubReaderThread,(LPVOID)(pipes+(nrofpipes-1)),0,&(pipes[nrofpipes-1].tid));
} else {
pipes[nrofpipes-1].tid = GetCurrentThreadId();
}