MSI.RecordReadStream |
|
|
|
MSI.RecordReadStream |
|
|
|
|
||
OverviewExamples
hDatabase = MSI.GetActiveDatabase(_hInstall);
if (hDatabase ~= 0) then
strQuery = "SELECT * FROM `Binary` WHERE `Name`='Icon_Exclamation'";
hView = MSI.DatabaseOpenView(hDatabase, strQuery);
if (hView ~= 0) then
bExecuteResult = MSI.ViewExecute(hView, 0);
if (bExecuteResult) then
hRecord = MSI.ViewFetch(hView);
if (hRecord ~= 0) then
-- Read the Icon binary stream
strStream = MSI.RecordReadStream(hRecord, 2);
-- Did the MSI.RecordReadStream() work?
if (strStream ~= nil) then
-- Create a new binary file for writing
hFile, strError = io.open("C:\\my_new_icon.ico", "wb")
if (hFile ~= nil) then
-- Write the binary data to disk
hFile:write(strStream)
-- Close the file
hFile:close()
else
-- Error
Dialog.Message("Error", "Failed to write file:\r\n"..strError)
end
end
end
MSI.CloseHandle(hRecord);
else
Dialog.Message("Execute Failed", "Execute Failed.");
end
MSI.ViewClose(hView);
MSI.CloseHandle(hView);
else
Dialog.Message("View Error","View Failed.");
end
MSI.CloseHandle(hDatabase);
end
Reads an icon file's binary data from the Binary table and writes it out to a file on the C: drive.
See also: Related Actions
Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us