View Single Post
Old 11-29-2003, 04:40 PM  
SnypeTEST
Senior Member
 
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