No announcement yet.

Calling GetBinaryType from Kernel32.dll

  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling GetBinaryType from Kernel32.dll


    In my setup the user selects a directory and then the code checks whether a defined .exe is of type 32 or 64 bit. Depending on that result I install different files.

    I figured out that I can use a function from Kernel32.dll and so I wrote a small c# program that saves the result in a text file which I then read in the setup. The problem is that I would need to install this little program right at the start when the user submits the path through the dialog screen. How can I do this as all the files are installed together after all the dialogs are submitted while I would need my exe during the dialog steps?

    Is there anyway a better approach? I looked briefly at the SDK but this seems to be even more complicated or at least I haven't seen a suitable example.

    [DllImport("kernel32.dll", SetLastError = true)]
    public static extern int GetBinaryType(string lpAppName, ref BinaryType lpBinaryType);

    Any help is highly appreciated.

  • #2
    Check the docs for Primer files. You need to add the utility there, so you can run it when the setup starts. User Guide, Chapter 2.



    • #3
      Thank you very much. Works perfectly fine!