Firebird custom installation - command-line

I want to deploy a firebird installation, and thus will launch it from my installer using command-line parameters. I read Inno Setup's documentation but still can't get it to work.
I just want to install a "Super server" with no documentation or whatsoever.
Here's what I have so far
Firebird-2.1.2.18118_0_Win32.exe /sp- /silent /SUPPRESSMSGBOXES /nocancel /noicons /components="Super Server binary"
But it won't install the server. If I remove the /components it does install the server but install other developer stuff, which customers don't need.

read installation_scripted.txt in C:\Program Files\Firebird\Firebird_2_1\doc
/COMPONENTS="comma separated list of
component names"
Choose from -
ServerComponent\SuperServerComponent,
ServerComponent\ClassicServerComponent,
ServerComponent,
DevAdminComponent and
ClientComponent
Overrides the default components
settings. Using this command line
parameter causes Setup to
automatically select a custom type. A
full install requires combining
components. For example:
/COMPONENTS="ServerComponent\SuperServerComponent,ServerComponent,DevAdminComponent,ClientComponent"
would be required for a full
install.

I use the following and it works fine, however I need to install to a custom directory and also change the server option
string installerFilePath = #"C:\BennaOlivier\Randoms\Delter\Firebird\FirebirdMainInstaller\MainInstaller\MainInstaller\Firebird X64\FirebirdInstallX64\Firebird-2.5x64.exe";
Process installerProcess = new Process();
installerProcess = Process.Start(installerFilePath, Arguments);
while (installerProcess.HasExited == false)
{
//indicate progress to user
Application.DoEvents();
System.Threading.Thread.Sleep(250);
}
}
catch (Exception FBX64)
{
MessageBox.Show(FBX64.Message);
throw;
}public const string comps = #"ServerComponent\ClassicServerComponent,ServerComponent,ClientComponent";
public const string Arguments = "/VERYSILENT /SUPPRESSMSGBOXES";

Related

How to include dlls in flutter build windows

I am working on a flutter project that runs fine in development.
However I do not know how to get the build to include dll's referenced using FFI.
I can't find clear instructions on how to do it.
I tried following the steps to build an msix here, which worked but didn't seem to include the dll (it fails in the same way as the regular build)
what is the procedure to have the build process consider the dll's?
other dll's show up in the build directory from 3rd party packages so there must be a way right?
That's really hard to discover by your own, but indeed you can bind those libraries to you MSIX. In my case I just made a package for label printers using Dart FFI and DLL`s provided by manufacturer and this is how I did it.
You need to add these DLL's to your assets setting on pubspec.yaml from your package. This is my case:
[...]
flutter:
[...]
assets:
- assets/WinPort.dll
- assets/Winppla.dll
- assets/Winpplb.dll
- assets/Winpplz.dll
With this setting you will embed your DLL files in your final MSIX, but this was the easy part. Now you have make sure to load the proper load these files in code.
Based on my own tests, I still dealing with two ways to develop and test code, the first one is when I am running a project in my machine via flutter run I must set the target for current.path, when I get it done and start building for deploy I change this to resolvedExecutable.parent.path. Where is what you need to do.
Loading you DLL in development environment (flutter run):
final String _packageAssetsDirPath = normalize(join(Directory.current.path,'assets'));
On production environment (running from .exe or MSIX installed):
final String _assetsPackageDir = normalize(
join('data', 'flutter_assets', 'packages', 'YOUR_PACKAGE_NAME', 'assets'));
final String _exeDirPath = File(Platform.resolvedExecutable).parent.path;
final String _packageAssetsDirPath =
normalize(join(_exeDirPath, _assetsPackageDir));
After with this var called _packageAssetsDirPath will be easy to load your DLL's, now you invoke a DynamicLibrary constructor:
// Path for DLL file
final String _libDllSourceFullPath =
normalize(join(_packageAssetsDirPath, 'Winppla.dll'));
// Target for copy, place DLL in same place the .exe you are running
final String _libDllDestFullPath =
normalize(join(_packageAssetsDirPath, 'YOUROWN.dll'));
// Try to copy for running exe path
File(_libDllSourceFullPath).copySync(_libDllDestFullPath);
// With this copy, would be simple to load, and if it fails, try in full path
// LOAD DLL
try {
String _packageAssetsDirPath =
normalize(join(Directory.current.path, 'assets'));
String _printerLibraryPath =
normalize(join(_packageAssetsDirPath, 'Winppla.dll'));
DynamicLibrary _library = DynamicLibrary.open(_printerLibraryPath);
return _library;
} catch (e) {
try {
DynamicLibrary _library = DynamicLibrary.open('Winppla.dll');
return _library;
} catch (e) {
// Avoing errors creating a fake DLL, but you could deal with an exception
return DynamicLibrary.process();
}
}
At this point you can load a DLL and use it, you can check my package full code at https://github.com/saviobatista/argox_printer check for lib/src/ppla.dart at function _setupDll() and you will see that loading.
I built a simpler option inspired in the solution of Sávio Batista
(You must have your .dll in your assets folder)
if (kReleaseMode) {
// I'm on release mode, absolute linking
final String local_lib = join('data', 'flutter_assets', 'assets', 'libturbojpeg.dll');
String pathToLib = join(Directory(Platform.resolvedExecutable).parent.path, local_lib);
DynamicLibrary lib = DynamicLibrary.open(pathToLib);
} else {
// I'm on debug mode, local linking
var path = Directory.current.path;
DynamicLibrary lib = DynamicLibrary.open('$path/assets/libturbojpeg.dll');
}
Just replace libturbojpeg.dll for your .dll

