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 11-28-2003, 06:47 AM   #1
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default [Visual Basic] Memory Mapping sample

Sample code that allows u to communicate with ioFTPD from your VB5/6 program, through memory mapping.

Currently implemented:
  • list online users
  • getting info from userfiles
  • kicking users on UID/CID
  • id2name & name2id (both groups & users)
Not yet implemented:
  • Groupfiles
  • User&GroupIdTables
  • owner of a file (DC_VFS)

Remarks:
1. Get http://home.no.net/addict99/files/win3207.tlb.rar if u don't have it already. It's a reference file with alot of win32 api functions in declared. I have been using this one for years, it's very helpful.
Add it to any of your projects like this: Menu 'Project' -> 'References' -> (select the file)
2. Only usable on 5.2.11 and later.
3. Edit & use at own risk. Functions are all used in my sitewho.exe and i've never seen it crashing.
This thing is all about working with pointers & CopyMemory, if you don't know what u are doing, either your program or ioFTPD WILL crash at some point.
4. I'm not here to hold your hand, or teach you how to program in VB. I'm assuming u have advanced or expert knowledge/experience.

attachment removed, see below for updated samplecode.
ADDiCT is offline  
Old 11-28-2003, 12:47 PM   #2
SnypeTEST
Senior Member
ioFTPD Scripter
 
Join Date: Feb 2003
Posts: 458
Default

awsome thnx dude. now I can "Read" it.. lol
SnypeTEST is offline  
Old 11-28-2003, 01:30 PM   #3
kraxdaz
Member
ioFTPD Foundation User
 
Join Date: Jun 2003
Posts: 86
Default

Big thx ADDiCT !
kraxdaz is offline  
Old 11-29-2003, 04:40 PM   #4
SnypeTEST
Senior Member
ioFTPD Scripter
 
Join Date: Feb 2003
Posts: 458
Default

EditTagline function.
add it to clsMemMap.cls

example:
mem.EditTagline 0, "NEW SHIT!"

there is a BUG IN VB so I had to make an extended function. I didnt want to mess with bytes. You can make many other functions out of this one like edit credits (to make a nuke.exe ) , edit groups , blah blah blah

Quote:
Public Function EditTagline(iUID As Integer, tagline As String) As Boolean
Dim lRet As Long
Dim lRet2 As Long
Dim lpUserFile As io_USERFILE
Dim ThisAllocation As mylpAllocation
'clear old data (if any)
'allocate shared memory

ThisAllocation = SharedAllocate(True, sizeof_USERFILE + (MAX_PATH * 2))
If (ThisAllocation.hDaemon = 0) Then
EditTagline = False
Exit Function
End If
'fill in structure
lpUserFile.Uid = iUID
'copy it to shared memory location
CopyMem2 ThisAllocation.lpMemory, lpUserFile, sizeof_USERFILE
'get the userfile from ioFTPD
lRet = QueryDaemon(DC_USERFILE_OPEN, ThisAllocation, 5000)
If lRet = 0 Then
lRet = QueryDaemon(DC_USERFILE_LOCK, ThisAllocation, 5000)
'ok !
EditTagline = True
'copy shared memory into structure
CopyMem1 lpUserFile, ThisAllocation.lpMemory, sizeof_USERFILE
lpUserFile.tagline = tagline
'edit tagline
Extended_EditUserFile ThisAllocation, lpUserFile
'close the userfile
lRet = QueryDaemon(DC_USERFILE_CLOSE, ThisAllocation, 5000)
Else
'user doesn't exist or function failed
EditTagline = False
End If
SharedFree ThisAllocation
End Function

Private Function Extended_EditUserFile(ThisAllocation As mylpAllocation, lpUserFile As io_USERFILE) As String
Dim lRet As Long
'copy shared memory into structure
CopyMem2 ThisAllocation.lpMemory, lpUserFile, sizeof_USERFILE
'unlock userfile
lRet = QueryDaemon(DC_USERFILE_UNLOCK, ThisAllocation, 5000)
'copy shared memory into structure
CopyMem1 lpUserFile, ThisAllocation.lpMemory, sizeof_USERFILE
End Function
I had probs porting datacopy.c , ( to return file owner/group ) maybe someone else wants to give it a try.
SnypeTEST is offline  
Old 01-04-2004, 10:13 AM   #5
Topper
Junior Member
 
Join Date: Nov 2003
Posts: 2
Default

Hi
Your Code works great. But in which format ist LastOnlineUser.lngIdleTime and LoginTime?
It´s only a number how can i change this to a time.
Topper is offline  
Old 01-04-2004, 10:44 AM   #6
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

those are both unix timestamps (= total number of seconds that have passed since January 1, 1970)

try some sample code at PSCode.com to convert it to other forms of time/date:
http://www.pscode.com/vb/scripts/Bro...t=Alphabetical


When ioGui2 is "ready", i will update this thread with the ioGuiExt sourcecode.
That updated code gets UserIdTable & GroupIdTable, extracts all info from userfiles & groupfiles, changes a user's flags.
ADDiCT is offline  
Old 02-10-2004, 04:31 PM   #7
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

sourcecode of ioGuiExt.exe (from ioGui version 2.0.0)


new functions:
  • FULL Userfiles
  • Groupfiles
  • UserIdTable
  • GroupIdTable
  • changing userflags (for example, easy to change other settings as wel)


attachment removed, see below for updated samplecode.
ADDiCT is offline  
Old 02-23-2004, 06:44 PM   #8
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

ioGuiExt 1.0.3 sourcecode available at: http://www.ioftpd.com/scripts/script.php?id=27

has an important fix that will prevent some crashes.
ADDiCT is offline  
Closed Thread

Tags
file, functions, memory, program, users


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 11:40 AM.

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