Page 10 of 20

Posted: Mon May 16, 2005 8:08 pm
by Mr.Mouse
Ok, well , it didn't crash , because the test app won't allow any errors. It will only start to retrieve the resource list if the mpIsFileAnArchive is satisfied.

Your suggestion worked, so the archive is now detected as a valid one.

:D

However, the list (mpFindFirst) crashes the program.

Code: Select all

Declare Function mpFindFirstFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByVal ArchiveHandle As Long, ByVal FileMask As String, ByRef FieldList As String, ByRef FindData As TFileFindInfo) As Boolean

Code: Select all

Public Type TFileFindInfo
    Filename As String
    FieldData As String
    FileMask As String
    ArchiveHandle As Long
    FieldList As String
    InternalFindInfo As Long 'pointer?
  End Type

Posted: Mon May 16, 2005 9:41 pm
by Rahly
Maybe?

Code: Select all

Declare Function mpFindFirstFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByVal ArchiveHandle As Long, ByVal FileMask As String, ByVal FieldList As String, ByVal FindData As TFileFindInfo) As Boolean
All Strings that are passed in parameter values, like FileMask and FieldList should be Value, try changing FindData to ByVal and see what happens.

Posted: Wed May 18, 2005 8:36 am
by Mr.Mouse
That doesn't work, as VB does not allow user-defined structures to be passed ByVal. :(

Fixing up the parameters in the struct from "String" to char() didn't help either. It still crashes. Very VERY Odd.

Posted: Wed May 18, 2005 2:11 pm
by Rahly
ok

change

ByRef FieldList As String

to

ByVal FieldList As String

keep the Structure as ByRef, and then send me a copy of that COMPILED program, i should be able to fix it up and any other functions that pass structures. I'm thinking that passing by ref, is creating a different sized struct, and then i'm filling the strings with PChars, and then VB is treating them like an OLE Variant, but i'd like to make sure, but I'd like to see for myself, this way we don't have to keep "trying" things.

Posted: Thu May 19, 2005 12:47 pm
by Mr.Mouse
I have mailed you the recompiled program...did you get it?

Posted: Thu May 19, 2005 10:26 pm
by Rahly
Got it, i'm looking at it now.

Also, I wanted to run something by ya. I just wrote a new tool, game trainer system. As MexCom, it will support multiple games with the added feature of user upgrade. Anyway, I'm writing updating system for it, I thought Mexcom might want to use.

Posted: Thu May 19, 2005 11:41 pm
by Mr.Mouse
I like the sound of that, could you perhaps PM me the specifics? :)

Posted: Fri May 20, 2005 12:33 am
by Rahly
Ok, found a problem with isFileAnArchive, i had been playing with it and forgot to change it back, it was looking for a Pointer to an Ole Variant, instead of a PChar, now that passes and its failing on the mpFindFirstFile, it seems that VB is building the structure, and then after calling the function, its destroying that version, which has memory allocated from the plugin. it then tries to free that memory in the struct and fails miserably.

Question: what is your definition for the mpFindFirstFile/mpFindNextFile? and the structure you pass it.

Posted: Fri May 20, 2005 9:28 am
by Mr.Mouse

Code: Select all

Declare Function mpFindFirstFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByVal ArchiveHandle As Long, ByVal FileMask As String, ByVal FieldList As String, ByRef FindData As TFileFindInfo) As Boolean
Declare Function mpFindNextFile Lib "pluginmanager.dll" (ByVal FormatIndex As Long, ByRef FindData As TFileFindInfo) As Boolean

Posted: Fri May 20, 2005 3:21 pm
by Rahly
and the TFileFindInfo structure?

Posted: Fri May 20, 2005 4:03 pm
by Mr.Mouse

Code: Select all

 Public Type TFileFindInfo
    Filename As String
    FieldData As String
    FileMask As String
    ArchiveHandle As Long
    FieldList As String
    InternalFindInfo As Long 'pointer?
  End Type

Posted: Fri May 20, 2005 4:46 pm
by Rahly

Code: Select all

Public Type TFileFindInfo 
    Filename As String 
    FieldData As String 
    FileMask As String 
    ArchiveHandle As Long 
    FieldList As String 
    InternalFindInfo As Long 'pointer? 
    InternalFindVar As Variant
  End Type
I have it almost working

Posted: Fri May 20, 2005 5:47 pm
by Rahly
i think it should be set, if you can make that change and send me the new copy, cuz at the moment, i'm writing to that area of memory, which is on the stack, which is writing over another variable, and killing the program.

If it works, i'll send you the new programs.

EDIT: what did you think of the PM? or have you not assimilated it yet?

Posted: Fri May 20, 2005 6:07 pm
by Mr.Mouse
OKay, it's on your way.

Yes, I think your idea of update is pretty nifty. I will have to see it first, though. And see how much work is in there to get something like that implemented. I have a busy schedule, with multiple projects. And that's just my hobby. My job is even worse, and then I have a family as well.

Nevertheless, I say it's a good idea. :D

Posted: Fri May 20, 2005 6:43 pm
by Rahly
Ok, sent you the new copies of the manager and plugins

its working for me, your not printing out the Filename after each mpFindNextFile, also, you need to call mpFindClose after you use the FindFirst/FindNext so that the plugin can free any data it was using for the find (prevent memory leaks)

see how that works for you