Hi Viktor,

Should be fixed now. (Though for me only one of them
gave warning, pls tell if it's still wrong).

Yes you're right.
I'm sorry, I do too many things on automatic and not is good. :)

I see what you mean. I don't know the most optimal way
to solve that.         ...

Look at the patch if it can help you, only win32.

Actually, such function could be written as .prg
code by anyone. Now the low-level logic is there,
[ ... ]

Ok. I see, it's nice.

Best regards,
Xavi

Index: win_dll.c
===================================================================
--- win_dll.c   (revision 13852)
+++ win_dll.c   (working copy)
@@ -249,6 +249,7 @@
    int         iFirst;
    int *       piArgTypeReq;
    int *       piArgType;
+   PHB_ITEM *  pItmCpy;
    HB_WINARG * pArg;
 } HB_WINCALL, * PHB_WINCALL;
 
@@ -846,24 +847,28 @@
 
          if( iParams )
          {
+            wcall.pItmCpy = ( PHB_ITEM * ) hb_xgrab( iParams * sizeof( 
PHB_ITEM ) );
             wcall.pArg = ( HB_WINARG * ) hb_xgrab( iParams * sizeof( HB_WINARG 
) );
             wcall.piArgType = ( int * ) hb_xgrab( iParams * sizeof( int ) );
             memset( wcall.pArg, 0, iParams * sizeof( HB_WINARG ) );
          }
          else
          {
+            wcall.pItmCpy = NULL;
             wcall.pArg = NULL;
             wcall.piArgType = NULL;
          }
 
          for( tmp = 0; tmp < iParams; ++tmp )
          {
-            PHB_ITEM pParam = hb_param( iFirst + tmp, HB_IT_ANY );
+            PHB_ITEM pParam;
 
             HB_U32 r1 = 0;
             HB_U32 r2;
             HB_BOOL b64;
 
+            hb_itemCopy( pParam = hb_itemNew( NULL ), hb_param( iFirst + tmp, 
HB_IT_ANY ) );
+            wcall.pItmCpy[ tmp ] = hb_itemUnShare( pParam );
             wcall.piArgType[ tmp ] = wcall.piArgTypeReq ? wcall.piArgTypeReq[ 
tmp ] : HB_WIN_DLL_CTYPE_DEFAULT;
 
             if( wcall.piArgType[ tmp ] == HB_WIN_DLL_CTYPE_DEFAULT )
@@ -1329,8 +1334,14 @@
          }
 
          for( tmp = 0; tmp < iParams; ++tmp )
+         {
+            hb_itemRelease( wcall.pItmCpy[ tmp ] );
             hb_strfree( wcall.pArg[ tmp ].hString );
+         }
 
+         if( wcall.pItmCpy )
+            hb_xfree( wcall.pItmCpy );
+
          if( wcall.pArg )
             hb_xfree( wcall.pArg );
 
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to