Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-03 Thread Christopher Painter
Since you mention c#  I assume you are using DTF.   DTF allows you to add a 
file as content to the custom action CSPROJ and it'll automatically extract 
to the current directory in TEMP and cleanup at the end of execution for 
you.  You wouldn't have to write any code.  Would this fit your needs? 


 From: "ak m" 
Sent: Tuesday, September 03, 2013 8:10 AM
To: chr...@iswix.com, "General discussion for Windows Installer XML 
toolset." 
Subject: Re: [WiX-users] Extract Binary file from MSI to Temp folder using 
C#

custom action during install...

 On Tue, Sep 3, 2013 at 5:46 PM, Christopher Painter  
wrote:
 Is this for an application extracting a resource or for a custom action
during an install?


 From: "ak m" 
Sent: Monday, September 02, 2013 7:21 AM
To: "General discussion for Windows Installer XML toolset."

Subject: [WiX-users] Extract Binary file from MSI to Temp folder using C#

Dear All,

Code to Extract Binary file from MSI to Temp folder using C#

Anyone Plz help me on this?

Thanks in Advance...

Anil


--
  Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft
technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk



___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft 
technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk


___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-03 Thread Gabriel Ivanes
You may want a complete example :











...







Dim TempFolder : TempFolder =
Session.Property("TempFolder")

Dim SFolder : SFolder = Session.Property("SystemFolder")



'** Début du main **

ExtractBinary "polyval.hta",
TempFolder & "polyval.hta"' Extraction du fichier HTA
de la table Binary vers le dossier Temp

ExtractIcon "polyval.ico",
TempFolder & "polyval.ico"' Extraction du fichier ico
de la table Binary vers le dossier Temp

SExecute SFolder & "mshta.exe
" & TempFolder & "polyval.hta"' Exécution du HTA à partir
du dossier Temp

CleanFile
TempFolder & "polyval.hta"' Suppression
du fichier HTA dans le dossier Temp

CleanFile
TempFolder & "polyval.ico"' Suppression
du fichier ico dans le dossier Temp

SetMSIProperty
"REGION","HKEY_LOCAL_MACHINE\SOFTWARE\Marimba\Applications\REGION" '
Récupération d'une clé de registre pour l'affecter à une variable
windows installer

'** Fin du main **





Function SetMSIProperty(MSIProperty,RegistryKey)



Dim WShell

Set WShell = CreateObject("Wscript.Shell")



RegistryValue = WShell.RegRead(RegistryKey)

Session.Property(MSIProperty)=RegistryValue



Set WShell = nothing



End Function





Function ExtractBinary(BinaryName, OutputFile)

Const msiReadStreamAnsi = 2



Dim oDatabase

Set oDatabase = Session.Database



Dim View

Set View = oDatabase.OpenView("SELECT * FROM Binary
WHERE Name = '" & BinaryName & "'")

View.Execute



Dim Record

Set Record = View.Fetch

Dim BinaryData



BinaryData = Record.ReadStream(2, Record.DataSize(2),
msiReadStreamAnsi)



Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject")

Dim Stream

Set Stream = FSO.CreateTextFile(OutputFile, True)

Stream.Write BinaryData

Stream.Close

Set FSO = Nothing

End Function



Function ExtractIcon(IconName, OutputFile)

Const msiReadStreamAnsi = 2



Dim oDatabase

Set oDatabase = Session.Database



Dim View

Set View = oDatabase.OpenView("SELECT * FROM Icon WHERE
Name = '" & IconName & "'")

View.Execute



Dim Record

Set Record = View.Fetch

Dim BinaryData



BinaryData = Record.ReadStream(2, Record.DataSize(2),
msiReadStreamAnsi)



Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject")

Dim Stream

Set Stream = FSO.CreateTextFile(OutputFile, True)

Stream.Write BinaryData

Stream.Close

Set FSO = Nothing

End Function



Sub SExecute(Command)



Dim oShell

Set oShell = CreateObject("Wscript.Shell")



Dim oExec : oExec = oShell.Run(Command,0,True)



Set oShell = nothing



End Sub



Function CleanFile(File)



Dim oShell

Set oShell = CreateObject("Wscript.Shell")



Command = "cmd /c del /F /Q " & File



Dim oExec : oExec = oShell.Run(Command,0,True)



Set oShell = nothing



End Function







..



REGI
ONISEMPTY="Yes" And NOT REMOVE = "ALL" And Not Installed







REGI
ONISEMPTY="Yes" And NOT REMOVE = "ALL" And Not Installed





--

Sincèrement,

Gabriel







Le Mar 03 Septembre 2013, à 14:41, ak m a écrit :

custom action during install...





On Tue, Sep 3, 2013 at 5:46 PM, Christopher Painter

<[1]chr...@iswix.com>wrote:



Is this for an application extracting a resource or for a custom action

during an install?





From: "ak m" <[2]wixak...@gmail.com>

Sent: Monday, September 02, 2013 7:21 AM

To: "General discussion for Windows Installer XML toolset."

<[3]wix-users@lists.sourceforge.net>

Subject:

Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-03 Thread ak m
custom action during install...


On Tue, Sep 3, 2013 at 5:46 PM, Christopher Painter wrote:

> Is this for an application extracting a resource or for a custom action
> during an install?
>
> 
>  From: "ak m" 
> Sent: Monday, September 02, 2013 7:21 AM
> To: "General discussion for Windows Installer XML toolset."
> 
> Subject: [WiX-users] Extract Binary file from MSI to Temp folder using C#
>
> Dear All,
>
> Code to Extract Binary file from MSI to Temp folder using C#
>
> Anyone Plz help me on this?
>
> Thanks in Advance...
>
> Anil
>
> 
> --
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft
> technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>
>
> ___
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> --
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> ___
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-03 Thread Christopher Painter
Is this for an application extracting a resource or for a custom action 
during an install?


 From: "ak m" 
Sent: Monday, September 02, 2013 7:21 AM
To: "General discussion for Windows Installer XML toolset." 

Subject: [WiX-users] Extract Binary file from MSI to Temp folder using C#

Dear All,

Code to Extract Binary file from MSI to Temp folder using C#

Anyone Plz help me on this?

Thanks in Advance...

Anil

--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft 
technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk


___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-03 Thread ak m
Thank you...


On Mon, Sep 2, 2013 at 6:30 PM, Gabriel Ivanes  wrote:

> Hello,
>
>
>
> An example function in vbscript :
>
>
>
> Function ExtractBinary(BinaryName, OutputFile)
>
> Const msiReadStreamAnsi = 2
>
> Dim oDatabase
>
> Set oDatabase = Session.Database
>
> Dim View
>
> Set View = oDatabase.OpenView("SELECT * FROM Binary WHERE Name =
> '" & BinaryName & "'")
>
> View.Execute
>
> Dim Record
>
> Set Record = View.Fetch
>
> Dim BinaryData
>
> BinaryData = Record.ReadStream(2, Record.DataSize(2),
> msiReadStreamAnsi)
>
> Dim FSO
>
> Set FSO = CreateObject("Scripting.FileSystemObject")
>
> Dim Stream
>
> Set Stream = FSO.CreateTextFile(OutputFile, True)
>
> Stream.Write BinaryData
>
> Stream.Close
>
> Set FSO = Nothing
>
> End Function
>
>
>
> It might help.
>
>
>
> --
>
> Sincerely,
>
> Gabriel
>
>
>
>
>
>
>
>
>
> Le Lun 02 Septembre 2013, à 14:16, ak m a écrit :
>
> Dear All,
>
>
>
> Code to Extract Binary file from MSI to Temp folder using C#
>
>
>
> Anyone Plz help me on this?
>
>
>
>
>
> Thanks in Advance...
>
>
>
>
>
> Anil
>
> ---
> ---
>
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>
> Discover the easy way to master current and previous Microsoft
>
> technologies
>
> and advance your career. Get an incredible 1,500+ hours of step-by-step
>
> tutorial videos with LearnDevNow. Subscribe today and save!
>
> [1]http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg
> .clktrk
>
> ___
>
> WiX-users mailing list
>
> [2]WiX-users@lists.sourceforge.net
>
> [3]https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> --
> Sincèrement,
> Gabriel
>
> "I know no way of judging the future but by the past."
> Patrick Henry
> "You can never plan the future by the past."
> Edmund Burke
>
> References
>
> 1.
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> 2. mailto:WiX-users@lists.sourceforge.net
> 3. https://lists.sourceforge.net/lists/listinfo/wix-users
>
> --
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> ___
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-02 Thread Gabriel Ivanes
Hello,



An example function in vbscript :



Function ExtractBinary(BinaryName, OutputFile)

Const msiReadStreamAnsi = 2

Dim oDatabase

Set oDatabase = Session.Database

Dim View

Set View = oDatabase.OpenView("SELECT * FROM Binary WHERE Name =
'" & BinaryName & "'")

View.Execute

Dim Record

Set Record = View.Fetch

Dim BinaryData

BinaryData = Record.ReadStream(2, Record.DataSize(2),
msiReadStreamAnsi)

Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject")

Dim Stream

Set Stream = FSO.CreateTextFile(OutputFile, True)

Stream.Write BinaryData

Stream.Close

Set FSO = Nothing

End Function



It might help.



--

Sincerely,

Gabriel









Le Lun 02 Septembre 2013, à 14:16, ak m a écrit :

Dear All,



Code to Extract Binary file from MSI to Temp folder using C#



Anyone Plz help me on this?





Thanks in Advance...





Anil

---
---

Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!

Discover the easy way to master current and previous Microsoft

technologies

and advance your career. Get an incredible 1,500+ hours of step-by-step

tutorial videos with LearnDevNow. Subscribe today and save!

[1]http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg
.clktrk

___

WiX-users mailing list

[2]WiX-users@lists.sourceforge.net

[3]https://lists.sourceforge.net/lists/listinfo/wix-users



--
Sincèrement,
Gabriel

"I know no way of judging the future but by the past."
Patrick Henry
"You can never plan the future by the past."
Edmund Burke

References

1. http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
2. mailto:WiX-users@lists.sourceforge.net
3. https://lists.sourceforge.net/lists/listinfo/wix-users
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


[WiX-users] Extract Binary file from MSI to Temp folder using C#

2013-09-02 Thread ak m
Dear All,

Code to Extract Binary file from MSI to Temp folder using C#

Anyone Plz help me on this?


Thanks in Advance...


Anil
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users