Vijaya7890

How to create a new record in Binary Table in MSI

2 posts in this topic

Hi...

I am trying to add a record in Binary Table in an MSI file.

As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) .

I have tried with VB script and it is working fine,

Here is the VB Script file

Dim Installer
Dim Database
Dim View
Dim Record
Dim query
query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)"
Set Installer = CreateObject("WindowsInstaller.Installer")

Set Record = Installer.CreateRecord(1)
Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs"

Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1)

Set View = Database.OpenView(query)
View.Execute Record
Database.Commit

when i tried the same thing in autoit it is not working and it is not giving any syntax error.

AutoIt file: 

#include <File.au3>

$idVarInput_CAName="CA_Test"
$filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs"
$idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi"
$value="?"

Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')"

$oInstaller = ObjCreate("WindowsInstaller.Installer")
$oRec=$oInstaller.CreateRecord(1)
$r=$oRec.SetStream(1,$filepath)
$oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1)
$oView = $oDB.OpenView($Query)
$oView.Execute($oRec)
$oDB.commit()

Please Help!

Thanks...

Share this post


Link to post
Share on other sites



3 hours ago, Vijaya7890 said:

Hi...

I am trying to add a record in Binary Table in an MSI file.

As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) .

I have tried with VB script and it is working fine,

Here is the VB Script file

Dim Installer
Dim Database
Dim View
Dim Record
Dim query
query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)"
Set Installer = CreateObject("WindowsInstaller.Installer")

Set Record = Installer.CreateRecord(1)
Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs"

Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1)

Set View = Database.OpenView(query)
View.Execute Record
Database.Commit

when i tried the same thing in autoit it is not working and it is not giving any syntax error.

AutoIt file: 

#include <File.au3>

$idVarInput_CAName="CA_Test"
$filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs"
$idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi"
$value="?"

Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')"

$oInstaller = ObjCreate("WindowsInstaller.Installer")
$oRec=$oInstaller.CreateRecord(1)
$r=$oRec.SetStream(1,$filepath)
$oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1)
$oView = $oDB.OpenView($Query)
$oView.Execute($oRec)
$oDB.commit()

Please Help!

Thanks...

Change the query line as below

Local $Query = "INSERT INTO `Binary`(`Name`,`Data`) VALUES('" & $idVarInput_CAName & "'," & $value & ")"

In your code... is surrounded by single quotes as '?'.So your query isn't able to be parsed.

I removed only the single quote part...it is working..

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • Miliardsto
      By Miliardsto
      Hello. Im trying to make my scripts safe - unnable to decompile. I search for obfuscators and other security methods but the search has come to nothing.
      Then one guy gave that idea below. If I rightly understood this idea lets we talk about example program with this secutiy method.
      Program have two parts, first is only login gui and the second part is the main program Second part (main program) is uploaded on ftp server lets say that on http://xxx/autoit/main_program.au3 So we have the first gui with login, we put correctly login and pass and this is the moment when code from http://xxx/autoit/main_program.au3 will be downloaded and executed Finally main program will be appear This is the similiar way like new games are protected by cracking.
      I have few questions in this moment about this:
      Is something like that even possible to do with the autoit? First part of program (login gui) must have somewhere given that link to download the rest of code - http://xxx/autoit/main_program.au3 to make it execute. As we know this first part of program is easy able to hack and retrieve this web url http://xxx/autoit/main_program.au3 where located is main part of program. Is the way to encrypt or secure it? If only code will be stored in .php we know it cannot be previewed. So it could for example get code from .php file instead of .au3 I know that methods works in other languages (I dont know exactly how) thats becouse I only speculates, maybe something may looks different in these solution? Other way would be compiling second part of code on web server (there are available web autoit servers) maybe this way is possible? Tell me anything U know about this ideas and if its even possible to achieve.
      Thanks for ur any response, advice or thoughts
       

       
       
    • dubd83
      By dubd83
      I am trying to click on a tab within an SWT_Window0. The problem is autoit can not see the tab's text and there is no controlid. I have tried using commands to obtain a handle and text with no luck. Any ideas on how to get control of this tab?
    • Iznogoud
      By Iznogoud
      Hi,
      I am trying to find more information on generating PDF files from AutoIT and found the UDF topic 
      Also found some info on creating .FDF file and use PDFTK for merging, but i can't find info about a custom based layout.
      What i trying to find out is, if it is possible to generate a variable layout. For an example i created a script which is based out 20 fields and every field can contain information. If one of those fields are not filled, it shouldn't be printed on the PDF either.
      To make it more difficult, the PDF should contain a heading, the first 10 fields and then a horizontal line across the PDF and then a new heading and then show the last 10 fields.
      But only the fields which are filled.
      Is this possible?
    • PauloRodrigues
      By PauloRodrigues
      I need to select an item from a SAP combobox, could anyone help me or did something like that? I tried to use some AutoIt functions but without success.
      When i try to identify the combobox with au3Info, this is the return:


      Could anyone help me with this challange?
    • ur
      By ur
      Is there anyway to create a new database in Sybase or SAP ASE using AutoIT.