DB2 with .NET Core 2.1

I installed IBM.Data.DB2.Core Version (1.2.2.100) with Visual Studio 2017 & .Net Core 2.1. I was trying to test simple DB2 (z/OS server) connection and getting the below error. Our DB2 Server type is OS390 and version is 11.
ERROR [42968] [IBM] SQL1598N An attempt to connect to the database server failed because of a licensing problem.
using (DB2Connection con = new DB2Connection("Server=xxxx.xxxx.com:446;Database=XXXX;UID=XXXXXX;PWD=xxxxx"))
{
try
{
con.Open();
}
catch (Exception ex)
{
throw ex;
}
}
Also I copied the license file to .nuget\packages\ibm.data.db2.core\1.2.2.100\build\clidriver\license folder.
I tried everything mentioned here:
https://www.ibm.com/developerworks/community/blogs/96960515-2ea1-4391-8170-b0515d08e4da/entry/Instructions_for_downloading_and_using_DB2_NET_Core_provider_package?lang=en
Any thoughts?
Spent a few hours on this and here is what worked for me using current latest version of the package 1.3.0.100 and a valid DB2 11.1 license I already had installed. I suspect this approach will work on 1.1 and 1.2 as well, assuming you have the license already.
Add the following block to your project file, adjusting the path for DB2License as necessary for your local setup:
<ItemGroup>
<DB2License Include="C:\ProgramData\IBM\DB2\{FOLDER NAME THAT VARIES BY INSTALL}\license\**\*.*"/>
</ItemGroup>
<Target Name="CopyFiles" AfterTargets="AfterBuild">
<Copy SourceFiles="#(DB2License)" DestinationFolder="$(OutDir)\clidriver\license\" />
</Target>
The important part seems to be that $(OutDir)\clidriver\license\ has all files necessary to represent a valid DB2 11.1+ license before your application runs. For me there were 3 files. For server build and release, a slightly more complex setup may be necessary to get the correct files to the expected location.
Here are other things I tried that did not seem to help for me, but may help for others:
Some articles on IBM's site suggest adding %userprofile%\.nuget\packages\IBM.Data.DB2.Core\<version>\build\clidriver\bin or %userprofile%\.nuget\packages\IBM.Data.DB2.Core\<version>\build\clidriver\license to your PATH environment variable. This seems to be completely unnecessary.
Other articles or forum posts suggest copying your license files to the nuget package license folder %userprofile%\.nuget\packages\IBM.Data.DB2.Core\<version>\build\clidriver\license. This worked, but isn't ideal since it needs to be done on each machine after nuget package restore and then re-done if you change versions of the nuget package later on. And of course none of the places mentioning "hey just copy the license to this path" specified the default directory that contains your existing license: C:\ProgramData\IBM\DB2\{FOLDER NAME THAT VARIES BY INSTALL}\license\.
IBM DB2 Nuget package for .net core version 1.1 & 1.2 comes with DB2 Driver version 11. These two packages doesn't support if you have DB2 version less than 11. Here are the steps to resolve this issue.
Install IBM DB2 Nuget package version 1.0
Update your environment PATH variable with 1.0 installation path
Remove/Un-install any other DB2 driver installed on your machine
Close your Visual studio version and reopen it, it will work without any issue.
Also, 1.0 version doesn't require the license file. Hope this helps.
You can use this tutorial
https://www.ibm.com/support/knowledgecenter/SSFMBX/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting__net_applications.html
/CODE EXAMPLE/
using System;
using IBM.Data.DB2;
namespace dotNetSSLTest
{
class Program
{
static void Main(string[] args)
{
DB2Command MyDB2Command = null;
// Use the dsn alias that you defined in db2dsdriver.cfg with the db2cli writecfg command in step 1.
String MyDb2ConnectionString = "database=alias;uid=userid;pwd=password;";
DB2Connection MyDb2Connection = new DB2Connection(MyDb2ConnectionString);
MyDb2Connection.Open();
MyDB2Command = MyDb2Connection.CreateCommand();
MyDB2Command.CommandText = "SELECT branch_code, city from GOSALES.BRANCH";
Console.WriteLine(MyDB2Command.CommandText);
DB2DataReader MyDb2DataReader = null;
MyDb2DataReader = MyDB2Command.ExecuteReader();
Console.WriteLine("BRANCH\tCITY");
Console.WriteLine("============================");
while (MyDb2DataReader.Read())
{
for (int i = 0; i <= 1; i++)
{
try
{
if (MyDb2DataReader.IsDBNull(i))
{
Console.Write("NULL");
}
else
{
Console.Write(MyDb2DataReader.GetString(i));
}
}
catch (Exception e)
{
Console.Write(e.ToString());
}
Console.Write("\t");
}
Console.WriteLine("");
}
MyDb2DataReader.Close();
MyDB2Command.Dispose();
MyDb2Connection.Close();
}
}
}

Installing an exe with Powershell DSC Package resource gets return code 1619

I'm trying to use Powershell DSC's Package resource to install an exe... Perforce's P4V to be specific. Here's my code:
Configuration PerforceMachine
{
Node "SERVERNAME"
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "\\nas\share\p4vinst64.exe"
ProductId = ''
Arguments = "/S /V/qn" # args for silent mode
LogPath = "$env:ProgramData\p4v_install.log"
}
}
}
When running this, this is the error Powershell gives me:
PowerShell provider MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: The return code 1619 was not expected. Configuration is likely not
correct
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : SERVERNAME
According to documentation, return code 1619 means the MSI package couldn't be opened. However, when I manually log in to the machine and run "\\nas\share\p4vinst64.exe /S /V/qn", the install works flawlessly.
Does anyone know why this is failing? Alternately, can anyone tell me how to troubleshoot this? I pasted all the error information I got from the terminal, my log file (p4v_install.log) is a 0 byte file, and there are no events in the event viewer. I don't know how to troubleshoot it any further!
EDIT: I should note that I also tried using the File resource to copy the file locally, and then install it from there. Sadly, that met with the same result.
Daniel over at the Powershell.org forums was able to figure this out for me.
The P4V InstallShield setup wrapper puts the MSI file into wrong path if you execute as LocalSystem.
I’ve managed to develop a Configuration that works, see below. The key is the /b switch here which puts the MSI file into a defined location. I’ve added ALLUSERS=1 to get the shortcuts visible to all users and REBOOT=ReallySuppress to avoid a sudden restart (which will happen otherwise).
Configuration PerforceMachine
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "C:\My\p4vinst64.exe"
ProductId = ''
Arguments = '/b"C:\Windows\Temp\PerforceClient" /S /V"/qn ALLUSERS=1 REBOOT=ReallySuppress"' # args for silent mode
}
}
Well, what happens here is that the package gets installed (not tested with p4vinst64.exe yet! So, not sure why it says pack cannot be opened as the error) but since you did not specify a ProductID value, the verification at the end of install fails. That is the error you are seeing. The Package resource is no good for installing .exe packages or even MSIs with no ProductID represented as a GUID.
You can use the WindowsProcess resource instead.

