Commit dd6e948d authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

ole32: Convert dump_user_flags() into debugstr_user_flags(), a proper debug trace function.

parent f0ccd389
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
...@@ -43,20 +44,33 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); ...@@ -43,20 +44,33 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align) #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align) #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
static void dump_user_flags(ULONG *pFlags) static const char* debugstr_user_flags(ULONG *pFlags)
{ {
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION) char buf[12];
TRACE("MAKELONG(NDR_LOCAL_REPRESENTATION, "); const char* loword;
else
TRACE("MAKELONG(0x%04x, ", HIWORD(*pFlags));
switch (LOWORD(*pFlags)) switch (LOWORD(*pFlags))
{ {
case MSHCTX_LOCAL: TRACE("MSHCTX_LOCAL)"); break; case MSHCTX_LOCAL:
case MSHCTX_NOSHAREDMEM: TRACE("MSHCTX_NOSHAREDMEM)"); break; loword="MSHCTX_LOCAL";
case MSHCTX_DIFFERENTMACHINE: TRACE("MSHCTX_DIFFERENTMACHINE)"); break; break;
case MSHCTX_INPROC: TRACE("MSHCTX_INPROC)"); break; case MSHCTX_NOSHAREDMEM:
default: TRACE("%d)", LOWORD(*pFlags)); loword="MSHCTX_NOSHAREDMEM";
break;
case MSHCTX_DIFFERENTMACHINE:
loword="MSHCTX_DIFFERENTMACHINE";
break;
case MSHCTX_INPROC:
loword="MSHCTX_INPROC";
break;
default:
sprintf(buf, "%d", LOWORD(*pFlags));
loword=buf;
} }
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
return wine_dbg_sprintf("MAKELONG(NDR_LOCAL_REPRESENTATION, %s)", loword);
else
return wine_dbg_sprintf("MAKELONG(0x%04x, %s)", HIWORD(*pFlags), loword);
} }
/****************************************************************************** /******************************************************************************
...@@ -83,7 +97,7 @@ ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG StartingSize, CLIPFORM ...@@ -83,7 +97,7 @@ ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG StartingSize, CLIPFORM
{ {
ULONG size = StartingSize; ULONG size = StartingSize;
TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, pCF); TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pCF);
size += sizeof(userCLIPFORMAT); size += sizeof(userCLIPFORMAT);
...@@ -128,7 +142,7 @@ unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char * ...@@ -128,7 +142,7 @@ unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *
{ {
wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer; wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &0x%04x\n", pBuffer, *pCF); TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags), pBuffer, *pCF);
wirecf->u.dwValue = *pCF; wirecf->u.dwValue = *pCF;
pBuffer += sizeof(*wirecf); pBuffer += sizeof(*wirecf);
...@@ -185,7 +199,7 @@ unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char ...@@ -185,7 +199,7 @@ unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char
{ {
wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer; wireCLIPFORMAT wirecf = (wireCLIPFORMAT)pBuffer;
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, pCF); TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pCF);
pBuffer += sizeof(*wirecf); pBuffer += sizeof(*wirecf);
if (wirecf->fContext == WDT_INPROC_CALL) if (wirecf->fContext == WDT_INPROC_CALL)
...@@ -282,25 +296,25 @@ static void __RPC_USER handle_UserFree(ULONG *pFlags, HANDLE *phMenu) ...@@ -282,25 +296,25 @@ static void __RPC_USER handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
#define IMPL_WIREM_HANDLE(type) \ #define IMPL_WIREM_HANDLE(type) \
ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \ ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
{ \ { \
TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, handle); \ TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \ return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
} \ } \
\ \
unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \ unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
{ \ { \
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", pBuffer, *handle); \ TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \ return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
} \ } \
\ \
unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \ unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
{ \ { \
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, handle); \ TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \ return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
} \ } \
\ \
void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \ void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
{ \ { \
TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *handle); \ TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
return handle_UserFree(pFlags, (HANDLE *)handle); \ return handle_UserFree(pFlags, (HANDLE *)handle); \
} }
...@@ -315,7 +329,7 @@ ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *ph ...@@ -315,7 +329,7 @@ ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *ph
{ {
ULONG size = StartingSize; ULONG size = StartingSize;
TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, phGlobal); TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, phGlobal);
ALIGN_LENGTH(size, 3); ALIGN_LENGTH(size, 3);
...@@ -340,7 +354,7 @@ ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *ph ...@@ -340,7 +354,7 @@ ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *ph
unsigned char * __RPC_USER HGLOBAL_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal) unsigned char * __RPC_USER HGLOBAL_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", pBuffer, *phGlobal); TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
ALIGN_POINTER(pBuffer, 3); ALIGN_POINTER(pBuffer, 3);
...@@ -385,7 +399,7 @@ unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *p ...@@ -385,7 +399,7 @@ unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *p
{ {
ULONG fContext; ULONG fContext;
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", pBuffer, *phGlobal); TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
ALIGN_POINTER(pBuffer, 3); ALIGN_POINTER(pBuffer, 3);
...@@ -451,7 +465,7 @@ unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *p ...@@ -451,7 +465,7 @@ unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *p
*/ */
void __RPC_USER HGLOBAL_UserFree(ULONG *pFlags, HGLOBAL *phGlobal) void __RPC_USER HGLOBAL_UserFree(ULONG *pFlags, HGLOBAL *phGlobal)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *phGlobal); TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phGlobal);
if (LOWORD(*pFlags != MSHCTX_INPROC) && *phGlobal) if (LOWORD(*pFlags != MSHCTX_INPROC) && *phGlobal)
GlobalFree(*phGlobal); GlobalFree(*phGlobal);
...@@ -531,7 +545,7 @@ ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHME ...@@ -531,7 +545,7 @@ ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHME
{ {
ULONG size = StartingSize; ULONG size = StartingSize;
TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, *phEmf); TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, *phEmf);
size += sizeof(ULONG); size += sizeof(ULONG);
if (LOWORD(*pFlags) == MSHCTX_INPROC) if (LOWORD(*pFlags) == MSHCTX_INPROC)
...@@ -555,7 +569,7 @@ ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHME ...@@ -555,7 +569,7 @@ ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHME
unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf) unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", pBuffer, *phEmf); TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phEmf);
if (LOWORD(*pFlags) == MSHCTX_INPROC) if (LOWORD(*pFlags) == MSHCTX_INPROC)
{ {
...@@ -594,7 +608,7 @@ unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned ch ...@@ -594,7 +608,7 @@ unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned ch
{ {
ULONG fContext; ULONG fContext;
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, phEmf); TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phEmf);
fContext = *(ULONG *)pBuffer; fContext = *(ULONG *)pBuffer;
pBuffer += sizeof(ULONG); pBuffer += sizeof(ULONG);
...@@ -637,7 +651,7 @@ unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned ch ...@@ -637,7 +651,7 @@ unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned ch
void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf) void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *phEmf); TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phEmf);
if (LOWORD(*pFlags) != MSHCTX_INPROC) if (LOWORD(*pFlags) != MSHCTX_INPROC)
DeleteEnhMetaFile(*phEmf); DeleteEnhMetaFile(*phEmf);
...@@ -647,7 +661,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM ...@@ -647,7 +661,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM
{ {
ULONG size = StartingSize; ULONG size = StartingSize;
TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, pStgMedium); TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pStgMedium);
ALIGN_LENGTH(size, 3); ALIGN_LENGTH(size, 3);
...@@ -695,7 +709,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM ...@@ -695,7 +709,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM
unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium) unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, pStgMedium); TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
ALIGN_POINTER(pBuffer, 3); ALIGN_POINTER(pBuffer, 3);
...@@ -754,7 +768,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char ...@@ -754,7 +768,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
ALIGN_POINTER(pBuffer, 3); ALIGN_POINTER(pBuffer, 3);
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, pStgMedium); TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
pStgMedium->tymed = *(DWORD *)pBuffer; pStgMedium->tymed = *(DWORD *)pBuffer;
pBuffer += sizeof(DWORD); pBuffer += sizeof(DWORD);
...@@ -807,7 +821,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char ...@@ -807,7 +821,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium) void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
{ {
TRACE("("); dump_user_flags(pFlags); TRACE(", %p\n", pStgMedium); TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium);
ReleaseStgMedium(pStgMedium); ReleaseStgMedium(pStgMedium);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment