Alex, I am not a user of WriteFile(), but from a quick glance I think the current code is OK. The author seems to expect this:
WriteFile(hFile, cBuffer, @nNumWritten, @lOverlapped) (only 4 parameters required, not 5). As for the comments describing 5 parameters to pass, it is about WinAPI's WriteFile(), not about HB_FUN_WRITEFILE :-) regards, budyanto On 14 Feb 2008 at 10:40, Alex Strickland wrote: > Hi > > Could someone please change in hbwhat32\_winsys.c: > > //-------------------------------------------------------------------// > /* > BOOL WriteFile( > HANDLE hFile, // handle to file to write to > LPCVOID lpBuffer, // pointer to data to write to file > DWORD nNumberOfBytesToWrite, // number of bytes to write > LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes written > LPOVERLAPPED lpOverlapped // pointer to structure for > overlapped I/O > ); > */ > HB_FUNC( WRITEFILE ) > { > > DWORD nWritten = 0 ; > OVERLAPPED *Overlapped ; > > if( ISCHAR( 4 )) > Overlapped = ( OVERLAPPED *) hb_parc( 4 ); //hb_param( 4, > HB_IT_STRING )->item.asString.value ; > > hb_retl ( WriteFile( (HANDLE) hb_parnl( 1 ) , > hb_parcx( 2 ) , > hb_parclen( 2 ) , > &nWritten , > ISCHAR( 4 ) ? Overlapped : NULL ) ) ; > > hb_stornl( nWritten, 3 ) ; > } > > > to: > > > //-------------------------------------------------------------------// > /* > BOOL WriteFile( > HANDLE hFile, // handle to file to write to > LPCVOID lpBuffer, // pointer to data to write to file > DWORD nNumberOfBytesToWrite, // number of bytes to write > LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes written > LPOVERLAPPED lpOverlapped // pointer to structure for > overlapped I/O > ); > */ > HB_FUNC( WRITEFILE ) > { > > DWORD nWritten = 0 ; > OVERLAPPED *Overlapped ; > > if( ISCHAR( 5 )) > Overlapped = ( OVERLAPPED *) hb_parc( 5 ); //hb_param( 4, > HB_IT_STRING )->item.asString.value ; > > hb_retl ( WriteFile( (HANDLE) hb_parnl( 1 ) , > hb_parcx( 2 ) , > hb_parclen( 3 ) , > &nWritten , > ISCHAR( 5 ) ? Overlapped : NULL ) ) ; > > hb_stornl( nWritten, 4 ) ; > } > > The params seem off by one for params 4 and 5. > > Thanks > Alex > _______________________________________________ > Harbour mailing list > Harbour@harbour-project.org > http://lists.harbour-project.org/mailman/listinfo/harbour _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour