> Indirectly by functions using hb_itemGetWriteCL() on parameters passed
> by reference. You can find few functions in HBRTL.
> 
>> --- server.prg
>> ? "Please enter password:"
>> ACCEPT TO pw
>> <process pw>
>> pw := NIL
>> <server loop>
>> ---
>> I want that the content of 'pw' variable be surely 
>> cleared from memory.
>> Is this currently possible? and how?
> 
> You can create dedicated function for such job:
> 
>   HB_FUNC( HB_SETSPACE )
>   {
>      PHB_ITEM pString = hb_param( 1, HB_IT_STRING );
> 
>      if( pString )
>      {
>         ULONG ulSize;
>         char * buffer;
> 
>         /* clear RETURN value before calling hb_itemGetWriteCL(),
>          * it's possible that it contains copy of passed item
>          */
>         hb_ret();
> 
>         if( hb_itemGetWriteCL( pBuffer, &buffer, &ulSize ) )
>            memset( buffer, ' ', ulSize );
>      }
>   }
> 
> And then use it:
>   hb_setSpace( @pw )
> Of course it will work only if pw was not assigned to some other
> location and it's the one copy of given text.

Yes.

Thank you. Just posted pretty much the exact same solution :)

I'll commit a final version ASAP.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to