Reverse engineer a closed source application that connects to sql server

One of my friends have a closed source exe program written using .Net framework, this program connects to an sql server and search for records in multiple databases, unfortunately my friend wiped the computer and all he did was backup the .exe file and the database files (.mdf and .ldf) files.

Now I want to get the program working again by setting up the same environment as before he wiped the hard disk by installing sql server and importing the database

The problem is that sql connection information are hardcoded in the .exe file and I need them to set my sql server, what I did is that I used Strings program from sysinternals and search for any clues about the connection information and I found these:

Provider=SQLOLEDB.1;Password=password@$%#$245;Persist Security Info=True;User ID=sa;Initial Catalog=twist;Data Source=pc
EData Source=pc;Initial Catalog=allinfo;User ID=sa;Password=password@$%#$245

so if I understand correctly the information are as follows:

database=twist and allinfo

so I need to install sql server and set the user name and password as above and the instance name as pc ?

well I tried that and the program is still crashing when trying to connect to the sql server. So I have a couple of questions:

1- can I know the version of sql server that the program used to connect to (in case I installed the wrong version)?

2- Is the password that I got from the strings program encrypted and should not be used directly to setup sql server?

3- is my use of the above information correct ? some sources state that "Data Source" refers to the hostname not the instance!

How can I setup sql server to exactly accept connections from the program using the information above?

This is what I came up with

The errors I get are as follows

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The sercer was not found or was not accessible. Verify that the instanc ename is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider,error:40 - Could not open a connection to SQL Server)


See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at censored.Module1.insertincombo2013(String sql, String table, DataGridView dgv)
   at censored.2013.Button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
    Assembly Version:
    Win32 Version: 2.0.50727.8800 (QFE.050727-8800)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
    Assembly Version:
    Win32 Version:
    CodeBase: file:///C:/Users/mohammad/Desktop/betaqa/id.exe
    Assembly Version:
    Win32 Version: 8.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/
    Assembly Version:
    Win32 Version: 2.0.50727.8791 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/
    Assembly Version:
    Win32 Version: 2.0.50727.5491 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/
    Assembly Version:
    Win32 Version: 2.0.50727.5495 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/
    Assembly Version:
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/
    Assembly Version:
    Win32 Version: 2.0.50727.8773 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/
    Assembly Version:
    Win32 Version: 2.0.50727.8771 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/
    Assembly Version:
    Win32 Version: 2.0.50727.8762 (QFE.050727-8700)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Data/
    Assembly Version:
    Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Transactions/

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the section.
The application must also be compiled with debugging

For example:

    < jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

PS:I'm a linux superuser and not a windows user that's why I know very little about Microsoft sql server and windows in general,I have experience in mysql but never used MS sql server before but I wanted to help my friend and I got blocked by my little knowledge.


pc will be the name of the server and the instance will be the default.
You can create an alias for the server (haven't done it for a while).

I would look to see if there is some sort of config file or ini file (not sure how old the application is. I can't imagine they would hardcode all that in an exe

I have made an alias and the program still doesn't connect

There is not configuration files, I'm sure of that,only one single exe file.

one thing that caught my attention in the connection string is this

what does the number signify?maybe it can help identify the server version ?


a version of SQLOLEDB

which leads me to believe you might be missing some MDAC/WDAC installations for SQLOLEDB.1. Are you running this on a personal pc or server?

Hi, sorry for the late reply
I'm running this inside a windows 7 virtual machine, do I need to setup a windows server machine ? if so which version do you recommend?

Just install the mac stuff and try

I installed every driver I can find, I couldn't find a link for "SQLOLEDB" since Microsoft docs site says it deprecated.