Why did SQL Server Management Studio 2008 command-line switches stop working?

I've always relied heavily on Windows shortcuts to SSMS that include command-line switches allowing me to quickly open up a specific database on a specific server. For example
Ssms.exe -S 123.123.123.123 -U sa -P goodpassword -d DbName
or
Ssms.exe -S . -E -d DbName
These suddenly stopped working. I get this error from SSMS:
Failed to create new SQL Server script.
Object reference not set to an instance of an object. (AppIDPackage)
Program Location: at Microsoft.SqlServer.Management.UI.VSIntegration.
AppIDPackage.AppIDPackage.OpenConnectionDialogWithGlobalConnectionInfo()
I can still launch SSMS without the command-line switches, and then manually establish the connections. Some command-line switches still work, for example
ssms.exe -nosplash
works fine.
I get the same error with any combination of the -S, -E, and -d command-line switches. It doesn't matter if I'm pointing to a valid server or database or not, or if my login credentials are good or not. I can point to the older version of SSMS and it works fine, but not the 2008 version.
This post on MSDN's forums is all I've found online, but MS hasn't been very helpful on this thread.
Any ideas how I might start to fix this? I work with a lot of different databases on different servers, and I really rely on these shortcuts.
I've thrown the DLL in question at reflector and it's given me back the code at the bottom of this post, sadly there's nothing immediately obvious in the code that makes it easy to work out why it's stopped working for you (wouldn't it be nice if Microsoft shipped debug symbols with anything they produce that's written against the CLR?).
There are a couple of places where the code makes me wonder if you might have a corrupted "recently used servers" list or something similar, perhaps you could try following the steps listed in this question to clear them out and see if that helps.
private void OpenConnectionDialogWithGlobalConnectionInfo()
{
if ((ServiceCache.GlobalConnectionInfo != null) && (ServiceCache.GlobalConnectionInfo.Count != 0))
{
try
{
using (ConnectionDialog dialog = new ShellConnectionDialog())
{
IDbConnection connection;
dialog.ImportRegisteredServersOnFirstLaunch = true;
dialog.AddServer(new SqlServerType());
UIConnectionInfo connectInfo = ServiceCache.GlobalConnectionInfo[0].Copy();
if (dialog.TryToConnect(this.PopupOwner, ref connectInfo, out connection) == DialogResult.OK)
{
this.ScriptFactory.CreateNewBlankScript(ScriptType.Sql, connectInfo, connection);
}
}
}
catch (Exception exception)
{
ExceptionMessageBox box = new ExceptionMessageBox(new ApplicationException(SRError.FailedToCreateNewSqlScript, exception));
box.Caption = SRError.MessageBoxCaption;
box.Show(this.PopupOwner);
}
}
ServiceCache.GlobalConnectionInfo = null;
}
The ObjectExplorer window must be open. Don't hide.
I solved my problem this way :)
Works fine like this:
sqlwb.exe -S . -E -d dbName
I'm using SSMS2008 against a SQL2005 database, and the ssms command line works fine here.
This is the version info produced by the SSMS About dialog:
Microsoft SQL Server Management Studio 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
Microsoft Data Access Components (MDAC) 6.0.6001.18000 (longhorn_rtm.080118-1840)
Microsoft MSXML 2.6 3.0 5.0 6.0
Microsoft Internet Explorer 8.0.6001.18813
Microsoft .NET Framework 2.0.50727.3074
Operating System 6.0.6001
There are several sources (MSSqlTips, and here) that state the command line arguments are available on sqlwb.exe. Yet the Books Online page for ssms states that the options are available on ssms.

How to check if a file has a digital signature

