retrieving a machine code

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

retrieving a machine code

Post by HelloWorld »

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: 1035
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

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

Post by HelloWorld »

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: 1035
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

Not a built in function, sorry.
HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Post by HelloWorld »

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: 1035
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

What is the call from the InstallAware side?
HelloWorld
Posts: 25
Joined: Wed Nov 23, 2005 10:21 am

Post by HelloWorld »

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: 1035
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

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

Post by HelloWorld »

yes, everything was working well when using a long int as return value in stead of a PChar.
sinan
Site Admin
Posts: 1035
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

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