Sync to Wine-0_9_4:

Michael Jung <mjung@iss.tu-darmstadt.de>
- ole32: Periodically call IDropTarger::DragOver during Drag&Drop.
Robert Shearman <rob@codeweavers.com>
- CreateErrorInfo trace fix.
  CreateErrorInfo isn't a stub so don't print this in the trace
  message.
Alexandre Julliard <julliard@winehq.org>
- Take advantage of the __EXCEPT_PAGE_FAULT macro.
- We no longer need to handle EXCEPTION_PRIV_INSTRUCTION on page faults.
- ole32: Revert exception handler change.
  The handler does the opposite of normal page fault handlers.
Ulrich Czekalla <ulrich@codeweavers.com>
- ole32: Return error instead of asserting if storage file is corrupt.
Eric Pouech <eric.pouech@wanadoo.fr>
- Functions with no paramters must be (void).
- Const correctness fixes.

svn path=/trunk/; revision=20350
This commit is contained in:
Gé van Geldorp 2005-12-26 23:16:41 +00:00
parent 907803cd6d
commit 754cd8a82e
8 changed files with 75 additions and 137 deletions

View file

@ -476,7 +476,7 @@ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo)
{ {
IErrorInfo * pei; IErrorInfo * pei;
HRESULT res; HRESULT res;
TRACE("(%p): stub:\n", pperrinfo); TRACE("(%p)\n", pperrinfo);
if(! pperrinfo ) return E_INVALIDARG; if(! pperrinfo ) return E_INVALIDARG;
if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY; if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY;

View file

@ -144,7 +144,7 @@ SEGPTR IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb)
/****************************************************************************** /******************************************************************************
* IMalloc16_GetSize [COMPOBJ.506] * IMalloc16_GetSize [COMPOBJ.506]
*/ */
DWORD IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv) DWORD IMalloc16_fnGetSize(IMalloc16* iface,SEGPTR pv)
{ {
IMalloc16Impl *This = (IMalloc16Impl *)iface; IMalloc16Impl *This = (IMalloc16Impl *)iface;
TRACE("(%p)->GetSize(%08lx)\n",This,pv); TRACE("(%p)->GetSize(%08lx)\n",This,pv);
@ -154,7 +154,7 @@ DWORD IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv)
/****************************************************************************** /******************************************************************************
* IMalloc16_DidAlloc [COMPOBJ.507] * IMalloc16_DidAlloc [COMPOBJ.507]
*/ */
INT16 IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) { INT16 IMalloc16_fnDidAlloc(IMalloc16* iface,LPVOID pv) {
IMalloc16 *This = (IMalloc16 *)iface; IMalloc16 *This = (IMalloc16 *)iface;
TRACE("(%p)->DidAlloc(%p)\n",This,pv); TRACE("(%p)->DidAlloc(%p)\n",This,pv);
return (INT16)-1; return (INT16)-1;
@ -173,7 +173,7 @@ LPVOID IMalloc16_fnHeapMinimize(IMalloc16* iface) {
* IMalloc16_Constructor [VTABLE] * IMalloc16_Constructor [VTABLE]
*/ */
LPMALLOC16 LPMALLOC16
IMalloc16_Constructor() IMalloc16_Constructor(void)
{ {
static IMalloc16Vtbl vt16; static IMalloc16Vtbl vt16;
static SEGPTR msegvt16; static SEGPTR msegvt16;

View file

@ -79,6 +79,8 @@ typedef struct tagTrackerWindowInfo
HWND curTargetHWND; /* window the mouse is hovering over */ HWND curTargetHWND; /* window the mouse is hovering over */
HWND curDragTargetHWND; /* might be a ancestor of curTargetHWND */ HWND curDragTargetHWND; /* might be a ancestor of curTargetHWND */
IDropTarget* curDragTarget; IDropTarget* curDragTarget;
POINTL curMousePos; /* current position of the mouse in screen coordinates */
DWORD dwKeyState; /* current state of the shift and ctrl keys and the mouse buttons */
} TrackerWindowInfo; } TrackerWindowInfo;
typedef struct tagOleMenuDescriptor /* OleMenuDescriptor */ typedef struct tagOleMenuDescriptor /* OleMenuDescriptor */
@ -158,13 +160,9 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
static void OLEDD_TrackMouseMove( static void OLEDD_TrackMouseMove(
TrackerWindowInfo* trackerInfo, TrackerWindowInfo* trackerInfo);
POINT mousePos,
DWORD keyState);
static void OLEDD_TrackStateChange( static void OLEDD_TrackStateChange(
TrackerWindowInfo* trackerInfo, TrackerWindowInfo* trackerInfo);
POINT mousePos,
DWORD keyState);
static DWORD OLEDD_GetButtonState(void); static DWORD OLEDD_GetButtonState(void);
@ -533,6 +531,10 @@ HRESULT WINAPI DoDragDrop (
*/ */
while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) ) while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) )
{ {
trackerInfo.curMousePos.x = msg.pt.x;
trackerInfo.curMousePos.y = msg.pt.y;
trackerInfo.dwKeyState = OLEDD_GetButtonState();
if ( (msg.message >= WM_KEYFIRST) && if ( (msg.message >= WM_KEYFIRST) &&
(msg.message <= WM_KEYLAST) ) (msg.message <= WM_KEYLAST) )
{ {
@ -551,9 +553,7 @@ HRESULT WINAPI DoDragDrop (
/* /*
* Notify the drop source. * Notify the drop source.
*/ */
OLEDD_TrackStateChange(&trackerInfo, OLEDD_TrackStateChange(&trackerInfo);
msg.pt,
OLEDD_GetButtonState());
} }
else else
{ {
@ -2033,6 +2033,9 @@ static DropTargetNode* OLEDD_FindDropTarget(HWND hwndOfTarget)
* to receive the user input and act upon it. This procedure is in charge * to receive the user input and act upon it. This procedure is in charge
* of this behavior. * of this behavior.
*/ */
#define DRAG_TIMER_ID 1
static LRESULT WINAPI OLEDD_DragTrackerWindowProc( static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
HWND hwnd, HWND hwnd,
UINT uMsg, UINT uMsg,
@ -2046,27 +2049,14 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam; LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
SetTimer(hwnd, DRAG_TIMER_ID, 50, NULL);
break; break;
} }
case WM_TIMER:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
TrackerWindowInfo* trackerInfo = (TrackerWindowInfo*)GetWindowLongA(hwnd, 0); OLEDD_TrackMouseMove((TrackerWindowInfo*)GetWindowLongA(hwnd, 0));
POINT mousePos;
/*
* Get the current mouse position in screen coordinates.
*/
mousePos.x = LOWORD(lParam);
mousePos.y = HIWORD(lParam);
ClientToScreen(hwnd, &mousePos);
/*
* Track the movement of the mouse.
*/
OLEDD_TrackMouseMove(trackerInfo, mousePos, wParam);
break; break;
} }
case WM_LBUTTONUP: case WM_LBUTTONUP:
@ -2076,22 +2066,12 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
{ {
TrackerWindowInfo* trackerInfo = (TrackerWindowInfo*)GetWindowLongA(hwnd, 0); OLEDD_TrackStateChange((TrackerWindowInfo*)GetWindowLongA(hwnd, 0));
POINT mousePos; break;
}
/* case WM_DESTROY:
* Get the current mouse position in screen coordinates. {
*/ KillTimer(hwnd, DRAG_TIMER_ID);
mousePos.x = LOWORD(lParam);
mousePos.y = HIWORD(lParam);
ClientToScreen(hwnd, &mousePos);
/*
* Notify everyone that the button state changed
* TODO: Check if the "escape" key was pressed.
*/
OLEDD_TrackStateChange(trackerInfo, mousePos, wParam);
break; break;
} }
} }
@ -2114,23 +2094,19 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
* trackerInfo - Pointer to the structure identifying the * trackerInfo - Pointer to the structure identifying the
* drag & drop operation that is currently * drag & drop operation that is currently
* active. * active.
* mousePos - Current position of the mouse in screen
* coordinates.
* keyState - Contains the state of the shift keys and the
* mouse buttons (MK_LBUTTON and the like)
*/ */
static void OLEDD_TrackMouseMove( static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo)
TrackerWindowInfo* trackerInfo,
POINT mousePos,
DWORD keyState)
{ {
HWND hwndNewTarget = 0; HWND hwndNewTarget = 0;
HRESULT hr = S_OK; HRESULT hr = S_OK;
POINT pt;
/* /*
* Get the handle of the window under the mouse * Get the handle of the window under the mouse
*/ */
hwndNewTarget = WindowFromPoint(mousePos); pt.x = trackerInfo->curMousePos.x;
pt.y = trackerInfo->curMousePos.y;
hwndNewTarget = WindowFromPoint(pt);
/* /*
* Every time, we re-initialize the effects passed to the * Every time, we re-initialize the effects passed to the
@ -2145,19 +2121,9 @@ static void OLEDD_TrackMouseMove(
if ( (trackerInfo->curDragTarget != 0) && if ( (trackerInfo->curDragTarget != 0) &&
(trackerInfo->curTargetHWND == hwndNewTarget) ) (trackerInfo->curTargetHWND == hwndNewTarget) )
{ {
POINTL mousePosParam;
/*
* The documentation tells me that the coordinate should be in the target
* window's coordinate space. However, the tests I made tell me the
* coordinates should be in screen coordinates.
*/
mousePosParam.x = mousePos.x;
mousePosParam.y = mousePos.y;
IDropTarget_DragOver(trackerInfo->curDragTarget, IDropTarget_DragOver(trackerInfo->curDragTarget,
keyState, trackerInfo->dwKeyState,
mousePosParam, trackerInfo->curMousePos,
trackerInfo->pdwEffect); trackerInfo->pdwEffect);
} }
else else
@ -2197,20 +2163,10 @@ static void OLEDD_TrackMouseMove(
*/ */
if (trackerInfo->curDragTarget!=0) if (trackerInfo->curDragTarget!=0)
{ {
POINTL mousePosParam;
/*
* The documentation tells me that the coordinate should be in the target
* window's coordinate space. However, the tests I made tell me the
* coordinates should be in screen coordinates.
*/
mousePosParam.x = mousePos.x;
mousePosParam.y = mousePos.y;
IDropTarget_DragEnter(trackerInfo->curDragTarget, IDropTarget_DragEnter(trackerInfo->curDragTarget,
trackerInfo->dataObject, trackerInfo->dataObject,
keyState, trackerInfo->dwKeyState,
mousePosParam, trackerInfo->curMousePos,
trackerInfo->pdwEffect); trackerInfo->pdwEffect);
} }
} }
@ -2276,15 +2232,8 @@ static void OLEDD_TrackMouseMove(
* trackerInfo - Pointer to the structure identifying the * trackerInfo - Pointer to the structure identifying the
* drag & drop operation that is currently * drag & drop operation that is currently
* active. * active.
* mousePos - Current position of the mouse in screen
* coordinates.
* keyState - Contains the state of the shift keys and the
* mouse buttons (MK_LBUTTON and the like)
*/ */
static void OLEDD_TrackStateChange( static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
TrackerWindowInfo* trackerInfo,
POINT mousePos,
DWORD keyState)
{ {
/* /*
* Ask the drop source what to do with the operation. * Ask the drop source what to do with the operation.
@ -2292,7 +2241,7 @@ static void OLEDD_TrackStateChange(
trackerInfo->returnValue = IDropSource_QueryContinueDrag( trackerInfo->returnValue = IDropSource_QueryContinueDrag(
trackerInfo->dropSource, trackerInfo->dropSource,
trackerInfo->escPressed, trackerInfo->escPressed,
keyState); trackerInfo->dwKeyState);
/* /*
* All the return valued will stop the operation except the S_OK * All the return valued will stop the operation except the S_OK
@ -2325,20 +2274,10 @@ static void OLEDD_TrackStateChange(
*/ */
case DRAGDROP_S_DROP: case DRAGDROP_S_DROP:
{ {
POINTL mousePosParam;
/*
* The documentation tells me that the coordinate should be
* in the target window's coordinate space. However, the tests
* I made tell me the coordinates should be in screen coordinates.
*/
mousePosParam.x = mousePos.x;
mousePosParam.y = mousePos.y;
IDropTarget_Drop(trackerInfo->curDragTarget, IDropTarget_Drop(trackerInfo->curDragTarget,
trackerInfo->dataObject, trackerInfo->dataObject,
keyState, trackerInfo->dwKeyState,
mousePosParam, trackerInfo->curMousePos,
trackerInfo->pdwEffect); trackerInfo->pdwEffect);
break; break;
} }

View file

@ -112,8 +112,7 @@ struct dispatch_params
static WINE_EXCEPTION_FILTER(ole_filter) static WINE_EXCEPTION_FILTER(ole_filter)
{ {
if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION || if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
GetExceptionCode() == EXCEPTION_PRIV_INSTRUCTION)
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }

View file

@ -273,7 +273,7 @@ static HRESULT WINAPI StgStreamImpl_Read(
*/ */
if (This->smallBlockChain!=0) if (This->smallBlockChain!=0)
{ {
SmallBlockChainStream_ReadAt(This->smallBlockChain, res = SmallBlockChainStream_ReadAt(This->smallBlockChain,
This->currentPosition, This->currentPosition,
bytesToReadFromBuffer, bytesToReadFromBuffer,
pv, pv,
@ -282,7 +282,7 @@ static HRESULT WINAPI StgStreamImpl_Read(
} }
else if (This->bigBlockChain!=0) else if (This->bigBlockChain!=0)
{ {
BlockChainStream_ReadAt(This->bigBlockChain, res = BlockChainStream_ReadAt(This->bigBlockChain,
This->currentPosition, This->currentPosition,
bytesToReadFromBuffer, bytesToReadFromBuffer,
pv, pv,
@ -300,30 +300,19 @@ static HRESULT WINAPI StgStreamImpl_Read(
goto end; goto end;
} }
/* if (SUCCEEDED(res))
* We should always be able to read the proper amount of data from the
* chain.
*/
assert(bytesToReadFromBuffer == *pcbRead);
/*
* Advance the pointer for the number of positions read.
*/
This->currentPosition.u.LowPart += *pcbRead;
if(*pcbRead != cb)
{ {
WARN("read %ld instead of the required %ld bytes !\n", *pcbRead, cb); /*
/* * We should always be able to read the proper amount of data from the
* this used to return S_FALSE, however MSDN docu says that an app should * chain.
* be prepared to handle error in case of stream end reached, as *some* */
* implementations *might* return an error (IOW: most do *not*). assert(bytesToReadFromBuffer == *pcbRead);
* As some program fails on returning S_FALSE, I better use S_OK here.
*/ /*
res = S_OK; * Advance the pointer for the number of positions read.
*/
This->currentPosition.u.LowPart += *pcbRead;
} }
else
res = S_OK;
end: end:
TRACE("<-- %08lx\n", res); TRACE("<-- %08lx\n", res);

View file

@ -3414,7 +3414,8 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
ULARGE_INTEGER size, offset; ULARGE_INTEGER size, offset;
ULONG cbRead, cbWritten, cbTotalRead, cbTotalWritten; ULONG cbRead, cbWritten, cbTotalRead, cbTotalWritten;
ULONG propertyIndex; ULONG propertyIndex;
BOOL successRead, successWrite; BOOL successWrite;
HRESULT successRead;
StgProperty chainProperty; StgProperty chainProperty;
BYTE *buffer; BYTE *buffer;
BlockChainStream *bbTempChain = NULL; BlockChainStream *bbTempChain = NULL;
@ -3463,7 +3464,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
offset.u.LowPart += This->smallBlockSize; offset.u.LowPart += This->smallBlockSize;
} while (successRead && successWrite); } while (SUCCEEDED(successRead) && successWrite);
HeapFree(GetProcessHeap(),0,buffer); HeapFree(GetProcessHeap(),0,buffer);
assert(cbTotalRead == cbTotalWritten); assert(cbTotalRead == cbTotalWritten);
@ -4397,6 +4398,9 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This,
blockNoInSequence--; blockNoInSequence--;
} }
if ((blockNoInSequence > 0) && (blockIndex == BLOCK_END_OF_CHAIN))
return FALSE; /* We failed to find the starting block */
This->lastBlockNoInSequenceIndex = blockIndex; This->lastBlockNoInSequenceIndex = blockIndex;
/* /*
@ -5098,13 +5102,14 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
* bytesRead may be NULL. * bytesRead may be NULL.
* Failure will be returned if the specified number of bytes has not been read. * Failure will be returned if the specified number of bytes has not been read.
*/ */
BOOL SmallBlockChainStream_ReadAt( HRESULT SmallBlockChainStream_ReadAt(
SmallBlockChainStream* This, SmallBlockChainStream* This,
ULARGE_INTEGER offset, ULARGE_INTEGER offset,
ULONG size, ULONG size,
void* buffer, void* buffer,
ULONG* bytesRead) ULONG* bytesRead)
{ {
HRESULT rc = S_OK;
ULARGE_INTEGER offsetInBigBlockFile; ULARGE_INTEGER offsetInBigBlockFile;
ULONG blockNoInSequence = ULONG blockNoInSequence =
offset.u.LowPart / This->parentStorage->smallBlockSize; offset.u.LowPart / This->parentStorage->smallBlockSize;
@ -5127,9 +5132,9 @@ BOOL SmallBlockChainStream_ReadAt(
while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN))
{ {
if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, rc = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex);
&blockIndex))) if(FAILED(rc))
return FALSE; return rc;
blockNoInSequence--; blockNoInSequence--;
} }
@ -5158,27 +5163,32 @@ BOOL SmallBlockChainStream_ReadAt(
/* /*
* Read those bytes in the buffer from the small block file. * Read those bytes in the buffer from the small block file.
* The small block has already been identified so it shouldn't fail
* unless the file is corrupt.
*/ */
BlockChainStream_ReadAt(This->parentStorage->smallBlockRootChain, if (!BlockChainStream_ReadAt(This->parentStorage->smallBlockRootChain,
offsetInBigBlockFile, offsetInBigBlockFile,
bytesToReadInBuffer, bytesToReadInBuffer,
bufferWalker, bufferWalker,
&bytesReadFromBigBlockFile); &bytesReadFromBigBlockFile))
return STG_E_DOCFILECORRUPT;
assert(bytesReadFromBigBlockFile == bytesToReadInBuffer); assert(bytesReadFromBigBlockFile == bytesToReadInBuffer);
/* /*
* Step to the next big block. * Step to the next big block.
*/ */
if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) rc = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex);
return FALSE; if(FAILED(rc))
return rc;
bufferWalker += bytesToReadInBuffer; bufferWalker += bytesToReadInBuffer;
size -= bytesToReadInBuffer; size -= bytesToReadInBuffer;
*bytesRead += bytesToReadInBuffer; *bytesRead += bytesToReadInBuffer;
offsetInBlock = 0; /* There is no offset on the next block */ offsetInBlock = 0; /* There is no offset on the next block */
} }
return (size == 0); return rc;
} }
/****************************************************************************** /******************************************************************************

View file

@ -667,7 +667,7 @@ void SmallBlockChainStream_FreeBlock(
ULONG SmallBlockChainStream_GetNextFreeBlock( ULONG SmallBlockChainStream_GetNextFreeBlock(
SmallBlockChainStream* This); SmallBlockChainStream* This);
BOOL SmallBlockChainStream_ReadAt( HRESULT SmallBlockChainStream_ReadAt(
SmallBlockChainStream* This, SmallBlockChainStream* This,
ULARGE_INTEGER offset, ULARGE_INTEGER offset,
ULONG size, ULONG size,

View file

@ -2183,6 +2183,7 @@
#define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(0x80030106L) #define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(0x80030106L)
#define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(0x80030107L) #define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(0x80030107L)
#define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(0x80030108L) #define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(0x80030108L)
#define STG_E_DOCFILECORRUPT _HRESULT_TYPEDEF_(0x80030109L)
#define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(0x80030305L) #define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(0x80030305L)
#define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(0x80030306L) #define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(0x80030306L)