retrieving a machine code

Got a problem you cannot solve? Try here.
HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

retrieving a machine code

Postby HelloWorld » Thu Nov 24, 2005 11:45 am

Hi,

I want to retrieve a machine code from an external dll. This dll can be designed anyway i want, so there is no problem, but what is the best way to do this.

With Regards,

Jeroen van Onzen

PS: The double-click in the dialog editor (on a control) is not the most intuitive option. It was driving me crazy to find the option....
PS2: A help file under the Dialog Editor would also be nice.

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Nov 24, 2005 11:57 am

Its really up to you! The most complex (and powerful) way would be to build an InstallAware plug-in. This way your DLL has full access to the script variables, can paint its own line in the script, etc...but this is probably overkill for most uses.

The direct way is just to use the Call DLL Function call. It can pass an allocated string buffer (if your ID is textual) or an integer as a variable (if your ID is numeric), among others. So you can make your function prototype in your DLL any way you like and then use the Call DLL Function command to invoke it.

HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Postby HelloWorld » Fri Nov 25, 2005 9:17 am

Hi Support Team,

is it possible to display an integer (which is in a variable) as a hexadecimal code?

Thanks in advance

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Fri Nov 25, 2005 10:34 am

Not a built in function, sorry.

HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Postby HelloWorld » Thu Dec 01, 2005 7:17 am

I am trying to call a dll made in delphi with the following function:

Code: Select all

procedure GetMachineCode(out MachineCode: PChar); stdcall;
var sMachineCode: string;
begin
  sMachineCode := Format('%x', [100000]);
  MachineCode := StrAlloc(9);
  StrPCopy(MachineCode, sMachineCode);
end


Any idea why this fails?

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Dec 01, 2005 8:12 am

What is the call from the InstallAware side?

HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Postby HelloWorld » Thu Dec 01, 2005 10:23 am

Code: Select all

~InstallAWARE Clipboard Data~
~Call DLL Function~
~{79CC353E-2FF2-4CC8-B8EA-754DE5707248}~
~$SUPPORTDIR$\\dwesetup.dll,GetMachineCode,void,,"pointer to string",$MACHINECODE$,$~
~mIDEFunc.dll\\mEXEFunc.dll~

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Dec 01, 2005 3:38 pm

Looks good to me. Are you adding the function name to the exports section at the end of your Delphi DLL code?

HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Postby HelloWorld » Thu Dec 01, 2005 3:43 pm

yes, everything was working well when using a long int as return value in stead of a PChar.

sinan
Site Admin
Posts: 1028
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Thu Dec 01, 2005 3:47 pm

I'd say remove the "out" and just say PChar (no var, no out) and try again.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 134 guests