ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

usrmarshal.c
Go to the documentation of this file.
00001 /*
00002  * Miscellaneous Marshaling Routines
00003  *
00004  * Copyright 2005 Robert Shearman
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include <stdio.h>
00022 #include <stdarg.h>
00023 #include <string.h>
00024 
00025 #define COBJMACROS
00026 #define NONAMELESSUNION
00027 #define NONAMELESSSTRUCT
00028 
00029 #include "windef.h"
00030 #include "winbase.h"
00031 #include "wingdi.h"
00032 #include "winuser.h"
00033 #include "winerror.h"
00034 
00035 #include "ole2.h"
00036 #include "oleauto.h"
00037 #include "rpcproxy.h"
00038 
00039 #include "wine/unicode.h"
00040 #include "wine/debug.h"
00041 
00042 WINE_DEFAULT_DEBUG_CHANNEL(ole);
00043 
00044 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
00045 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
00046 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
00047 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
00048 
00049 #define USER_MARSHAL_PTR_PREFIX \
00050   ( (DWORD)'U'         | ( (DWORD)'s' << 8 ) | \
00051   ( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
00052 
00053 static const char* debugstr_user_flags(ULONG *pFlags)
00054 {
00055     char buf[12];
00056     const char* loword;
00057     switch (LOWORD(*pFlags))
00058     {
00059     case MSHCTX_LOCAL:
00060         loword="MSHCTX_LOCAL";
00061         break;
00062     case MSHCTX_NOSHAREDMEM:
00063         loword="MSHCTX_NOSHAREDMEM";
00064         break;
00065     case MSHCTX_DIFFERENTMACHINE:
00066         loword="MSHCTX_DIFFERENTMACHINE";
00067         break;
00068     case MSHCTX_INPROC:
00069         loword="MSHCTX_INPROC";
00070         break;
00071     default:
00072         sprintf(buf, "%d", LOWORD(*pFlags));
00073         loword=buf;
00074     }
00075 
00076     if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
00077         return wine_dbg_sprintf("MAKELONG(NDR_LOCAL_REPRESENTATION, %s)", loword);
00078     else
00079         return wine_dbg_sprintf("MAKELONG(0x%04x, %s)", HIWORD(*pFlags), loword);
00080 }
00081 
00082 /******************************************************************************
00083  *           CLIPFORMAT_UserSize [OLE32.@]
00084  *
00085  * Calculates the buffer size required to marshal a clip format.
00086  *
00087  * PARAMS
00088  *  pFlags       [I] Flags. See notes.
00089  *  StartingSize [I] Starting size of the buffer. This value is added on to
00090  *                   the buffer size required for the clip format.
00091  *  pCF          [I] Clip format to size.
00092  *
00093  * RETURNS
00094  *  The buffer size required to marshal a clip format plus the starting size.
00095  *
00096  * NOTES
00097  *  Even though the function is documented to take a pointer to an unsigned
00098  *  long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00099  *  the first parameter is an unsigned long.
00100  *  This function is only intended to be called by the RPC runtime.
00101  */
00102 ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG StartingSize, CLIPFORMAT *pCF)
00103 {
00104     ULONG size = StartingSize;
00105 
00106     TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pCF);
00107 
00108     size += 8;
00109 
00110     /* only need to marshal the name if it is not a pre-defined type and
00111      * we are going remote */
00112     if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
00113     {
00114         WCHAR format[255];
00115         INT ret;
00116         size += 3 * sizeof(UINT);
00117         /* urg! this function is badly designed because it won't tell us how
00118          * much space is needed without doing a dummy run of storing the
00119          * name into a buffer */
00120         ret = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
00121         if (!ret)
00122             RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
00123         size += (ret + 1) * sizeof(WCHAR);
00124     }
00125     return size;
00126 }
00127 
00128 /******************************************************************************
00129  *           CLIPFORMAT_UserMarshal [OLE32.@]
00130  *
00131  * Marshals a clip format into a buffer.
00132  *
00133  * PARAMS
00134  *  pFlags  [I] Flags. See notes.
00135  *  pBuffer [I] Buffer to marshal the clip format into.
00136  *  pCF     [I] Clip format to marshal.
00137  *
00138  * RETURNS
00139  *  The end of the marshaled data in the buffer.
00140  *
00141  * NOTES
00142  *  Even though the function is documented to take a pointer to an unsigned
00143  *  long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00144  *  the first parameter is an unsigned long.
00145  *  This function is only intended to be called by the RPC runtime.
00146  */
00147 unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
00148 {
00149     TRACE("(%s, %p, &0x%04x\n", debugstr_user_flags(pFlags), pBuffer, *pCF);
00150 
00151     /* only need to marshal the name if it is not a pre-defined type and
00152      * we are going remote */
00153     if ((*pCF >= 0xc000) && (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE))
00154     {
00155         WCHAR format[255];
00156         UINT len;
00157 
00158         *(DWORD *)pBuffer = WDT_REMOTE_CALL;
00159         pBuffer += 4;
00160         *(DWORD *)pBuffer = *pCF;
00161         pBuffer += 4;
00162 
00163         len = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1);
00164         if (!len)
00165             RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
00166         len += 1;
00167         *(UINT *)pBuffer = len;
00168         pBuffer += sizeof(UINT);
00169         *(UINT *)pBuffer = 0;
00170         pBuffer += sizeof(UINT);
00171         *(UINT *)pBuffer = len;
00172         pBuffer += sizeof(UINT);
00173         TRACE("marshaling format name %s\n", debugstr_w(format));
00174         memcpy(pBuffer, format, len * sizeof(WCHAR));
00175         pBuffer += len * sizeof(WCHAR);
00176     }
00177     else
00178     {
00179         *(DWORD *)pBuffer = WDT_INPROC_CALL;
00180         pBuffer += 4;
00181         *(DWORD *)pBuffer = *pCF;
00182         pBuffer += 4;
00183     }
00184 
00185     return pBuffer;
00186 }
00187 
00188 /******************************************************************************
00189  *           CLIPFORMAT_UserUnmarshal [OLE32.@]
00190  *
00191  * Unmarshals a clip format from a buffer.
00192  *
00193  * PARAMS
00194  *  pFlags  [I] Flags. See notes.
00195  *  pBuffer [I] Buffer to marshal the clip format from.
00196  *  pCF     [O] Address that receive the unmarshaled clip format.
00197  *
00198  * RETURNS
00199  *  The end of the marshaled data in the buffer.
00200  *
00201  * NOTES
00202  *  Even though the function is documented to take a pointer to an unsigned
00203  *  long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00204  *  the first parameter is an unsigned long.
00205  *  This function is only intended to be called by the RPC runtime.
00206  */
00207 unsigned char * __RPC_USER CLIPFORMAT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, CLIPFORMAT *pCF)
00208 {
00209     LONG fContext;
00210 
00211     TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pCF);
00212 
00213     fContext = *(DWORD *)pBuffer;
00214     pBuffer += 4;
00215 
00216     if (fContext == WDT_INPROC_CALL)
00217     {
00218         *pCF = *(CLIPFORMAT *)pBuffer;
00219         pBuffer += 4;
00220     }
00221     else if (fContext == WDT_REMOTE_CALL)
00222     {
00223         CLIPFORMAT cf;
00224         UINT len;
00225 
00226         /* pointer ID for registered clip format string */
00227         if (*(DWORD *)pBuffer == 0)
00228             RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
00229         pBuffer += 4;
00230 
00231         len = *(UINT *)pBuffer;
00232         pBuffer += sizeof(UINT);
00233         if (*(UINT *)pBuffer != 0)
00234             RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
00235         pBuffer += sizeof(UINT);
00236         if (*(UINT *)pBuffer != len)
00237             RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
00238         pBuffer += sizeof(UINT);
00239         if (((WCHAR *)pBuffer)[len - 1] != '\0')
00240             RaiseException(RPC_S_INVALID_BOUND, 0, 0, NULL);
00241         TRACE("unmarshaling clip format %s\n", debugstr_w((LPCWSTR)pBuffer));
00242         cf = RegisterClipboardFormatW((LPCWSTR)pBuffer);
00243         pBuffer += len * sizeof(WCHAR);
00244         if (!cf)
00245             RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL);
00246         *pCF = cf;
00247     }
00248     else
00249         /* code not really appropriate, but nearest I can find */
00250         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
00251     return pBuffer;
00252 }
00253 
00254 /******************************************************************************
00255  *           CLIPFORMAT_UserFree [OLE32.@]
00256  *
00257  * Frees an unmarshaled clip format.
00258  *
00259  * PARAMS
00260  *  pFlags  [I] Flags. See notes.
00261  *  pCF     [I] Clip format to free.
00262  *
00263  * RETURNS
00264  *  The end of the marshaled data in the buffer.
00265  *
00266  * NOTES
00267  *  Even though the function is documented to take a pointer to an unsigned
00268  *  long in pFlags, it actually takes a pointer to a USER_MARSHAL_CB
00269  *  structure, of which the first parameter is an unsigned long.
00270  *  This function is only intended to be called by the RPC runtime.
00271  */
00272 void __RPC_USER CLIPFORMAT_UserFree(ULONG *pFlags, CLIPFORMAT *pCF)
00273 {
00274     /* there is no inverse of the RegisterClipboardFormat function,
00275      * so nothing to do */
00276 }
00277 
00278 static ULONG handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
00279 {
00280     if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
00281     {
00282         ERR("can't remote a local handle\n");
00283         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
00284         return StartingSize;
00285     }
00286     return StartingSize + sizeof(RemotableHandle);
00287 }
00288 
00289 static unsigned char * handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
00290 {
00291     RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
00292     if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
00293     {
00294         ERR("can't remote a local handle\n");
00295         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
00296         return pBuffer;
00297     }
00298     remhandle->fContext = WDT_INPROC_CALL;
00299     remhandle->u.hInproc = (LONG_PTR)*handle;
00300     return pBuffer + sizeof(RemotableHandle);
00301 }
00302 
00303 static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
00304 {
00305     RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
00306     if (remhandle->fContext != WDT_INPROC_CALL)
00307         RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
00308     *handle = (HANDLE)(LONG_PTR)remhandle->u.hInproc;
00309     return pBuffer + sizeof(RemotableHandle);
00310 }
00311 
00312 static void handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
00313 {
00314     /* nothing to do */
00315 }
00316 
00317 #define IMPL_WIREM_HANDLE(type) \
00318     ULONG __RPC_USER type##_UserSize(ULONG *pFlags, ULONG StartingSize, type *handle) \
00319     { \
00320         TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, handle); \
00321         return handle_UserSize(pFlags, StartingSize, (HANDLE *)handle); \
00322     } \
00323     \
00324     unsigned char * __RPC_USER type##_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
00325     { \
00326         TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *handle); \
00327         return handle_UserMarshal(pFlags, pBuffer, (HANDLE *)handle); \
00328     } \
00329     \
00330     unsigned char * __RPC_USER type##_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, type *handle) \
00331     { \
00332         TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, handle); \
00333         return handle_UserUnmarshal(pFlags, pBuffer, (HANDLE *)handle); \
00334     } \
00335     \
00336     void __RPC_USER type##_UserFree(ULONG *pFlags, type *handle) \
00337     { \
00338         TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *handle); \
00339         handle_UserFree(pFlags, (HANDLE *)handle); \
00340     }
00341 
00342 IMPL_WIREM_HANDLE(HACCEL)
00343 IMPL_WIREM_HANDLE(HMENU)
00344 IMPL_WIREM_HANDLE(HWND)
00345 
00346 /******************************************************************************
00347  *           HGLOBAL_UserSize [OLE32.@]
00348  *
00349  * Calculates the buffer size required to marshal an HGLOBAL.
00350  *
00351  * PARAMS
00352  *  pFlags       [I] Flags. See notes.
00353  *  StartingSize [I] Starting size of the buffer. This value is added on to
00354  *                   the buffer size required for the clip format.
00355  *  phGlobal     [I] HGLOBAL to size.
00356  *
00357  * RETURNS
00358  *  The buffer size required to marshal an HGLOBAL plus the starting size.
00359  *
00360  * NOTES
00361  *  Even though the function is documented to take a pointer to a ULONG in
00362  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00363  *  the first parameter is a ULONG.
00364  *  This function is only intended to be called by the RPC runtime.
00365  */
00366 ULONG __RPC_USER HGLOBAL_UserSize(ULONG *pFlags, ULONG StartingSize, HGLOBAL *phGlobal)
00367 {
00368     ULONG size = StartingSize;
00369 
00370     TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, phGlobal);
00371 
00372     ALIGN_LENGTH(size, 3);
00373 
00374     size += sizeof(ULONG);
00375 
00376     if (LOWORD(*pFlags == MSHCTX_INPROC))
00377         size += sizeof(HGLOBAL);
00378     else
00379     {
00380         size += sizeof(ULONG);
00381         if (*phGlobal)
00382         {
00383             SIZE_T ret;
00384             size += 3 * sizeof(ULONG);
00385             ret = GlobalSize(*phGlobal);
00386             size += (ULONG)ret;
00387         }
00388     }
00389     
00390     return size;
00391 }
00392 
00393 /******************************************************************************
00394  *           HGLOBAL_UserMarshal [OLE32.@]
00395  *
00396  * Marshals an HGLOBAL into a buffer.
00397  *
00398  * PARAMS
00399  *  pFlags   [I] Flags. See notes.
00400  *  pBuffer  [I] Buffer to marshal the clip format into.
00401  *  phGlobal [I] HGLOBAL to marshal.
00402  *
00403  * RETURNS
00404  *  The end of the marshaled data in the buffer.
00405  *
00406  * NOTES
00407  *  Even though the function is documented to take a pointer to a ULONG in
00408  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00409  *  the first parameter is a ULONG.
00410  *  This function is only intended to be called by the RPC runtime.
00411  */
00412 unsigned char * __RPC_USER HGLOBAL_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
00413 {
00414     TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
00415 
00416     ALIGN_POINTER(pBuffer, 3);
00417 
00418     if (LOWORD(*pFlags == MSHCTX_INPROC))
00419     {
00420         if (sizeof(*phGlobal) == 8)
00421             *(ULONG *)pBuffer = WDT_INPROC64_CALL;
00422         else
00423             *(ULONG *)pBuffer = WDT_INPROC_CALL;
00424         pBuffer += sizeof(ULONG);
00425         *(HGLOBAL *)pBuffer = *phGlobal;
00426         pBuffer += sizeof(HGLOBAL);
00427     }
00428     else
00429     {
00430         *(ULONG *)pBuffer = WDT_REMOTE_CALL;
00431         pBuffer += sizeof(ULONG);
00432         *(ULONG *)pBuffer = HandleToULong(*phGlobal);
00433         pBuffer += sizeof(ULONG);
00434         if (*phGlobal)
00435         {
00436             const unsigned char *memory;
00437             SIZE_T size = GlobalSize(*phGlobal);
00438             *(ULONG *)pBuffer = (ULONG)size;
00439             pBuffer += sizeof(ULONG);
00440             *(ULONG *)pBuffer = HandleToULong(*phGlobal);
00441             pBuffer += sizeof(ULONG);
00442             *(ULONG *)pBuffer = (ULONG)size;
00443             pBuffer += sizeof(ULONG);
00444 
00445             memory = GlobalLock(*phGlobal);
00446             memcpy(pBuffer, memory, size);
00447             pBuffer += size;
00448             GlobalUnlock(*phGlobal);
00449         }
00450     }
00451 
00452     return pBuffer;
00453 }
00454 
00455 /******************************************************************************
00456  *           HGLOBAL_UserUnmarshal [OLE32.@]
00457  *
00458  * Unmarshals an HGLOBAL from a buffer.
00459  *
00460  * PARAMS
00461  *  pFlags   [I] Flags. See notes.
00462  *  pBuffer  [I] Buffer to marshal the clip format from.
00463  *  phGlobal [O] Address that receive the unmarshaled HGLOBAL.
00464  *
00465  * RETURNS
00466  *  The end of the marshaled data in the buffer.
00467  *
00468  * NOTES
00469  *  Even though the function is documented to take a pointer to an ULONG in
00470  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00471  *  the first parameter is an ULONG.
00472  *  This function is only intended to be called by the RPC runtime.
00473  */
00474 unsigned char * __RPC_USER HGLOBAL_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HGLOBAL *phGlobal)
00475 {
00476     ULONG fContext;
00477 
00478     TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phGlobal);
00479 
00480     ALIGN_POINTER(pBuffer, 3);
00481 
00482     fContext = *(ULONG *)pBuffer;
00483     pBuffer += sizeof(ULONG);
00484 
00485     if (((fContext == WDT_INPROC_CALL) && (sizeof(*phGlobal) < 8)) ||
00486         ((fContext == WDT_INPROC64_CALL) && (sizeof(*phGlobal) == 8)))
00487     {
00488         *phGlobal = *(HGLOBAL *)pBuffer;
00489         pBuffer += sizeof(*phGlobal);
00490     }
00491     else if (fContext == WDT_REMOTE_CALL)
00492     {
00493         ULONG handle;
00494 
00495         handle = *(ULONG *)pBuffer;
00496         pBuffer += sizeof(ULONG);
00497 
00498         if (handle)
00499         {
00500             ULONG size;
00501             void *memory;
00502 
00503             size = *(ULONG *)pBuffer;
00504             pBuffer += sizeof(ULONG);
00505             /* redundancy is bad - it means you have to check consistency like
00506              * this: */
00507             if (*(ULONG *)pBuffer != handle)
00508             {
00509                 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
00510                 return pBuffer;
00511             }
00512             pBuffer += sizeof(ULONG);
00513             /* redundancy is bad - it means you have to check consistency like
00514              * this: */
00515             if (*(ULONG *)pBuffer != size)
00516             {
00517                 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
00518                 return pBuffer;
00519             }
00520             pBuffer += sizeof(ULONG);
00521 
00522             /* FIXME: check size is not too big */
00523 
00524             *phGlobal = GlobalAlloc(GMEM_MOVEABLE, size);
00525             memory = GlobalLock(*phGlobal);
00526             memcpy(memory, pBuffer, size);
00527             pBuffer += size;
00528             GlobalUnlock(*phGlobal);
00529         }
00530         else
00531             *phGlobal = NULL;
00532     }
00533     else
00534         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
00535 
00536     return pBuffer;
00537 }
00538 
00539 /******************************************************************************
00540  *           HGLOBAL_UserFree [OLE32.@]
00541  *
00542  * Frees an unmarshaled HGLOBAL.
00543  *
00544  * PARAMS
00545  *  pFlags   [I] Flags. See notes.
00546  *  phGlobal [I] HGLOBAL to free.
00547  *
00548  * RETURNS
00549  *  The end of the marshaled data in the buffer.
00550  *
00551  * NOTES
00552  *  Even though the function is documented to take a pointer to a ULONG in
00553  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
00554  *  which the first parameter is a ULONG.
00555  *  This function is only intended to be called by the RPC runtime.
00556  */
00557 void __RPC_USER HGLOBAL_UserFree(ULONG *pFlags, HGLOBAL *phGlobal)
00558 {
00559     TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phGlobal);
00560 
00561     if (LOWORD(*pFlags != MSHCTX_INPROC) && *phGlobal)
00562         GlobalFree(*phGlobal);
00563 }
00564 
00565 /******************************************************************************
00566  *           HBITMAP_UserSize [OLE32.@]
00567  *
00568  * Calculates the buffer size required to marshal a bitmap.
00569  *
00570  * PARAMS
00571  *  pFlags       [I] Flags. See notes.
00572  *  StartingSize [I] Starting size of the buffer. This value is added on to
00573  *                   the buffer size required for the clip format.
00574  *  phBmp        [I] Bitmap to size.
00575  *
00576  * RETURNS
00577  *  The buffer size required to marshal an bitmap plus the starting size.
00578  *
00579  * NOTES
00580  *  Even though the function is documented to take a pointer to a ULONG in
00581  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00582  *  the first parameter is a ULONG.
00583  *  This function is only intended to be called by the RPC runtime.
00584  */
00585 ULONG __RPC_USER HBITMAP_UserSize(ULONG *pFlags, ULONG StartingSize, HBITMAP *phBmp)
00586 {
00587     FIXME(":stub\n");
00588     return StartingSize;
00589 }
00590 
00591 /******************************************************************************
00592 *           HBITMAP_UserMarshal [OLE32.@]
00593 *
00594 * Marshals a bitmap into a buffer.
00595 *
00596 * PARAMS
00597 *  pFlags  [I] Flags. See notes.
00598 *  pBuffer [I] Buffer to marshal the clip format into.
00599 *  phBmp   [I] Bitmap to marshal.
00600 *
00601 * RETURNS
00602 *  The end of the marshaled data in the buffer.
00603 *
00604 * NOTES
00605 *  Even though the function is documented to take a pointer to a ULONG in
00606 *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00607 *  the first parameter is a ULONG.
00608 *  This function is only intended to be called by the RPC runtime.
00609 */
00610 unsigned char * __RPC_USER HBITMAP_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
00611 {
00612     FIXME(":stub\n");
00613     return pBuffer;
00614 }
00615 
00616 /******************************************************************************
00617  *           HBITMAP_UserUnmarshal [OLE32.@]
00618  *
00619  * Unmarshals a bitmap from a buffer.
00620  *
00621  * PARAMS
00622  *  pFlags   [I] Flags. See notes.
00623  *  pBuffer  [I] Buffer to marshal the clip format from.
00624  *  phBmp    [O] Address that receive the unmarshaled bitmap.
00625  *
00626  * RETURNS
00627  *  The end of the marshaled data in the buffer.
00628  *
00629  * NOTES
00630  *  Even though the function is documented to take a pointer to an ULONG in
00631  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00632  *  the first parameter is an ULONG.
00633  *  This function is only intended to be called by the RPC runtime.
00634  */
00635 unsigned char * __RPC_USER HBITMAP_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HBITMAP *phBmp)
00636 {
00637     FIXME(":stub\n");
00638     return pBuffer;
00639 }
00640 
00641 /******************************************************************************
00642  *           HBITMAP_UserFree [OLE32.@]
00643  *
00644  * Frees an unmarshaled bitmap.
00645  *
00646  * PARAMS
00647  *  pFlags   [I] Flags. See notes.
00648  *  phBmp    [I] Bitmap to free.
00649  *
00650  * RETURNS
00651  *  The end of the marshaled data in the buffer.
00652  *
00653  * NOTES
00654  *  Even though the function is documented to take a pointer to a ULONG in
00655  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
00656  *  which the first parameter is a ULONG.
00657  *  This function is only intended to be called by the RPC runtime.
00658  */
00659 void __RPC_USER HBITMAP_UserFree(ULONG *pFlags, HBITMAP *phBmp)
00660 {
00661     FIXME(":stub\n");
00662 }
00663 
00664 /******************************************************************************
00665  *           HICON_UserSize [OLE32.@]
00666  *
00667  * Calculates the buffer size required to marshal an icon.
00668  *
00669  * PARAMS
00670  *  pFlags       [I] Flags. See notes.
00671  *  StartingSize [I] Starting size of the buffer. This value is added on to
00672  *                   the buffer size required for the icon.
00673  *  phIcon       [I] Icon to size.
00674  *
00675  * RETURNS
00676  *  The buffer size required to marshal an icon plus the starting size.
00677  *
00678  * NOTES
00679  *  Even though the function is documented to take a pointer to a ULONG in
00680  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00681  *  the first parameter is a ULONG.
00682  *  This function is only intended to be called by the RPC runtime.
00683  */
00684 ULONG __RPC_USER HICON_UserSize(ULONG *pFlags, ULONG StartingSize, HICON *phIcon)
00685 {
00686     FIXME(":stub\n");
00687     return StartingSize;
00688 }
00689 
00690 /******************************************************************************
00691 *           HICON_UserMarshal [OLE32.@]
00692 *
00693 * Marshals an icon into a buffer.
00694 *
00695 * PARAMS
00696 *  pFlags  [I] Flags. See notes.
00697 *  pBuffer [I] Buffer to marshal the icon into.
00698 *  phIcon  [I] Icon to marshal.
00699 *
00700 * RETURNS
00701 *  The end of the marshaled data in the buffer.
00702 *
00703 * NOTES
00704 *  Even though the function is documented to take a pointer to a ULONG in
00705 *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00706 *  the first parameter is a ULONG.
00707 *  This function is only intended to be called by the RPC runtime.
00708 */
00709 unsigned char * __RPC_USER HICON_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
00710 {
00711     FIXME(":stub\n");
00712     return pBuffer;
00713 }
00714 
00715 /******************************************************************************
00716  *           HICON_UserUnmarshal [OLE32.@]
00717  *
00718  * Unmarshals an icon from a buffer.
00719  *
00720  * PARAMS
00721  *  pFlags   [I] Flags. See notes.
00722  *  pBuffer  [I] Buffer to marshal the icon from.
00723  *  phIcon   [O] Address that receive the unmarshaled icon.
00724  *
00725  * RETURNS
00726  *  The end of the marshaled data in the buffer.
00727  *
00728  * NOTES
00729  *  Even though the function is documented to take a pointer to an ULONG in
00730  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00731  *  the first parameter is an ULONG.
00732  *  This function is only intended to be called by the RPC runtime.
00733  */
00734 unsigned char * __RPC_USER HICON_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HICON *phIcon)
00735 {
00736     FIXME(":stub\n");
00737     return pBuffer;
00738 }
00739 
00740 /******************************************************************************
00741  *           HICON_UserFree [OLE32.@]
00742  *
00743  * Frees an unmarshaled icon.
00744  *
00745  * PARAMS
00746  *  pFlags   [I] Flags. See notes.
00747  *  phIcon   [I] Icon to free.
00748  *
00749  * RETURNS
00750  *  The end of the marshaled data in the buffer.
00751  *
00752  * NOTES
00753  *  Even though the function is documented to take a pointer to a ULONG in
00754  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
00755  *  which the first parameter is a ULONG.
00756  *  This function is only intended to be called by the RPC runtime.
00757  */
00758 void __RPC_USER HICON_UserFree(ULONG *pFlags, HICON *phIcon)
00759 {
00760     FIXME(":stub\n");
00761 }
00762 
00763 /******************************************************************************
00764  *           HDC_UserSize [OLE32.@]
00765  *
00766  * Calculates the buffer size required to marshal an HDC.
00767  *
00768  * PARAMS
00769  *  pFlags       [I] Flags. See notes.
00770  *  StartingSize [I] Starting size of the buffer. This value is added on to
00771  *                   the buffer size required for the clip format.
00772  *  phGlobal     [I] HDC to size.
00773  *
00774  * RETURNS
00775  *  The buffer size required to marshal an HDC plus the starting size.
00776  *
00777  * NOTES
00778  *  Even though the function is documented to take a pointer to a ULONG in
00779  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00780  *  the first parameter is a ULONG.
00781  *  This function is only intended to be called by the RPC runtime.
00782  */
00783 ULONG __RPC_USER HDC_UserSize(ULONG *pFlags, ULONG StartingSize, HDC *phdc)
00784 {
00785     FIXME(":stub\n");
00786     return StartingSize;
00787 }
00788 
00789 /******************************************************************************
00790  *           HDC_UserMarshal [OLE32.@]
00791  *
00792  * Marshals an HDC into a buffer.
00793  *
00794  * PARAMS
00795  *  pFlags  [I] Flags. See notes.
00796  *  pBuffer [I] Buffer to marshal the clip format into.
00797  *  phdc    [I] HDC to marshal.
00798  *
00799  * RETURNS
00800  *  The end of the marshaled data in the buffer.
00801  *
00802  * NOTES
00803  *  Even though the function is documented to take a pointer to a ULONG in
00804  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00805  *  the first parameter is a ULONG.
00806  *  This function is only intended to be called by the RPC runtime.
00807  */
00808 unsigned char * __RPC_USER HDC_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
00809 {
00810     FIXME(":stub\n");
00811     return pBuffer;
00812 }
00813 
00814 /******************************************************************************
00815  *           HDC_UserUnmarshal [OLE32.@]
00816  *
00817  * Unmarshals an HDC from a buffer.
00818  *
00819  * PARAMS
00820  *  pFlags   [I] Flags. See notes.
00821  *  pBuffer  [I] Buffer to marshal the clip format from.
00822  *  phdc     [O] Address that receive the unmarshaled HDC.
00823  *
00824  * RETURNS
00825  *  The end of the marshaled data in the buffer.
00826  *
00827  * NOTES
00828  *  Even though the function is documented to take a pointer to an ULONG in
00829  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00830  *  the first parameter is an ULONG.
00831  *  This function is only intended to be called by the RPC runtime.
00832  */
00833 unsigned char * __RPC_USER HDC_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HDC *phdc)
00834 {
00835     FIXME(":stub\n");
00836     return pBuffer;
00837 }
00838 
00839 /******************************************************************************
00840  *           HDC_UserFree [OLE32.@]
00841  *
00842  * Frees an unmarshaled HDC.
00843  *
00844  * PARAMS
00845  *  pFlags   [I] Flags. See notes.
00846  *  phdc     [I] HDC to free.
00847  *
00848  * RETURNS
00849  *  The end of the marshaled data in the buffer.
00850  *
00851  * NOTES
00852  *  Even though the function is documented to take a pointer to a ULONG in
00853  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
00854  *  which the first parameter is a ULONG.
00855  *  This function is only intended to be called by the RPC runtime.
00856  */
00857 void __RPC_USER HDC_UserFree(ULONG *pFlags, HDC *phdc)
00858 {
00859     FIXME(":stub\n");
00860 }
00861 
00862 /******************************************************************************
00863  *           HPALETTE_UserSize [OLE32.@]
00864  *
00865  * Calculates the buffer size required to marshal a palette.
00866  *
00867  * PARAMS
00868  *  pFlags       [I] Flags. See notes.
00869  *  StartingSize [I] Starting size of the buffer. This value is added on to
00870  *                   the buffer size required for the clip format.
00871  *  phPal        [I] Palette to size.
00872  *
00873  * RETURNS
00874  *  The buffer size required to marshal a palette plus the starting size.
00875  *
00876  * NOTES
00877  *  Even though the function is documented to take a pointer to a ULONG in
00878  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00879  *  the first parameter is a ULONG.
00880  *  This function is only intended to be called by the RPC runtime.
00881  */
00882 ULONG __RPC_USER HPALETTE_UserSize(ULONG *pFlags, ULONG StartingSize, HPALETTE *phPal)
00883 {
00884     FIXME(":stub\n");
00885     return StartingSize;
00886 }
00887 
00888 /******************************************************************************
00889  *           HPALETTE_UserMarshal [OLE32.@]
00890  *
00891  * Marshals a palette into a buffer.
00892  *
00893  * PARAMS
00894  *  pFlags  [I] Flags. See notes.
00895  *  pBuffer [I] Buffer to marshal the clip format into.
00896  *  phPal   [I] Palette to marshal.
00897  *
00898  * RETURNS
00899  *  The end of the marshaled data in the buffer.
00900  *
00901  * NOTES
00902  *  Even though the function is documented to take a pointer to a ULONG in
00903  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00904  *  the first parameter is a ULONG.
00905  *  This function is only intended to be called by the RPC runtime.
00906  */
00907 unsigned char * __RPC_USER HPALETTE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
00908 {
00909     FIXME(":stub\n");
00910     return pBuffer;
00911 }
00912 
00913 /******************************************************************************
00914  *           HPALETTE_UserUnmarshal [OLE32.@]
00915  *
00916  * Unmarshals a palette from a buffer.
00917  *
00918  * PARAMS
00919  *  pFlags   [I] Flags. See notes.
00920  *  pBuffer  [I] Buffer to marshal the clip format from.
00921  *  phPal    [O] Address that receive the unmarshaled palette.
00922  *
00923  * RETURNS
00924  *  The end of the marshaled data in the buffer.
00925  *
00926  * NOTES
00927  *  Even though the function is documented to take a pointer to an ULONG in
00928  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00929  *  the first parameter is an ULONG.
00930  *  This function is only intended to be called by the RPC runtime.
00931  */
00932 unsigned char * __RPC_USER HPALETTE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HPALETTE *phPal)
00933 {
00934     FIXME(":stub\n");
00935     return pBuffer;
00936 }
00937 
00938 /******************************************************************************
00939  *           HPALETTE_UserFree [OLE32.@]
00940  *
00941  * Frees an unmarshaled palette.
00942  *
00943  * PARAMS
00944  *  pFlags   [I] Flags. See notes.
00945  *  phPal    [I] Palette to free.
00946  *
00947  * RETURNS
00948  *  The end of the marshaled data in the buffer.
00949  *
00950  * NOTES
00951  *  Even though the function is documented to take a pointer to a ULONG in
00952  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
00953  *  which the first parameter is a ULONG.
00954  *  This function is only intended to be called by the RPC runtime.
00955  */
00956 void __RPC_USER HPALETTE_UserFree(ULONG *pFlags, HPALETTE *phPal)
00957 {
00958     FIXME(":stub\n");
00959 }
00960 
00961 
00962 /******************************************************************************
00963  *           HMETAFILE_UserSize [OLE32.@]
00964  *
00965  * Calculates the buffer size required to marshal a metafile.
00966  *
00967  * PARAMS
00968  *  pFlags       [I] Flags. See notes.
00969  *  StartingSize [I] Starting size of the buffer. This value is added on to
00970  *                   the buffer size required for the clip format.
00971  *  phmf         [I] Metafile to size.
00972  *
00973  * RETURNS
00974  *  The buffer size required to marshal a metafile plus the starting size.
00975  *
00976  * NOTES
00977  *  Even though the function is documented to take a pointer to a ULONG in
00978  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
00979  *  the first parameter is a ULONG.
00980  *  This function is only intended to be called by the RPC runtime.
00981  */
00982 ULONG __RPC_USER HMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILE *phmf)
00983 {
00984     ULONG size = StartingSize;
00985 
00986     TRACE("(%s, %d, &%p\n", debugstr_user_flags(pFlags), StartingSize, *phmf);
00987 
00988     ALIGN_LENGTH(size, 3);
00989 
00990     size += sizeof(ULONG);
00991     if (LOWORD(*pFlags) == MSHCTX_INPROC)
00992         size += sizeof(ULONG_PTR);
00993     else
00994     {
00995         size += sizeof(ULONG);
00996 
00997         if (*phmf)
00998         {
00999             UINT mfsize;
01000 
01001             size += 2 * sizeof(ULONG);
01002             mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
01003             size += mfsize;
01004         }
01005     }
01006 
01007     return size;
01008 }
01009 
01010 /******************************************************************************
01011  *           HMETAFILE_UserMarshal [OLE32.@]
01012  *
01013  * Marshals a metafile into a buffer.
01014  *
01015  * PARAMS
01016  *  pFlags  [I] Flags. See notes.
01017  *  pBuffer [I] Buffer to marshal the clip format into.
01018  *  phEmf   [I] Metafile to marshal.
01019  *
01020  * RETURNS
01021  *  The end of the marshaled data in the buffer.
01022  *
01023  * NOTES
01024  *  Even though the function is documented to take a pointer to a ULONG in
01025  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01026  *  the first parameter is a ULONG.
01027  *  This function is only intended to be called by the RPC runtime.
01028  */
01029 unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
01030 {
01031     TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phmf);
01032 
01033     ALIGN_POINTER(pBuffer, 3);
01034 
01035     if (LOWORD(*pFlags) == MSHCTX_INPROC)
01036     {
01037         if (sizeof(*phmf) == 8)
01038             *(ULONG *)pBuffer = WDT_INPROC64_CALL;
01039         else
01040             *(ULONG *)pBuffer = WDT_INPROC_CALL;
01041         pBuffer += sizeof(ULONG);
01042         *(HMETAFILE *)pBuffer = *phmf;
01043         pBuffer += sizeof(HMETAFILE);
01044     }
01045     else
01046     {
01047         *(ULONG *)pBuffer = WDT_REMOTE_CALL;
01048         pBuffer += sizeof(ULONG);
01049         *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phmf;
01050         pBuffer += sizeof(ULONG);
01051 
01052         if (*phmf)
01053         {
01054             UINT mfsize = GetMetaFileBitsEx(*phmf, 0, NULL);
01055 
01056             *(ULONG *)pBuffer = mfsize;
01057             pBuffer += sizeof(ULONG);
01058             *(ULONG *)pBuffer = mfsize;
01059             pBuffer += sizeof(ULONG);
01060             GetMetaFileBitsEx(*phmf, mfsize, pBuffer);
01061             pBuffer += mfsize;
01062         }
01063     }
01064 
01065     return pBuffer;
01066 }
01067 
01068 /******************************************************************************
01069  *           HMETAFILE_UserUnmarshal [OLE32.@]
01070  *
01071  * Unmarshals a metafile from a buffer.
01072  *
01073  * PARAMS
01074  *  pFlags   [I] Flags. See notes.
01075  *  pBuffer  [I] Buffer to marshal the clip format from.
01076  *  phmf     [O] Address that receive the unmarshaled metafile.
01077  *
01078  * RETURNS
01079  *  The end of the marshaled data in the buffer.
01080  *
01081  * NOTES
01082  *  Even though the function is documented to take a pointer to an ULONG in
01083  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01084  *  the first parameter is an ULONG.
01085  *  This function is only intended to be called by the RPC runtime.
01086  */
01087 unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILE *phmf)
01088 {
01089     ULONG fContext;
01090 
01091     TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phmf);
01092 
01093     ALIGN_POINTER(pBuffer, 3);
01094 
01095     fContext = *(ULONG *)pBuffer;
01096     pBuffer += sizeof(ULONG);
01097 
01098     if (((fContext == WDT_INPROC_CALL) && (sizeof(*phmf) < 8)) ||
01099         ((fContext == WDT_INPROC64_CALL) && (sizeof(*phmf) == 8)))
01100     {
01101         *phmf = *(HMETAFILE *)pBuffer;
01102         pBuffer += sizeof(*phmf);
01103     }
01104     else if (fContext == WDT_REMOTE_CALL)
01105     {
01106         ULONG handle;
01107 
01108         handle = *(ULONG *)pBuffer;
01109         pBuffer += sizeof(ULONG);
01110 
01111         if (handle)
01112         {
01113             ULONG size;
01114             size = *(ULONG *)pBuffer;
01115             pBuffer += sizeof(ULONG);
01116             if (size != *(ULONG *)pBuffer)
01117             {
01118                 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
01119                 return pBuffer;
01120             }
01121             pBuffer += sizeof(ULONG);
01122             *phmf = SetMetaFileBitsEx(size, pBuffer);
01123             pBuffer += size;
01124         }
01125         else
01126             *phmf = NULL;
01127     }
01128     else
01129         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
01130 
01131     return pBuffer;
01132 }
01133 
01134 /******************************************************************************
01135  *           HMETAFILE_UserFree [OLE32.@]
01136  *
01137  * Frees an unmarshaled metafile.
01138  *
01139  * PARAMS
01140  *  pFlags   [I] Flags. See notes.
01141  *  phmf     [I] Metafile to free.
01142  *
01143  * RETURNS
01144  *  The end of the marshaled data in the buffer.
01145  *
01146  * NOTES
01147  *  Even though the function is documented to take a pointer to a ULONG in
01148  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
01149  *  which the first parameter is a ULONG.
01150  *  This function is only intended to be called by the RPC runtime.
01151  */
01152 void __RPC_USER HMETAFILE_UserFree(ULONG *pFlags, HMETAFILE *phmf)
01153 {
01154     TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phmf);
01155 
01156     if (LOWORD(*pFlags) != MSHCTX_INPROC)
01157         DeleteMetaFile(*phmf);
01158 }
01159 
01160 /******************************************************************************
01161 *           HENHMETAFILE_UserSize [OLE32.@]
01162 *
01163 * Calculates the buffer size required to marshal an enhanced metafile.
01164 *
01165 * PARAMS
01166 *  pFlags       [I] Flags. See notes.
01167 *  StartingSize [I] Starting size of the buffer. This value is added on to
01168 *                   the buffer size required for the clip format.
01169 *  phEmf        [I] Enhanced metafile to size.
01170 *
01171 * RETURNS
01172 *  The buffer size required to marshal an enhanced metafile plus the starting size.
01173 *
01174 * NOTES
01175 *  Even though the function is documented to take a pointer to a ULONG in
01176 *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01177 *  the first parameter is a ULONG.
01178 *  This function is only intended to be called by the RPC runtime.
01179 */
01180 ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *pFlags, ULONG StartingSize, HENHMETAFILE *phEmf)
01181 {
01182     ULONG size = StartingSize;
01183 
01184     TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, *phEmf);
01185 
01186     size += sizeof(ULONG);
01187     if (LOWORD(*pFlags) == MSHCTX_INPROC)
01188         size += sizeof(ULONG_PTR);
01189     else
01190     {
01191         size += sizeof(ULONG);
01192 
01193         if (*phEmf)
01194         {
01195             UINT emfsize;
01196     
01197             size += 2 * sizeof(ULONG);
01198             emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
01199             size += emfsize;
01200         }
01201     }
01202 
01203     return size;
01204 }
01205 
01206 /******************************************************************************
01207  *           HENHMETAFILE_UserMarshal [OLE32.@]
01208  *
01209  * Marshals an enhance metafile into a buffer.
01210  *
01211  * PARAMS
01212  *  pFlags  [I] Flags. See notes.
01213  *  pBuffer [I] Buffer to marshal the clip format into.
01214  *  phEmf   [I] Enhanced metafile to marshal.
01215  *
01216  * RETURNS
01217  *  The end of the marshaled data in the buffer.
01218  *
01219  * NOTES
01220  *  Even though the function is documented to take a pointer to a ULONG in
01221  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01222  *  the first parameter is a ULONG.
01223  *  This function is only intended to be called by the RPC runtime.
01224  */
01225 unsigned char * __RPC_USER HENHMETAFILE_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
01226 {
01227     TRACE("(%s, %p, &%p\n", debugstr_user_flags(pFlags), pBuffer, *phEmf);
01228 
01229     if (LOWORD(*pFlags) == MSHCTX_INPROC)
01230     {
01231         if (sizeof(*phEmf) == 8)
01232             *(ULONG *)pBuffer = WDT_INPROC64_CALL;
01233         else
01234             *(ULONG *)pBuffer = WDT_INPROC_CALL;
01235         pBuffer += sizeof(ULONG);
01236         *(HENHMETAFILE *)pBuffer = *phEmf;
01237         pBuffer += sizeof(HENHMETAFILE);
01238     }
01239     else
01240     {
01241         *(ULONG *)pBuffer = WDT_REMOTE_CALL;
01242         pBuffer += sizeof(ULONG);
01243         *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phEmf;
01244         pBuffer += sizeof(ULONG);
01245     
01246         if (*phEmf)
01247         {
01248             UINT emfsize = GetEnhMetaFileBits(*phEmf, 0, NULL);
01249     
01250             *(ULONG *)pBuffer = emfsize;
01251             pBuffer += sizeof(ULONG);
01252             *(ULONG *)pBuffer = emfsize;
01253             pBuffer += sizeof(ULONG);
01254             GetEnhMetaFileBits(*phEmf, emfsize, pBuffer);
01255             pBuffer += emfsize;
01256         }
01257     }
01258 
01259     return pBuffer;
01260 }
01261 
01262 /******************************************************************************
01263  *           HENHMETAFILE_UserUnmarshal [OLE32.@]
01264  *
01265  * Unmarshals an enhanced metafile from a buffer.
01266  *
01267  * PARAMS
01268  *  pFlags   [I] Flags. See notes.
01269  *  pBuffer  [I] Buffer to marshal the clip format from.
01270  *  phEmf    [O] Address that receive the unmarshaled enhanced metafile.
01271  *
01272  * RETURNS
01273  *  The end of the marshaled data in the buffer.
01274  *
01275  * NOTES
01276  *  Even though the function is documented to take a pointer to an ULONG in
01277  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01278  *  the first parameter is an ULONG.
01279  *  This function is only intended to be called by the RPC runtime.
01280  */
01281 unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf)
01282 {
01283     ULONG fContext;
01284 
01285     TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, phEmf);
01286 
01287     fContext = *(ULONG *)pBuffer;
01288     pBuffer += sizeof(ULONG);
01289 
01290     if (((fContext == WDT_INPROC_CALL) && (sizeof(*phEmf) < 8)) ||
01291         ((fContext == WDT_INPROC64_CALL) && (sizeof(*phEmf) == 8)))
01292     {
01293         *phEmf = *(HENHMETAFILE *)pBuffer;
01294         pBuffer += sizeof(*phEmf);
01295     }
01296     else if (fContext == WDT_REMOTE_CALL)
01297     {
01298         ULONG handle;
01299 
01300         handle = *(ULONG *)pBuffer;
01301         pBuffer += sizeof(ULONG);
01302 
01303         if (handle)
01304         {
01305             ULONG size;
01306             size = *(ULONG *)pBuffer;
01307             pBuffer += sizeof(ULONG);
01308             if (size != *(ULONG *)pBuffer)
01309             {
01310                 RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
01311                 return pBuffer;
01312             }
01313             pBuffer += sizeof(ULONG);
01314             *phEmf = SetEnhMetaFileBits(size, pBuffer);
01315             pBuffer += size;
01316         }
01317         else 
01318             *phEmf = NULL;
01319     }
01320     else
01321         RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL);
01322 
01323     return pBuffer;
01324 }
01325 
01326 /******************************************************************************
01327  *           HENHMETAFILE_UserFree [OLE32.@]
01328  *
01329  * Frees an unmarshaled enhanced metafile.
01330  *
01331  * PARAMS
01332  *  pFlags   [I] Flags. See notes.
01333  *  phEmf    [I] Enhanced metafile to free.
01334  *
01335  * RETURNS
01336  *  The end of the marshaled data in the buffer.
01337  *
01338  * NOTES
01339  *  Even though the function is documented to take a pointer to a ULONG in
01340  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
01341  *  which the first parameter is a ULONG.
01342  *  This function is only intended to be called by the RPC runtime.
01343  */
01344 void __RPC_USER HENHMETAFILE_UserFree(ULONG *pFlags, HENHMETAFILE *phEmf)
01345 {
01346     TRACE("(%s, &%p\n", debugstr_user_flags(pFlags), *phEmf);
01347 
01348     if (LOWORD(*pFlags) != MSHCTX_INPROC)
01349         DeleteEnhMetaFile(*phEmf);
01350 }
01351 
01352 /******************************************************************************
01353  *           HMETAFILEPICT_UserSize [OLE32.@]
01354  *
01355  * Calculates the buffer size required to marshal an metafile pict.
01356  *
01357  * PARAMS
01358  *  pFlags       [I] Flags. See notes.
01359  *  StartingSize [I] Starting size of the buffer. This value is added on to
01360  *                   the buffer size required for the clip format.
01361  *  phMfp        [I] Metafile pict to size.
01362  *
01363  * RETURNS
01364  *  The buffer size required to marshal a metafile pict plus the starting size.
01365  *
01366  * NOTES
01367  *  Even though the function is documented to take a pointer to a ULONG in
01368  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01369  *  the first parameter is a ULONG.
01370  *  This function is only intended to be called by the RPC runtime.
01371  */
01372 ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *pFlags, ULONG StartingSize, HMETAFILEPICT *phMfp)
01373 {
01374     ULONG size = StartingSize;
01375 
01376     TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), StartingSize, *phMfp);
01377 
01378     size += sizeof(ULONG);
01379 
01380     if(LOWORD(*pFlags) == MSHCTX_INPROC)
01381         size += sizeof(HMETAFILEPICT);
01382     else
01383     {
01384         size += sizeof(ULONG);
01385 
01386         if (*phMfp)
01387         {
01388             METAFILEPICT *mfpict = GlobalLock(*phMfp);
01389 
01390             /* FIXME: raise an exception if mfpict is NULL? */
01391             size += 3 * sizeof(ULONG);
01392             size += sizeof(ULONG);
01393 
01394             size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
01395 
01396             GlobalUnlock(*phMfp);
01397         }
01398     }
01399 
01400     return size;
01401 }
01402 
01403 /******************************************************************************
01404  *           HMETAFILEPICT_UserMarshal [OLE32.@]
01405  *
01406  * Marshals a metafile pict into a buffer.
01407  *
01408  * PARAMS
01409  *  pFlags  [I] Flags. See notes.
01410  *  pBuffer [I] Buffer to marshal the clip format into.
01411  *  phMfp   [I] Metafile pict to marshal.
01412  *
01413  * RETURNS
01414  *  The end of the marshaled data in the buffer.
01415  *
01416  * NOTES
01417  *  Even though the function is documented to take a pointer to a ULONG in
01418  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01419  *  the first parameter is a ULONG.
01420  *  This function is only intended to be called by the RPC runtime.
01421  */
01422 unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
01423 {
01424     TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp);
01425 
01426     if (LOWORD(*pFlags) == MSHCTX_INPROC)
01427     {
01428         if (sizeof(HMETAFILEPICT) == 8)
01429             *(ULONG *)pBuffer = WDT_INPROC64_CALL;
01430         else
01431             *(ULONG *)pBuffer = WDT_INPROC_CALL;
01432         pBuffer += sizeof(ULONG);
01433         *(HMETAFILEPICT *)pBuffer = *phMfp;
01434         pBuffer += sizeof(HMETAFILEPICT);
01435     }
01436     else
01437     {
01438         *(ULONG *)pBuffer = WDT_REMOTE_CALL;
01439         pBuffer += sizeof(ULONG);
01440         *(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phMfp;
01441         pBuffer += sizeof(ULONG);
01442 
01443         if (*phMfp)
01444         {
01445             METAFILEPICT *mfpict = GlobalLock(*phMfp);
01446             remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
01447 
01448             /* FIXME: raise an exception if mfpict is NULL? */
01449             remmfpict->mm = mfpict->mm;
01450             remmfpict->xExt = mfpict->xExt;
01451             remmfpict->yExt = mfpict->yExt;
01452             pBuffer += 3 * sizeof(ULONG);
01453             *(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
01454             pBuffer += sizeof(ULONG);
01455 
01456             pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
01457 
01458             GlobalUnlock(*phMfp);
01459         }
01460     }
01461     return pBuffer;
01462 }
01463 
01464 /******************************************************************************
01465  *           HMETAFILEPICT_UserUnmarshal [OLE32.@]
01466  *
01467  * Unmarshals an metafile pict from a buffer.
01468  *
01469  * PARAMS
01470  *  pFlags   [I] Flags. See notes.
01471  *  pBuffer  [I] Buffer to marshal the clip format from.
01472  *  phMfp    [O] Address that receive the unmarshaled metafile pict.
01473  *
01474  * RETURNS
01475  *  The end of the marshaled data in the buffer.
01476  *
01477  * NOTES
01478  *  Even though the function is documented to take a pointer to an ULONG in
01479  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01480  *  the first parameter is an ULONG.
01481  *  This function is only intended to be called by the RPC runtime.
01482  */
01483 unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HMETAFILEPICT *phMfp)
01484 {
01485     ULONG fContext;
01486 
01487     TRACE("(%s, %p, %p)\n", debugstr_user_flags(pFlags), pBuffer, phMfp);
01488 
01489     fContext = *(ULONG *)pBuffer;
01490     pBuffer += sizeof(ULONG);
01491 
01492     if ((fContext == WDT_INPROC_CALL) || fContext == WDT_INPROC64_CALL)
01493     {
01494         *phMfp = *(HMETAFILEPICT *)pBuffer;
01495         pBuffer += sizeof(HMETAFILEPICT);
01496     }
01497     else
01498     {
01499         ULONG handle = *(ULONG *)pBuffer;
01500         pBuffer += sizeof(ULONG);
01501         *phMfp = NULL;
01502 
01503         if(handle)
01504         {
01505             METAFILEPICT *mfpict;
01506             const remoteMETAFILEPICT *remmfpict;
01507             ULONG user_marshal_prefix;
01508 
01509             remmfpict = (const remoteMETAFILEPICT *)pBuffer;
01510 
01511             *phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
01512             if (!*phMfp)
01513                 RpcRaiseException(E_OUTOFMEMORY);
01514 
01515             mfpict = GlobalLock(*phMfp);
01516             mfpict->mm = remmfpict->mm;
01517             mfpict->xExt = remmfpict->xExt;
01518             mfpict->yExt = remmfpict->yExt;
01519             pBuffer += 3 * sizeof(ULONG);
01520             user_marshal_prefix = *(ULONG *)pBuffer;
01521             pBuffer += sizeof(ULONG);
01522 
01523             if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
01524                 RpcRaiseException(RPC_X_INVALID_TAG);
01525 
01526             pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
01527 
01528             GlobalUnlock(*phMfp);
01529         }
01530     }
01531     return pBuffer;
01532 }
01533 
01534 /******************************************************************************
01535  *           HMETAFILEPICT_UserFree [OLE32.@]
01536  *
01537  * Frees an unmarshaled metafile pict.
01538  *
01539  * PARAMS
01540  *  pFlags   [I] Flags. See notes.
01541  *  phMfp    [I] Metafile pict to free.
01542  *
01543  * RETURNS
01544  *  The end of the marshaled data in the buffer.
01545  *
01546  * NOTES
01547  *  Even though the function is documented to take a pointer to a ULONG in
01548  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
01549  *  which the first parameter is a ULONG.
01550  *  This function is only intended to be called by the RPC runtime.
01551  */
01552 void __RPC_USER HMETAFILEPICT_UserFree(ULONG *pFlags, HMETAFILEPICT *phMfp)
01553 {
01554     TRACE("(%s, &%p)\n", debugstr_user_flags(pFlags), *phMfp);
01555 
01556     if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
01557     {
01558         METAFILEPICT *mfpict;
01559 
01560         mfpict = GlobalLock(*phMfp);
01561         /* FIXME: raise an exception if mfpict is NULL? */
01562         HMETAFILE_UserFree(pFlags, &mfpict->hMF);
01563         GlobalUnlock(*phMfp);
01564 
01565         GlobalFree(*phMfp);
01566     }
01567 }
01568 
01569 /******************************************************************************
01570  *           WdtpInterfacePointer_UserSize [OLE32.@]
01571  *
01572  * Calculates the buffer size required to marshal an interface pointer.
01573  *
01574  * PARAMS
01575  *  pFlags       [I] Flags. See notes.
01576  *  RealFlags    [I] The MSHCTX to use when marshaling the interface.
01577  *  punk         [I] Interface pointer to size.
01578  *  StartingSize [I] Starting size of the buffer. This value is added on to
01579  *                   the buffer size required for the clip format.
01580  *  riid         [I] ID of interface to size.
01581  *
01582  * RETURNS
01583  *  The buffer size required to marshal an interface pointer plus the starting size.
01584  *
01585  * NOTES
01586  *  Even though the function is documented to take a pointer to a ULONG in
01587  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01588  *  the first parameter is a ULONG.
01589  */
01590 ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, ULONG StartingSize, IUnknown *punk, REFIID riid)
01591 {
01592     DWORD marshal_size = 0;
01593     HRESULT hr;
01594 
01595     TRACE("(%s, 0%x, %d, %p, %s)\n", debugstr_user_flags(pFlags), RealFlags, StartingSize, punk, debugstr_guid(riid));
01596 
01597     hr = CoGetMarshalSizeMax(&marshal_size, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL);
01598     if(FAILED(hr)) return StartingSize;
01599 
01600     ALIGN_LENGTH(StartingSize, 3);
01601     StartingSize += 2 * sizeof(DWORD);
01602     return StartingSize + marshal_size;
01603 }
01604 
01605 /******************************************************************************
01606  *           WdtpInterfacePointer_UserMarshal [OLE32.@]
01607  *
01608  * Marshals an interface pointer into a buffer.
01609  *
01610  * PARAMS
01611  *  pFlags    [I] Flags. See notes.
01612  *  RealFlags [I] The MSHCTX to use when marshaling the interface.
01613  *  pBuffer   [I] Buffer to marshal the clip format into.
01614  *  punk      [I] Interface pointer to marshal.
01615  *  riid      [I] ID of interface to marshal.
01616  *
01617  * RETURNS
01618  *  The end of the marshaled data in the buffer.
01619  *
01620  * NOTES
01621  *  Even though the function is documented to take a pointer to a ULONG in
01622  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01623  *  the first parameter is a ULONG.
01624  */
01625 unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer, IUnknown *punk, REFIID riid)
01626 {
01627     HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, 0);
01628     IStream *stm;
01629     DWORD size;
01630     void *ptr;
01631 
01632     TRACE("(%s, 0x%x, %p, &%p, %s)\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid));
01633 
01634     if(!h) return NULL;
01635     if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK)
01636     {
01637         GlobalFree(h);
01638         return NULL;
01639     }
01640 
01641     if(CoMarshalInterface(stm, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL) != S_OK)
01642     {
01643         IStream_Release(stm);
01644         return NULL;
01645     }
01646 
01647     ALIGN_POINTER(pBuffer, 3);
01648     size = GlobalSize(h);
01649 
01650     *(DWORD *)pBuffer = size;
01651     pBuffer += sizeof(DWORD);
01652     *(DWORD *)pBuffer = size;
01653     pBuffer += sizeof(DWORD);
01654 
01655     ptr = GlobalLock(h);
01656     memcpy(pBuffer, ptr, size);
01657     GlobalUnlock(h);
01658 
01659     IStream_Release(stm);
01660     return pBuffer + size;
01661 }
01662 
01663 /******************************************************************************
01664  *           WdtpInterfacePointer_UserUnmarshal [OLE32.@]
01665  *
01666  * Unmarshals an interface pointer from a buffer.
01667  *
01668  * PARAMS
01669  *  pFlags   [I] Flags. See notes.
01670  *  pBuffer  [I] Buffer to marshal the clip format from.
01671  *  ppunk    [I/O] Address that receives the unmarshaled interface pointer.
01672  *  riid     [I] ID of interface to unmarshal.
01673  *
01674  * RETURNS
01675  *  The end of the marshaled data in the buffer.
01676  *
01677  * NOTES
01678  *  Even though the function is documented to take a pointer to an ULONG in
01679  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01680  *  the first parameter is an ULONG.
01681  */
01682 unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid)
01683 {
01684     HRESULT hr;
01685     HGLOBAL h;
01686     IStream *stm;
01687     DWORD size;
01688     void *ptr;
01689 
01690     TRACE("(%s, %p, %p, %s)\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid));
01691 
01692     ALIGN_POINTER(pBuffer, 3);
01693 
01694     size = *(DWORD *)pBuffer;
01695     pBuffer += sizeof(DWORD);
01696     if(size != *(DWORD *)pBuffer)
01697         RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
01698 
01699     pBuffer += sizeof(DWORD);
01700 
01701     /* FIXME: sanity check on size */
01702 
01703     h = GlobalAlloc(GMEM_MOVEABLE, size);
01704     if(!h) RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL);
01705 
01706     if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK)
01707     {
01708         GlobalFree(h);
01709         RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL);
01710     }
01711 
01712     ptr = GlobalLock(h);
01713     memcpy(ptr, pBuffer, size);
01714     GlobalUnlock(h);
01715 
01716     hr = CoUnmarshalInterface(stm, riid, (void**)ppunk);
01717     IStream_Release(stm);
01718 
01719     if(hr != S_OK) RaiseException(hr, 0, 0, NULL);
01720 
01721     return pBuffer + size;
01722 }
01723 
01724 /******************************************************************************
01725  *           WdtpInterfacePointer_UserFree [OLE32.@]
01726  *
01727  * Releases an unmarshaled interface pointer.
01728  *
01729  * PARAMS
01730  *  punk    [I] Interface pointer to release.
01731  *
01732  * RETURNS
01733  *  Nothing.
01734  */
01735 void WINAPI WdtpInterfacePointer_UserFree(IUnknown *punk)
01736 {
01737     TRACE("(%p)\n", punk);
01738     if(punk) IUnknown_Release(punk);
01739 }
01740 
01741 /******************************************************************************
01742 *           STGMEDIUM_UserSize [OLE32.@]
01743 *
01744 * Calculates the buffer size required to marshal an STGMEDIUM.
01745 *
01746 * PARAMS
01747 *  pFlags       [I] Flags. See notes.
01748 *  StartingSize [I] Starting size of the buffer. This value is added on to
01749 *                   the buffer size required for the clip format.
01750 *  pStgMedium   [I] STGMEDIUM to size.
01751 *
01752 * RETURNS
01753 *  The buffer size required to marshal an STGMEDIUM plus the starting size.
01754 *
01755 * NOTES
01756 *  Even though the function is documented to take a pointer to a ULONG in
01757 *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01758 *  the first parameter is a ULONG.
01759 *  This function is only intended to be called by the RPC runtime.
01760 */
01761 ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM *pStgMedium)
01762 {
01763     ULONG size = StartingSize;
01764 
01765     TRACE("(%s, %d, %p\n", debugstr_user_flags(pFlags), StartingSize, pStgMedium);
01766 
01767     ALIGN_LENGTH(size, 3);
01768 
01769     size += 2 * sizeof(DWORD);
01770     if (pStgMedium->tymed != TYMED_NULL)
01771         size += sizeof(DWORD);
01772 
01773     switch (pStgMedium->tymed)
01774     {
01775     case TYMED_NULL:
01776         TRACE("TYMED_NULL\n");
01777         break;
01778     case TYMED_HGLOBAL:
01779         TRACE("TYMED_HGLOBAL\n");
01780         if (pStgMedium->u.hGlobal)
01781             size = HGLOBAL_UserSize(pFlags, size, &pStgMedium->u.hGlobal);
01782         break;
01783     case TYMED_FILE:
01784         TRACE("TYMED_FILE\n");
01785         if (pStgMedium->u.lpszFileName)
01786         {
01787             TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
01788             size += 3 * sizeof(DWORD) +
01789                 (strlenW(pStgMedium->u.lpszFileName) + 1) * sizeof(WCHAR);
01790         }
01791         break;
01792     case TYMED_ISTREAM:
01793         TRACE("TYMED_ISTREAM\n");
01794         if (pStgMedium->u.pstm)
01795         {
01796             IUnknown *unk;
01797             IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
01798             size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStream);
01799             IUnknown_Release(unk);
01800         }
01801         break;
01802     case TYMED_ISTORAGE:
01803         TRACE("TYMED_ISTORAGE\n");
01804         if (pStgMedium->u.pstg)
01805         {
01806             IUnknown *unk;
01807             IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
01808             size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStorage);
01809             IUnknown_Release(unk);
01810         }
01811         break;
01812     case TYMED_GDI:
01813         TRACE("TYMED_GDI\n");
01814         if (pStgMedium->u.hBitmap)
01815         {
01816             FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
01817         }
01818         break;
01819     case TYMED_MFPICT:
01820         TRACE("TYMED_MFPICT\n");
01821         if (pStgMedium->u.hMetaFilePict)
01822             size = HMETAFILEPICT_UserSize(pFlags, size, &pStgMedium->u.hMetaFilePict);
01823         break;
01824     case TYMED_ENHMF:
01825         TRACE("TYMED_ENHMF\n");
01826         if (pStgMedium->u.hEnhMetaFile)
01827             size = HENHMETAFILE_UserSize(pFlags, size, &pStgMedium->u.hEnhMetaFile);
01828         break;
01829     default:
01830         RaiseException(DV_E_TYMED, 0, 0, NULL);
01831     }
01832 
01833     if (pStgMedium->pUnkForRelease)
01834         size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, pStgMedium->pUnkForRelease, &IID_IUnknown);
01835 
01836     return size;
01837 }
01838 
01839 /******************************************************************************
01840  *           STGMEDIUM_UserMarshal [OLE32.@]
01841  *
01842  * Marshals a STGMEDIUM into a buffer.
01843  *
01844  * PARAMS
01845  *  pFlags  [I] Flags. See notes.
01846  *  pBuffer [I] Buffer to marshal the clip format into.
01847  *  pCF     [I] STGMEDIUM to marshal.
01848  *
01849  * RETURNS
01850  *  The end of the marshaled data in the buffer.
01851  *
01852  * NOTES
01853  *  Even though the function is documented to take a pointer to a ULONG in
01854  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01855  *  the first parameter is a ULONG.
01856  *  This function is only intended to be called by the RPC runtime.
01857  */
01858 unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
01859 {
01860     TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
01861 
01862     ALIGN_POINTER(pBuffer, 3);
01863 
01864     *(DWORD *)pBuffer = pStgMedium->tymed;
01865     pBuffer += sizeof(DWORD);
01866     if (pStgMedium->tymed != TYMED_NULL)
01867     {
01868         *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->u.pstg;
01869         pBuffer += sizeof(DWORD);
01870     }
01871     *(DWORD *)pBuffer = (DWORD)(DWORD_PTR)pStgMedium->pUnkForRelease;
01872     pBuffer += sizeof(DWORD);
01873 
01874     switch (pStgMedium->tymed)
01875     {
01876     case TYMED_NULL:
01877         TRACE("TYMED_NULL\n");
01878         break;
01879     case TYMED_HGLOBAL:
01880         TRACE("TYMED_HGLOBAL\n");
01881         if (pStgMedium->u.hGlobal)
01882             pBuffer = HGLOBAL_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
01883         break;
01884     case TYMED_FILE:
01885         TRACE("TYMED_FILE\n");
01886         if (pStgMedium->u.lpszFileName)
01887         {
01888             DWORD len;
01889             len = strlenW(pStgMedium->u.lpszFileName);
01890             /* conformance */
01891             *(DWORD *)pBuffer = len + 1;
01892             pBuffer += sizeof(DWORD);
01893             /* offset */
01894             *(DWORD *)pBuffer = 0;
01895             pBuffer += sizeof(DWORD);
01896             /* variance */
01897             *(DWORD *)pBuffer = len + 1;
01898             pBuffer += sizeof(DWORD);
01899 
01900             TRACE("file name is %s\n", debugstr_w(pStgMedium->u.lpszFileName));
01901             memcpy(pBuffer, pStgMedium->u.lpszFileName, (len + 1) * sizeof(WCHAR));
01902         }
01903         break;
01904     case TYMED_ISTREAM:
01905         TRACE("TYMED_ISTREAM\n");
01906         if (pStgMedium->u.pstm)
01907         {
01908             IUnknown *unk;
01909             IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
01910             pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStream);
01911             IUnknown_Release(unk);
01912         }
01913         break;
01914     case TYMED_ISTORAGE:
01915         TRACE("TYMED_ISTORAGE\n");
01916         if (pStgMedium->u.pstg)
01917         {
01918             IUnknown *unk;
01919             IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
01920             pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStorage);
01921             IUnknown_Release(unk);
01922         }
01923         break;
01924     case TYMED_GDI:
01925         TRACE("TYMED_GDI\n");
01926         if (pStgMedium->u.hBitmap)
01927         {
01928             FIXME("not implemented for GDI object %p\n", pStgMedium->u.hBitmap);
01929         }
01930         break;
01931     case TYMED_MFPICT:
01932         TRACE("TYMED_MFPICT\n");
01933         if (pStgMedium->u.hMetaFilePict)
01934             pBuffer = HMETAFILEPICT_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
01935         break;
01936     case TYMED_ENHMF:
01937         TRACE("TYMED_ENHMF\n");
01938         if (pStgMedium->u.hEnhMetaFile)
01939             pBuffer = HENHMETAFILE_UserMarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
01940         break;
01941     default:
01942         RaiseException(DV_E_TYMED, 0, 0, NULL);
01943     }
01944 
01945     if (pStgMedium->pUnkForRelease)
01946         pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, pStgMedium->pUnkForRelease, &IID_IUnknown);
01947 
01948     return pBuffer;
01949 }
01950 
01951 /******************************************************************************
01952  *           STGMEDIUM_UserUnmarshal [OLE32.@]
01953  *
01954  * Unmarshals a STGMEDIUM from a buffer.
01955  *
01956  * PARAMS
01957  *  pFlags     [I] Flags. See notes.
01958  *  pBuffer    [I] Buffer to marshal the clip format from.
01959  *  pStgMedium [O] Address that receive the unmarshaled STGMEDIUM.
01960  *
01961  * RETURNS
01962  *  The end of the marshaled data in the buffer.
01963  *
01964  * NOTES
01965  *  Even though the function is documented to take a pointer to an ULONG in
01966  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
01967  *  the first parameter is an ULONG.
01968  *  This function is only intended to be called by the RPC runtime.
01969  */
01970 unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium)
01971 {
01972     DWORD content = 0;
01973     DWORD releaseunk;
01974 
01975     ALIGN_POINTER(pBuffer, 3);
01976 
01977     TRACE("(%s, %p, %p\n", debugstr_user_flags(pFlags), pBuffer, pStgMedium);
01978 
01979     pStgMedium->tymed = *(DWORD *)pBuffer;
01980     pBuffer += sizeof(DWORD);
01981     if (pStgMedium->tymed != TYMED_NULL)
01982     {
01983         content = *(DWORD *)pBuffer;
01984         pBuffer += sizeof(DWORD);
01985     }
01986     releaseunk = *(DWORD *)pBuffer;
01987     pBuffer += sizeof(DWORD);
01988 
01989     switch (pStgMedium->tymed)
01990     {
01991     case TYMED_NULL:
01992         TRACE("TYMED_NULL\n");
01993         break;
01994     case TYMED_HGLOBAL:
01995         TRACE("TYMED_HGLOBAL\n");
01996         if (content)
01997             pBuffer = HGLOBAL_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal);
01998         break;
01999     case TYMED_FILE:
02000         TRACE("TYMED_FILE\n");
02001         if (content)
02002         {
02003             DWORD conformance;
02004             DWORD variance;
02005             conformance = *(DWORD *)pBuffer;
02006             pBuffer += sizeof(DWORD);
02007             if (*(DWORD *)pBuffer != 0)
02008             {
02009                 ERR("invalid offset %d\n", *(DWORD *)pBuffer);
02010                 RpcRaiseException(RPC_S_INVALID_BOUND);
02011                 return NULL;
02012             }
02013             pBuffer += sizeof(DWORD);
02014             variance = *(DWORD *)pBuffer;
02015             pBuffer += sizeof(DWORD);
02016             if (conformance != variance)
02017             {
02018                 ERR("conformance (%d) and variance (%d) should be equal\n",
02019                     conformance, variance);
02020                 RpcRaiseException(RPC_S_INVALID_BOUND);
02021                 return NULL;
02022             }
02023             if (conformance > 0x7fffffff)
02024             {
02025                 ERR("conformance 0x%x too large\n", conformance);
02026                 RpcRaiseException(RPC_S_INVALID_BOUND);
02027                 return NULL;
02028             }
02029             pStgMedium->u.lpszFileName = CoTaskMemAlloc(conformance * sizeof(WCHAR));
02030             if (!pStgMedium->u.lpszFileName) RpcRaiseException(ERROR_OUTOFMEMORY);
02031             TRACE("unmarshalled file name is %s\n", debugstr_wn((const WCHAR *)pBuffer, variance));
02032             memcpy(pStgMedium->u.lpszFileName, pBuffer, variance * sizeof(WCHAR));
02033             pBuffer += variance * sizeof(WCHAR);
02034         }
02035         else
02036             pStgMedium->u.lpszFileName = NULL;
02037         break;
02038     case TYMED_ISTREAM:
02039         TRACE("TYMED_ISTREAM\n");
02040         if (content)
02041         {
02042             pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstm, &IID_IStream);
02043         }
02044         else
02045             pStgMedium->u.pstm = NULL;
02046         break;
02047     case TYMED_ISTORAGE:
02048         TRACE("TYMED_ISTORAGE\n");
02049         if (content)
02050         {
02051             pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstg, &IID_IStorage);
02052         }
02053         else
02054             pStgMedium->u.pstg = NULL;
02055         break;
02056     case TYMED_GDI:
02057         TRACE("TYMED_GDI\n");
02058         if (content)
02059         {
02060             FIXME("not implemented for GDI object\n");
02061         }
02062         else
02063             pStgMedium->u.hBitmap = NULL;
02064         break;
02065     case TYMED_MFPICT:
02066         TRACE("TYMED_MFPICT\n");
02067         if (content)
02068             pBuffer = HMETAFILEPICT_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hMetaFilePict);
02069         else
02070             pStgMedium->u.hMetaFilePict = NULL;
02071         break;
02072     case TYMED_ENHMF:
02073         TRACE("TYMED_ENHMF\n");
02074         if (content)
02075             pBuffer = HENHMETAFILE_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile);
02076         else
02077             pStgMedium->u.hEnhMetaFile = NULL;
02078         break;
02079     default:
02080         RaiseException(DV_E_TYMED, 0, 0, NULL);
02081     }
02082 
02083     pStgMedium->pUnkForRelease = NULL;
02084     if (releaseunk)
02085         pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, &pStgMedium->pUnkForRelease, &IID_IUnknown);
02086 
02087     return pBuffer;
02088 }
02089 
02090 /******************************************************************************
02091  *           STGMEDIUM_UserFree [OLE32.@]
02092  *
02093  * Frees an unmarshaled STGMEDIUM.
02094  *
02095  * PARAMS
02096  *  pFlags     [I] Flags. See notes.
02097  *  pStgmedium [I] STGMEDIUM to free.
02098  *
02099  * RETURNS
02100  *  The end of the marshaled data in the buffer.
02101  *
02102  * NOTES
02103  *  Even though the function is documented to take a pointer to a ULONG in
02104  *  pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of
02105  *  which the first parameter is a ULONG.
02106  *  This function is only intended to be called by the RPC runtime.
02107  */
02108 void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
02109 {
02110     TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium);
02111 
02112     ReleaseStgMedium(pStgMedium);
02113 }
02114 
02115 ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
02116 {
02117     TRACE("\n");
02118     return STGMEDIUM_UserSize(pFlags, StartingSize, pStgMedium);
02119 }
02120 
02121 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserMarshal(  ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
02122 {
02123     TRACE("\n");
02124     return STGMEDIUM_UserMarshal(pFlags, pBuffer, pStgMedium);
02125 }
02126 
02127 unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
02128 {
02129     TRACE("\n");
02130     return STGMEDIUM_UserUnmarshal(pFlags, pBuffer, pStgMedium);
02131 }
02132 
02133 void __RPC_USER ASYNC_STGMEDIUM_UserFree(ULONG *pFlags, ASYNC_STGMEDIUM *pStgMedium)
02134 {
02135     TRACE("\n");
02136     STGMEDIUM_UserFree(pFlags, pStgMedium);
02137 }
02138 
02139 ULONG __RPC_USER FLAG_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, FLAG_STGMEDIUM *pStgMedium)
02140 {
02141     FIXME(":stub\n");
02142     return StartingSize;
02143 }
02144 
02145 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserMarshal(  ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
02146 {
02147     FIXME(":stub\n");
02148     return pBuffer;
02149 }
02150 
02151 unsigned char * __RPC_USER FLAG_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, FLAG_STGMEDIUM *pStgMedium)
02152 {
02153     FIXME(":stub\n");
02154     return pBuffer;
02155 }
02156 
02157 void __RPC_USER FLAG_STGMEDIUM_UserFree(ULONG *pFlags, FLAG_STGMEDIUM *pStgMedium)
02158 {
02159     FIXME(":stub\n");
02160 }
02161 
02162 ULONG __RPC_USER SNB_UserSize(ULONG *pFlags, ULONG StartingSize, SNB *pSnb)
02163 {
02164     FIXME(":stub\n");
02165     return StartingSize;
02166 }
02167 
02168 unsigned char * __RPC_USER SNB_UserMarshal(  ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
02169 {
02170     FIXME(":stub\n");
02171     return pBuffer;
02172 }
02173 
02174 unsigned char * __RPC_USER SNB_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, SNB *pSnb)
02175 {
02176     FIXME(":stub\n");
02177     return pBuffer;
02178 }
02179 
02180 void __RPC_USER SNB_UserFree(ULONG *pFlags, SNB *pSnb)
02181 {
02182     FIXME(":stub\n");
02183 }
02184 
02185 /* call_as/local stubs for unknwn.idl */
02186 
02187 HRESULT CALLBACK IClassFactory_CreateInstance_Proxy(
02188     IClassFactory* This,
02189     IUnknown *pUnkOuter,
02190     REFIID riid,
02191     void **ppvObject)
02192 {
02193     TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
02194     *ppvObject = NULL;
02195     if (pUnkOuter)
02196     {
02197         ERR("aggregation is not allowed on remote objects\n");
02198         return CLASS_E_NOAGGREGATION;
02199     }
02200     return IClassFactory_RemoteCreateInstance_Proxy(This, riid,
02201                                                     (IUnknown **) ppvObject);
02202 }
02203 
02204 HRESULT __RPC_STUB IClassFactory_CreateInstance_Stub(
02205     IClassFactory* This,
02206     REFIID riid,
02207     IUnknown **ppvObject)
02208 {
02209     TRACE("(%s, %p)\n", debugstr_guid(riid), ppvObject);
02210     return IClassFactory_CreateInstance(This, NULL, riid, (void **) ppvObject);
02211 }
02212 
02213 HRESULT CALLBACK IClassFactory_LockServer_Proxy(
02214     IClassFactory* This,
02215     BOOL fLock)
02216 {
02217     FIXME(":stub\n");
02218     return E_NOTIMPL;
02219 }
02220 
02221 HRESULT __RPC_STUB IClassFactory_LockServer_Stub(
02222     IClassFactory* This,
02223     BOOL fLock)
02224 {
02225     FIXME(":stub\n");
02226     return E_NOTIMPL;
02227 }
02228 
02229 /* call_as/local stubs for objidl.idl */
02230 
02231 HRESULT CALLBACK IEnumUnknown_Next_Proxy(
02232     IEnumUnknown* This,
02233     ULONG celt,
02234     IUnknown **rgelt,
02235     ULONG *pceltFetched)
02236 {
02237     ULONG fetched;
02238     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02239     if (!pceltFetched) pceltFetched = &fetched;
02240     return IEnumUnknown_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02241 }
02242 
02243 HRESULT __RPC_STUB IEnumUnknown_Next_Stub(
02244     IEnumUnknown* This,
02245     ULONG celt,
02246     IUnknown **rgelt,
02247     ULONG *pceltFetched)
02248 {
02249     HRESULT hr;
02250     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02251     *pceltFetched = 0;
02252     hr = IEnumUnknown_Next(This, celt, rgelt, pceltFetched);
02253     if (hr == S_OK) *pceltFetched = celt;
02254     return hr;
02255 }
02256 
02257 HRESULT CALLBACK IBindCtx_SetBindOptions_Proxy(
02258     IBindCtx* This,
02259     BIND_OPTS *pbindopts)
02260 {
02261     FIXME(":stub\n");
02262     return E_NOTIMPL;
02263 }
02264 
02265 HRESULT __RPC_STUB IBindCtx_SetBindOptions_Stub(
02266     IBindCtx* This,
02267     BIND_OPTS2 *pbindopts)
02268 {
02269     FIXME(":stub\n");
02270     return E_NOTIMPL;
02271 }
02272 
02273 HRESULT CALLBACK IBindCtx_GetBindOptions_Proxy(
02274     IBindCtx* This,
02275     BIND_OPTS *pbindopts)
02276 {
02277     FIXME(":stub\n");
02278     return E_NOTIMPL;
02279 }
02280 
02281 HRESULT __RPC_STUB IBindCtx_GetBindOptions_Stub(
02282     IBindCtx* This,
02283     BIND_OPTS2 *pbindopts)
02284 {
02285     FIXME(":stub\n");
02286     return E_NOTIMPL;
02287 }
02288 
02289 HRESULT CALLBACK IEnumMoniker_Next_Proxy(
02290     IEnumMoniker* This,
02291     ULONG celt,
02292     IMoniker **rgelt,
02293     ULONG *pceltFetched)
02294 {
02295     ULONG fetched;
02296     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02297     if (!pceltFetched) pceltFetched = &fetched;
02298     return IEnumMoniker_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02299 }
02300 
02301 HRESULT __RPC_STUB IEnumMoniker_Next_Stub(
02302     IEnumMoniker* This,
02303     ULONG celt,
02304     IMoniker **rgelt,
02305     ULONG *pceltFetched)
02306 {
02307     HRESULT hr;
02308     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02309     *pceltFetched = 0;
02310     hr = IEnumMoniker_Next(This, celt, rgelt, pceltFetched);
02311     if (hr == S_OK) *pceltFetched = celt;
02312     return hr;
02313 }
02314 
02315 BOOL CALLBACK IRunnableObject_IsRunning_Proxy(
02316     IRunnableObject* This)
02317 {
02318     BOOL rv;
02319     FIXME(":stub\n");
02320     memset(&rv, 0, sizeof rv);
02321     return rv;
02322 }
02323 
02324 HRESULT __RPC_STUB IRunnableObject_IsRunning_Stub(
02325     IRunnableObject* This)
02326 {
02327     FIXME(":stub\n");
02328     return E_NOTIMPL;
02329 }
02330 
02331 HRESULT CALLBACK IMoniker_BindToObject_Proxy(
02332     IMoniker* This,
02333     IBindCtx *pbc,
02334     IMoniker *pmkToLeft,
02335     REFIID riidResult,
02336     void **ppvResult)
02337 {
02338     FIXME(":stub\n");
02339     return E_NOTIMPL;
02340 }
02341 
02342 HRESULT __RPC_STUB IMoniker_BindToObject_Stub(
02343     IMoniker* This,
02344     IBindCtx *pbc,
02345     IMoniker *pmkToLeft,
02346     REFIID riidResult,
02347     IUnknown **ppvResult)
02348 {
02349     FIXME(":stub\n");
02350     return E_NOTIMPL;
02351 }
02352 
02353 HRESULT CALLBACK IMoniker_BindToStorage_Proxy(
02354     IMoniker* This,
02355     IBindCtx *pbc,
02356     IMoniker *pmkToLeft,
02357     REFIID riid,
02358     void **ppvObj)
02359 {
02360     FIXME(":stub\n");
02361     return E_NOTIMPL;
02362 }
02363 
02364 HRESULT __RPC_STUB IMoniker_BindToStorage_Stub(
02365     IMoniker* This,
02366     IBindCtx *pbc,
02367     IMoniker *pmkToLeft,
02368     REFIID riid,
02369     IUnknown **ppvObj)
02370 {
02371     FIXME(":stub\n");
02372     return E_NOTIMPL;
02373 }
02374 
02375 HRESULT CALLBACK IEnumString_Next_Proxy(
02376     IEnumString* This,
02377     ULONG celt,
02378     LPOLESTR *rgelt,
02379     ULONG *pceltFetched)
02380 {
02381     ULONG fetched;
02382     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02383     if (!pceltFetched) pceltFetched = &fetched;
02384     return IEnumString_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02385 }
02386 
02387 HRESULT __RPC_STUB IEnumString_Next_Stub(
02388     IEnumString* This,
02389     ULONG celt,
02390     LPOLESTR *rgelt,
02391     ULONG *pceltFetched)
02392 {
02393     HRESULT hr;
02394     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02395     *pceltFetched = 0;
02396     hr = IEnumString_Next(This, celt, rgelt, pceltFetched);
02397     if (hr == S_OK) *pceltFetched = celt;
02398     return hr;
02399 }
02400 
02401 HRESULT CALLBACK ISequentialStream_Read_Proxy(
02402     ISequentialStream* This,
02403     void *pv,
02404     ULONG cb,
02405     ULONG *pcbRead)
02406 {
02407     ULONG read;
02408     HRESULT hr;
02409 
02410     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
02411 
02412     hr = ISequentialStream_RemoteRead_Proxy(This, pv, cb, &read);
02413     if(pcbRead) *pcbRead = read;
02414 
02415     return hr;
02416 }
02417 
02418 HRESULT __RPC_STUB ISequentialStream_Read_Stub(
02419     ISequentialStream* This,
02420     byte *pv,
02421     ULONG cb,
02422     ULONG *pcbRead)
02423 {
02424     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
02425     return ISequentialStream_Read(This, pv, cb, pcbRead);
02426 }
02427 
02428 HRESULT CALLBACK ISequentialStream_Write_Proxy(
02429     ISequentialStream* This,
02430     const void *pv,
02431     ULONG cb,
02432     ULONG *pcbWritten)
02433 {
02434     ULONG written;
02435     HRESULT hr;
02436 
02437     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
02438 
02439     hr = ISequentialStream_RemoteWrite_Proxy(This, pv, cb, &written);
02440     if(pcbWritten) *pcbWritten = written;
02441 
02442     return hr;
02443 }
02444 
02445 HRESULT __RPC_STUB ISequentialStream_Write_Stub(
02446     ISequentialStream* This,
02447     const byte *pv,
02448     ULONG cb,
02449     ULONG *pcbWritten)
02450 {
02451     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
02452     return ISequentialStream_Write(This, pv, cb, pcbWritten);
02453 }
02454 
02455 HRESULT CALLBACK IStream_Seek_Proxy(
02456     IStream* This,
02457     LARGE_INTEGER dlibMove,
02458     DWORD dwOrigin,
02459     ULARGE_INTEGER *plibNewPosition)
02460 {
02461     ULARGE_INTEGER newpos;
02462     HRESULT hr;
02463 
02464     TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
02465 
02466     hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &newpos);
02467     if(plibNewPosition) *plibNewPosition = newpos;
02468 
02469     return hr;
02470 }
02471 
02472 HRESULT __RPC_STUB IStream_Seek_Stub(
02473     IStream* This,
02474     LARGE_INTEGER dlibMove,
02475     DWORD dwOrigin,
02476     ULARGE_INTEGER *plibNewPosition)
02477 {
02478     TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
02479     return IStream_Seek(This, dlibMove, dwOrigin, plibNewPosition);
02480 }
02481 
02482 HRESULT CALLBACK IStream_CopyTo_Proxy(
02483     IStream* This,
02484     IStream *pstm,
02485     ULARGE_INTEGER cb,
02486     ULARGE_INTEGER *pcbRead,
02487     ULARGE_INTEGER *pcbWritten)
02488 {
02489     ULARGE_INTEGER read, written;
02490     HRESULT hr;
02491 
02492     TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
02493 
02494     hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &read, &written);
02495     if(pcbRead) *pcbRead = read;
02496     if(pcbWritten) *pcbWritten = written;
02497 
02498     return hr;
02499 }
02500 
02501 HRESULT __RPC_STUB IStream_CopyTo_Stub(
02502     IStream* This,
02503     IStream *pstm,
02504     ULARGE_INTEGER cb,
02505     ULARGE_INTEGER *pcbRead,
02506     ULARGE_INTEGER *pcbWritten)
02507 {
02508     TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
02509 
02510     return IStream_CopyTo(This, pstm, cb, pcbRead, pcbWritten);
02511 }
02512 
02513 HRESULT CALLBACK IEnumSTATSTG_Next_Proxy(
02514     IEnumSTATSTG* This,
02515     ULONG celt,
02516     STATSTG *rgelt,
02517     ULONG *pceltFetched)
02518 {
02519     ULONG fetched;
02520     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02521     if (!pceltFetched) pceltFetched = &fetched;
02522     return IEnumSTATSTG_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02523 }
02524 
02525 HRESULT __RPC_STUB IEnumSTATSTG_Next_Stub(
02526     IEnumSTATSTG* This,
02527     ULONG celt,
02528     STATSTG *rgelt,
02529     ULONG *pceltFetched)
02530 {
02531     HRESULT hr;
02532     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02533     *pceltFetched = 0;
02534     hr = IEnumSTATSTG_Next(This, celt, rgelt, pceltFetched);
02535     if (hr == S_OK) *pceltFetched = celt;
02536     return hr;
02537 }
02538 
02539 HRESULT CALLBACK IStorage_OpenStream_Proxy(
02540     IStorage* This,
02541     LPCOLESTR pwcsName,
02542     void *reserved1,
02543     DWORD grfMode,
02544     DWORD reserved2,
02545     IStream **ppstm)
02546 {
02547     TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
02548     if(reserved1) WARN("reserved1 %p\n", reserved1);
02549 
02550     return IStorage_RemoteOpenStream_Proxy(This, pwcsName, 0, NULL, grfMode, reserved2, ppstm);
02551 }
02552 
02553 HRESULT __RPC_STUB IStorage_OpenStream_Stub(
02554     IStorage* This,
02555     LPCOLESTR pwcsName,
02556     ULONG cbReserved1,
02557     byte *reserved1,
02558     DWORD grfMode,
02559     DWORD reserved2,
02560     IStream **ppstm)
02561 {
02562     TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), cbReserved1, reserved1, grfMode, reserved2, ppstm);
02563     if(cbReserved1 || reserved1) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1, reserved1);
02564 
02565     return IStorage_OpenStream(This, pwcsName, NULL, grfMode, reserved2, ppstm);
02566 }
02567 
02568 HRESULT CALLBACK IStorage_EnumElements_Proxy(
02569     IStorage* This,
02570     DWORD reserved1,
02571     void *reserved2,
02572     DWORD reserved3,
02573     IEnumSTATSTG **ppenum)
02574 {
02575     TRACE("(%p)->(%d, %p, %d, %p)\n", This, reserved1, reserved2, reserved3, ppenum);
02576     if(reserved2) WARN("reserved2 %p\n", reserved2);
02577 
02578     return IStorage_RemoteEnumElements_Proxy(This, reserved1, 0, NULL, reserved3, ppenum);
02579 }
02580 
02581 HRESULT __RPC_STUB IStorage_EnumElements_Stub(
02582     IStorage* This,
02583     DWORD reserved1,
02584     ULONG cbReserved2,
02585     byte *reserved2,
02586     DWORD reserved3,
02587     IEnumSTATSTG **ppenum)
02588 {
02589     TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This, reserved1, cbReserved2, reserved2, reserved3, ppenum);
02590     if(cbReserved2 || reserved2) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2, reserved2);
02591 
02592     return IStorage_EnumElements(This, reserved1, NULL, reserved3, ppenum);
02593 }
02594 
02595 HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
02596     ILockBytes* This,
02597     ULARGE_INTEGER ulOffset,
02598     void *pv,
02599     ULONG cb,
02600     ULONG *pcbRead)
02601 {
02602     ULONG read;
02603     HRESULT hr;
02604 
02605     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
02606 
02607     hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, pv, cb, &read);
02608     if(pcbRead) *pcbRead = read;
02609 
02610     return hr;
02611 }
02612 
02613 HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
02614     ILockBytes* This,
02615     ULARGE_INTEGER ulOffset,
02616     byte *pv,
02617     ULONG cb,
02618     ULONG *pcbRead)
02619 {
02620     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
02621     return ILockBytes_ReadAt(This, ulOffset, pv, cb, pcbRead);
02622 }
02623 
02624 HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
02625     ILockBytes* This,
02626     ULARGE_INTEGER ulOffset,
02627     const void *pv,
02628     ULONG cb,
02629     ULONG *pcbWritten)
02630 {
02631     ULONG written;
02632     HRESULT hr;
02633 
02634     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
02635 
02636     hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, pv, cb, &written);
02637     if(pcbWritten) *pcbWritten = written;
02638 
02639     return hr;
02640 }
02641 
02642 HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
02643     ILockBytes* This,
02644     ULARGE_INTEGER ulOffset,
02645     const byte *pv,
02646     ULONG cb,
02647     ULONG *pcbWritten)
02648 {
02649     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
02650     return ILockBytes_WriteAt(This, ulOffset, pv, cb, pcbWritten);
02651 }
02652 
02653 HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
02654     IFillLockBytes* This,
02655     const void *pv,
02656     ULONG cb,
02657     ULONG *pcbWritten)
02658 {
02659     ULONG written;
02660     HRESULT hr;
02661 
02662     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
02663 
02664     hr = IFillLockBytes_RemoteFillAppend_Proxy(This, pv, cb, &written);
02665     if(pcbWritten) *pcbWritten = written;
02666 
02667     return hr;
02668 }
02669 
02670 HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
02671     IFillLockBytes* This,
02672     const byte *pv,
02673     ULONG cb,
02674     ULONG *pcbWritten)
02675 {
02676     TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
02677     return IFillLockBytes_FillAppend(This, pv, cb, pcbWritten);
02678 }
02679 
02680 HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
02681     IFillLockBytes* This,
02682     ULARGE_INTEGER ulOffset,
02683     const void *pv,
02684     ULONG cb,
02685     ULONG *pcbWritten)
02686 {
02687     ULONG written;
02688     HRESULT hr;
02689 
02690     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
02691 
02692     hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, pv, cb, &written);
02693     if(pcbWritten) *pcbWritten = written;
02694 
02695     return hr;
02696 }
02697 
02698 HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
02699     IFillLockBytes* This,
02700     ULARGE_INTEGER ulOffset,
02701     const byte *pv,
02702     ULONG cb,
02703     ULONG *pcbWritten)
02704 {
02705     TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
02706     return IFillLockBytes_FillAt(This, ulOffset, pv, cb, pcbWritten);
02707 }
02708 
02709 HRESULT CALLBACK IEnumFORMATETC_Next_Proxy(
02710     IEnumFORMATETC* This,
02711     ULONG celt,
02712     FORMATETC *rgelt,
02713     ULONG *pceltFetched)
02714 {
02715     ULONG fetched;
02716     if (!pceltFetched) pceltFetched = &fetched;
02717     return IEnumFORMATETC_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02718 }
02719 
02720 HRESULT __RPC_STUB IEnumFORMATETC_Next_Stub(
02721     IEnumFORMATETC* This,
02722     ULONG celt,
02723     FORMATETC *rgelt,
02724     ULONG *pceltFetched)
02725 {
02726     HRESULT hr;
02727     *pceltFetched = 0;
02728     hr = IEnumFORMATETC_Next(This, celt, rgelt, pceltFetched);
02729     if (hr == S_OK) *pceltFetched = celt;
02730     return hr;
02731 }
02732 
02733 HRESULT CALLBACK IEnumSTATDATA_Next_Proxy(
02734     IEnumSTATDATA* This,
02735     ULONG celt,
02736     STATDATA *rgelt,
02737     ULONG *pceltFetched)
02738 {
02739     ULONG fetched;
02740     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02741     if (!pceltFetched) pceltFetched = &fetched;
02742     return IEnumSTATDATA_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02743 }
02744 
02745 HRESULT __RPC_STUB IEnumSTATDATA_Next_Stub(
02746     IEnumSTATDATA* This,
02747     ULONG celt,
02748     STATDATA *rgelt,
02749     ULONG *pceltFetched)
02750 {
02751     HRESULT hr;
02752     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02753     *pceltFetched = 0;
02754     hr = IEnumSTATDATA_Next(This, celt, rgelt, pceltFetched);
02755     if (hr == S_OK) *pceltFetched = celt;
02756     return hr;
02757 }
02758 
02759 void CALLBACK IAdviseSink_OnDataChange_Proxy(
02760     IAdviseSink* This,
02761     FORMATETC *pFormatetc,
02762     STGMEDIUM *pStgmed)
02763 {
02764     TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
02765     IAdviseSink_RemoteOnDataChange_Proxy(This, pFormatetc, pStgmed);
02766 }
02767 
02768 HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
02769     IAdviseSink* This,
02770     FORMATETC *pFormatetc,
02771     ASYNC_STGMEDIUM *pStgmed)
02772 {
02773     TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
02774     IAdviseSink_OnDataChange(This, pFormatetc, pStgmed);
02775     return S_OK;
02776 }
02777 
02778 void CALLBACK IAdviseSink_OnViewChange_Proxy(
02779     IAdviseSink* This,
02780     DWORD dwAspect,
02781     LONG lindex)
02782 {
02783     TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
02784     IAdviseSink_RemoteOnViewChange_Proxy(This, dwAspect, lindex);
02785 }
02786 
02787 HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
02788     IAdviseSink* This,
02789     DWORD dwAspect,
02790     LONG lindex)
02791 {
02792     TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
02793     IAdviseSink_OnViewChange(This, dwAspect, lindex);
02794     return S_OK;
02795 }
02796 
02797 void CALLBACK IAdviseSink_OnRename_Proxy(
02798     IAdviseSink* This,
02799     IMoniker *pmk)
02800 {
02801     TRACE("(%p)->(%p)\n", This, pmk);
02802     IAdviseSink_RemoteOnRename_Proxy(This, pmk);
02803 }
02804 
02805 HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
02806     IAdviseSink* This,
02807     IMoniker *pmk)
02808 {
02809     TRACE("(%p)->(%p)\n", This, pmk);
02810     IAdviseSink_OnRename(This, pmk);
02811     return S_OK;
02812 }
02813 
02814 void CALLBACK IAdviseSink_OnSave_Proxy(
02815     IAdviseSink* This)
02816 {
02817     TRACE("(%p)\n", This);
02818     IAdviseSink_RemoteOnSave_Proxy(This);
02819 }
02820 
02821 HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
02822     IAdviseSink* This)
02823 {
02824     TRACE("(%p)\n", This);
02825     IAdviseSink_OnSave(This);
02826     return S_OK;
02827 }
02828 
02829 void CALLBACK IAdviseSink_OnClose_Proxy(
02830     IAdviseSink* This)
02831 {
02832     TRACE("(%p)\n", This);
02833     IAdviseSink_RemoteOnClose_Proxy(This);
02834 }
02835 
02836 HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
02837     IAdviseSink* This)
02838 {
02839     TRACE("(%p)\n", This);
02840     IAdviseSink_OnClose(This);
02841     return S_OK;
02842 }
02843 
02844 void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
02845     IAdviseSink2* This,
02846     IMoniker *pmk)
02847 {
02848     TRACE("(%p)->(%p)\n", This, pmk);
02849     IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This, pmk);
02850 }
02851 
02852 HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
02853     IAdviseSink2* This,
02854     IMoniker *pmk)
02855 {
02856     TRACE("(%p)->(%p)\n", This, pmk);
02857     IAdviseSink2_OnLinkSrcChange(This, pmk);
02858     return S_OK;
02859 }
02860 
02861 HRESULT CALLBACK IDataObject_GetData_Proxy(
02862     IDataObject* This,
02863     FORMATETC *pformatetcIn,
02864     STGMEDIUM *pmedium)
02865 {
02866     TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pmedium);
02867     return IDataObject_RemoteGetData_Proxy(This, pformatetcIn, pmedium);
02868 }
02869 
02870 HRESULT __RPC_STUB IDataObject_GetData_Stub(
02871     IDataObject* This,
02872     FORMATETC *pformatetcIn,
02873     STGMEDIUM *pRemoteMedium)
02874 {
02875     TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pRemoteMedium);
02876     return IDataObject_GetData(This, pformatetcIn, pRemoteMedium);
02877 }
02878 
02879 HRESULT CALLBACK IDataObject_GetDataHere_Proxy(
02880     IDataObject* This,
02881     FORMATETC *pformatetc,
02882     STGMEDIUM *pmedium)
02883 {
02884     TRACE("(%p)->(%p, %p)\n", This, pformatetc, pmedium);
02885     return IDataObject_RemoteGetDataHere_Proxy(This, pformatetc, pmedium);
02886 }
02887 
02888 HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
02889     IDataObject* This,
02890     FORMATETC *pformatetc,
02891     STGMEDIUM *pRemoteMedium)
02892 {
02893     TRACE("(%p)->(%p, %p)\n", This, pformatetc, pRemoteMedium);
02894     return IDataObject_GetDataHere(This, pformatetc, pRemoteMedium);
02895 }
02896 
02897 HRESULT CALLBACK IDataObject_SetData_Proxy(
02898     IDataObject* This,
02899     FORMATETC *pformatetc,
02900     STGMEDIUM *pmedium,
02901     BOOL fRelease)
02902 {
02903     FIXME(":stub\n");
02904     return E_NOTIMPL;
02905 }
02906 
02907 HRESULT __RPC_STUB IDataObject_SetData_Stub(
02908     IDataObject* This,
02909     FORMATETC *pformatetc,
02910     FLAG_STGMEDIUM *pmedium,
02911     BOOL fRelease)
02912 {
02913     FIXME(":stub\n");
02914     return E_NOTIMPL;
02915 }
02916 
02917 /* call_as/local stubs for oleidl.idl */
02918 
02919 HRESULT CALLBACK IOleInPlaceActiveObject_TranslateAccelerator_Proxy(
02920     IOleInPlaceActiveObject* This,
02921     LPMSG lpmsg)
02922 {
02923     FIXME(":stub\n");
02924     return E_NOTIMPL;
02925 }
02926 
02927 HRESULT __RPC_STUB IOleInPlaceActiveObject_TranslateAccelerator_Stub(
02928     IOleInPlaceActiveObject* This)
02929 {
02930     FIXME(":stub\n");
02931     return E_NOTIMPL;
02932 }
02933 
02934 HRESULT CALLBACK IOleInPlaceActiveObject_ResizeBorder_Proxy(
02935     IOleInPlaceActiveObject* This,
02936     LPCRECT prcBorder,
02937     IOleInPlaceUIWindow *pUIWindow,
02938     BOOL fFrameWindow)
02939 {
02940     FIXME(":stub\n");
02941     return E_NOTIMPL;
02942 }
02943 
02944 HRESULT __RPC_STUB IOleInPlaceActiveObject_ResizeBorder_Stub(
02945     IOleInPlaceActiveObject* This,
02946     LPCRECT prcBorder,
02947     REFIID riid,
02948     IOleInPlaceUIWindow *pUIWindow,
02949     BOOL fFrameWindow)
02950 {
02951     FIXME(":stub\n");
02952     return E_NOTIMPL;
02953 }
02954 
02955 HRESULT CALLBACK IOleCache2_UpdateCache_Proxy(
02956     IOleCache2* This,
02957     LPDATAOBJECT pDataObject,
02958     DWORD grfUpdf,
02959     LPVOID pReserved)
02960 {
02961     FIXME(":stub\n");
02962     return E_NOTIMPL;
02963 }
02964 
02965 HRESULT __RPC_STUB IOleCache2_UpdateCache_Stub(
02966     IOleCache2* This,
02967     LPDATAOBJECT pDataObject,
02968     DWORD grfUpdf,
02969     LONG_PTR pReserved)
02970 {
02971     FIXME(":stub\n");
02972     return E_NOTIMPL;
02973 }
02974 
02975 HRESULT CALLBACK IEnumOLEVERB_Next_Proxy(
02976     IEnumOLEVERB* This,
02977     ULONG celt,
02978     LPOLEVERB rgelt,
02979     ULONG *pceltFetched)
02980 {
02981     ULONG fetched;
02982     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02983     if (!pceltFetched) pceltFetched = &fetched;
02984     return IEnumOLEVERB_RemoteNext_Proxy(This, celt, rgelt, pceltFetched);
02985 }
02986 
02987 HRESULT __RPC_STUB IEnumOLEVERB_Next_Stub(
02988     IEnumOLEVERB* This,
02989     ULONG celt,
02990     LPOLEVERB rgelt,
02991     ULONG *pceltFetched)
02992 {
02993     HRESULT hr;
02994     TRACE("(%p)->(%d, %p, %p)\n", This, celt, rgelt, pceltFetched);
02995     *pceltFetched = 0;
02996     hr = IEnumOLEVERB_Next(This, celt, rgelt, pceltFetched);
02997     if (hr == S_OK) *pceltFetched = celt;
02998     return hr;
02999 }
03000 
03001 HRESULT CALLBACK IViewObject_Draw_Proxy(
03002     IViewObject* This,
03003     DWORD dwDrawAspect,
03004     LONG lindex,
03005     void *pvAspect,
03006     DVTARGETDEVICE *ptd,
03007     HDC hdcTargetDev,
03008     HDC hdcDraw,
03009     LPCRECTL lprcBounds,
03010     LPCRECTL lprcWBounds,
03011     BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
03012     ULONG_PTR dwContinue)
03013 {
03014     FIXME(":stub\n");
03015     return E_NOTIMPL;
03016 }
03017 
03018 HRESULT __RPC_STUB IViewObject_Draw_Stub(
03019     IViewObject* This,
03020     DWORD dwDrawAspect,
03021     LONG lindex,
03022     ULONG_PTR pvAspect,
03023     DVTARGETDEVICE *ptd,
03024     ULONG_PTR hdcTargetDev,
03025     ULONG_PTR hdcDraw,
03026     LPCRECTL lprcBounds,
03027     LPCRECTL lprcWBounds,
03028     IContinue *pContinue)
03029 {
03030     FIXME(":stub\n");
03031     return E_NOTIMPL;
03032 }
03033 
03034 HRESULT CALLBACK IViewObject_GetColorSet_Proxy(
03035     IViewObject* This,
03036     DWORD dwDrawAspect,
03037     LONG lindex,
03038     void *pvAspect,
03039     DVTARGETDEVICE *ptd,
03040     HDC hicTargetDev,
03041     LOGPALETTE **ppColorSet)
03042 {
03043     FIXME(":stub\n");
03044     return E_NOTIMPL;
03045 }
03046 
03047 HRESULT __RPC_STUB IViewObject_GetColorSet_Stub(
03048     IViewObject* This,
03049     DWORD dwDrawAspect,
03050     LONG lindex,
03051     ULONG_PTR pvAspect,
03052     DVTARGETDEVICE *ptd,
03053     ULONG_PTR hicTargetDev,
03054     LOGPALETTE **ppColorSet)
03055 {
03056     FIXME(":stub\n");
03057     return E_NOTIMPL;
03058 }
03059 
03060 HRESULT CALLBACK IViewObject_Freeze_Proxy(
03061     IViewObject* This,
03062     DWORD dwDrawAspect,
03063     LONG lindex,
03064     void *pvAspect,
03065     DWORD *pdwFreeze)
03066 {
03067     FIXME(":stub\n");
03068     return E_NOTIMPL;
03069 }
03070 
03071 HRESULT __RPC_STUB IViewObject_Freeze_Stub(
03072     IViewObject* This,
03073     DWORD dwDrawAspect,
03074     LONG lindex,
03075     ULONG_PTR pvAspect,
03076     DWORD *pdwFreeze)
03077 {
03078     FIXME(":stub\n");
03079     return E_NOTIMPL;
03080 }
03081 
03082 HRESULT CALLBACK IViewObject_GetAdvise_Proxy(
03083     IViewObject* This,
03084     DWORD *pAspects,
03085     DWORD *pAdvf,
03086     IAdviseSink **ppAdvSink)
03087 {
03088     FIXME(":stub\n");
03089     return E_NOTIMPL;
03090 }
03091 
03092 HRESULT __RPC_STUB IViewObject_GetAdvise_Stub(
03093     IViewObject* This,
03094     DWORD *pAspects,
03095     DWORD *pAdvf,
03096     IAdviseSink **ppAdvSink)
03097 {
03098     FIXME(":stub\n");
03099     return E_NOTIMPL;
03100 }

Generated on Sun May 27 2012 04:22:37 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.