Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
Thread Tools Rate Thread Display Modes
Old 05-20-2003, 02:46 AM   #1
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
Join Date: Sep 2002
Posts: 543
Default Correction in dark0ne's sitewho.cpp

If you start with iPos=0 the following can occur. Suppose I kill connection 0, then when you want to get the WM_WHO_SHARED contents you will see that connection 0 looks to be still alive. There is no immediate possibility to see if the connection is closed or not (unless you check the socket state). The correct way to resolve is that the nPos-1 is always a correct entry that is connected. Thus you shoud use iPos=nPos-1 in your code.

while ((nPos = SendMessage(Target, WM_WHO_SHARED, iPos, Result)) != -1 && iPos + 1 <= nPos && Users < 1000 ){
iPos=nPos-1; //The correction
// Lock data
Static = (STATIC *)((LPVOID (WINAPI *)(HANDLE, DWORD))Lock)(hShared, PID);
if (Static){
printf("%i %i:%i - %s\r\n", nPos - 1, Static->UserFile.uid, Static->UserFile.gid, Static->Action);
// Unlock data
((BOOL (WINAPI *)(LPVOID))Unlock)((LPVOID *)Static);
iPos = nPos;
FTPServerTools is offline  
Closed Thread

connection, correct, ipos, shoud, wm_who_shared

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 02:38 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)