I'd like to check programatically if a file has been digitally signed or not.
For the moment, I found a rather obscure Microsoft code, that doesn't compile...
Any idea on the subject?
An external tool with command line would also be great, by the way.
The important missing part of the answer mentioning signtool is:
Yes, with the well known signtool.exe you can also find out, if a file is signed. No need to download another tool!
E.g. with the simple line:
signtool verify /pa myfile.exe
if %ERRORLEVEL% GEQ 1 echo This file is not signed.
(For verbose output, add a /v after /pa.)
One may ask: Why this is important? I just sign the files (again) which shall be signed and it works.
My objective is to keep builds clean, and don't sign files a second time because not only the date is changed, but the is binary different after that.
Business example:
My client has a streamlined automated "dev ops" kind build and post build process. There are multiple sources for different file sets, and at the end all is build, tested and bundled to distribution- and for that some files have to be signed. To guarantee that some files don't leave the unit without being signed, we used to sign all important files found on the media, even if they were already signed.
But this hasn´t been clean enough ! Generally:
If we sign a file again, which is already signed, the file date and binary fingerprint changes, and the file looses comparability with it's sources, if it was simply copied.
(At least if you sign with a timestamp, which we always do and I think is highly recommended.)
This is a severe quality loss, because this file is no longer identical to it's predecessors although the file itself has not changed.
If we sign a file again, this also could be a fault when it is a third party file which shouldn't be signed by our company.
You can avoid both by making the signing itself conditional depending on the return code of the preceding signtool verify call mentioned.
Download Sigcheck and use the following command.
sigcheck.exe -a -u -e
An example of a signed dll
File version: 0.0.0.0
Strong Name: Signed
An example of an unsigned dll
File version: 0.0.0.0
Strong Name: Unsigned
Sigcheck is a command-line utility that shows file version number. Good Luck
I found another option (pure .NET code) on the web here.
The code is very simple and works.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string filePath = args[0];
if (!File.Exists(filePath))
{
Console.WriteLine("File not found");
return;
}
X509Certificate2 theCertificate;
try
{
X509Certificate theSigner = X509Certificate.CreateFromSignedFile(filePath);
theCertificate = new X509Certificate2(theSigner);
}
catch (Exception ex)
{
Console.WriteLine("No digital signature found: " + ex.Message);
return;
}
bool chainIsValid = false;
/*
*
* This section will check that the certificate is from a trusted authority IE
* not self-signed.
*
*/
var theCertificateChain = new X509Chain();
theCertificateChain.ChainPolicy.RevocationFlag = X509RevocationFlag.ExcludeRoot;
/*
*
* Using .Online here means that the validation WILL CALL OUT TO THE INTERNET
* to check the revocation status of the certificate. Change to .Offline if you
* don't want that to happen.
*/
theCertificateChain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
theCertificateChain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0);
theCertificateChain.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;
chainIsValid = theCertificateChain.Build(theCertificate);
if (chainIsValid)
{
Console.WriteLine("Publisher Information : " + theCertificate.SubjectName.Name);
Console.WriteLine("Valid From: " + theCertificate.GetEffectiveDateString());
Console.WriteLine("Valid To: " + theCertificate.GetExpirationDateString());
Console.WriteLine("Issued By: " + theCertificate.Issuer);
}
else
{
Console.WriteLine("Chain Not Valid (certificate is self-signed)");
}
}
}
Since PowerShell 5.1, you can use Get-AuthenticodeSignature to verify the signature of a binary or a PowerShell script.
> Get-AuthenticodeSignature -FilePath .\MyFile.exe
SignerCertificate Status Path
----------------- ------ ----
A59E92E31475F813DDAF41C3CCBC8B78 Valid MyFile.exe
Or
> (Get-AuthenticodeSignature -FilePath .\MyFile.exe).Status
Valid
If you need an external tool, you can use signtool.exe. It is part of the Windows SDK, it takes command line arguments, and you can find out more about it here, http://msdn.microsoft.com/en-us/library/aa387764.aspx
Also you can try to use npm package sign-check for that purposes.
This package implements WinVerifyTrust API and has simple usage:
npm install -g sign-check
sign-check 'path/to/file'
Select the <*>.exe rightclick >properties. if the file is signed then you will get this tab on the property windows of that file.