Important information: this site is currently scheduled to go offline indefinitely by end of the year.

PROJECT: MultiEx Plugin Support

Coders and would-be coders alike, this is the place to talk about programming.
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

Neko wrote:I know, I've spend days on it in the past. And got it to work eventually. The 'correct' way to return a string (this is what I used anyway):

Code: Select all

  function PlugInVersions(Path: PChar; BufferSize: Integer; var Buffer: PChar): Integer; stdcall; forward;
(returning string length as function result).

Code: Select all

  for i:=1 to Length(tmpDynaFile) do begin
    Buffer[i-1]:=tmpDynaFile[i];
  end;
  Buffer[Length(tmpDynaFile)]:=#0;
  Result:=Length(tmpDynaFile);
And this would return something. But note that this code does not check BufferSize, which is a requirement these days. Wouldn't want buffer overflows.
This is the corresponding VB declaration and code:

Code: Select all

Private Declare Function PlugInVersions Lib "tibedhlp.dll" (ByVal Path As String, ByVal BufferLength As Long, BufferText As String) As Long

Function GetPluginLiveUpdateInfo() As String
  Dim Buffer As String * 255
  Dim q As Long
  q = PlugInVersions(DataDir$, 255, Buffer)
  GetPluginLiveUpdateInfo = Left$(Buffer, q)
End Function
Might be useful.
Too much work for Mr.Mouse ;-) better to just return a PChar thats compatible with VB. The main problem with VB is that if you return a string, vb tries to free that memory itself, so you CAN'T make memory with Delphi's memory manager or your fubar things there. In fact, windows gives you some GREAT functions to do it, as VB uses the same functions. Thereby, it simplifies my end as well as Mr.Mouse's end, doesn't worry about buffer overflows, can still use delphi strings internally, and it works via a single call where he doesn't have to write a wrapper. I had 3 goals in mind, multiple language support, ease for MrMouse to implement, and functionality.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

oh and again, the manager handles all this, doesn't matter what the plugin does.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

I recently noticed a function in VB that would convert UNICODE strings. The problem is that this stuff is not possible in dll-calls.
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

Skeleton plugin for delphi is done, I'll be releasing it the same time i've finished updating the BF plugin.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

Awesome!
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

This is kinda better, now i have a final product to work with :-D

I'm already thinking of new ideas for the new one
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

Small problem,

BF plugin only supports the OPENFLAG_FOREXPORT

if the plugin doesn't have SUPPORTFLAG_CREATE, then OPENFLAG_CREATENEW and OPENFLAG_OPENALWAYS shouldn't be passed, as CREATENEW OPENALWAYS

CREATENEW = overwrite file with a new archive
OPENALWAYS = if archive file doesn't exist create a new one
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

Hmm. Allright, we can take a look at that. The problem was that your test plugin didn't work if I just used FOREXPORT, I HAD to give the other flags as well. We discussed this be email as well.
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

I thought we fixed that, and I sent you another version.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

Interesting. Anyway. A new version is easily released, this is just small fix. I will take care of that.
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

wait a min on that, i have to check something else out too.
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

Ok
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

screens of the BF plugin

Image
Image

Exports good as well
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Post by Mr.Mouse »

W00t!! :D :D
Rahly
VVIP member
VVIP member
Posts: 411
Joined: Thu Aug 05, 2004 10:17 am
Been thanked: 1 time

Post by Rahly »

what do you mpGetOptions() for when you startup?
"By nature men are alike. Through practice they have become far apart." Confucius (Analect 17:2)
Post Reply