[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to create auto-installer to register DLL on user Windows PCs

Posted on 2007-10-03
25
Medium Priority
?
291 Views
Last Modified: 2013-12-04
I need to find the most elegant solution for auto-installing a DLL (including registering it) on a user's PC. This would be invoked thorugh the user clicking a link (e.g. myDLL.exe).

All the target systems will be Windows: NT, 2000, XP or Vista.

I've looked at a few open source installers (like SEAU) and don't have time/budget to get InstallShield or Wise today. Is there a way perhaps using Microsoft SDK that's straightforward, or creating an MSI?

This particular issue is a brand new foray for me, so go easy :)

KC.
0
Comment
Question by:TangoGirl
  • 11
  • 10
  • 3
  • +1
25 Comments
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20005671
An easy and cheap way is to create a small batch file to do the job.
In the next example, I will copy your DLL to the Common Files\TangoGirl (probably in C:\Program Files) folder and register it:


@echo off
md "%CommonProgramFiles%\TangoGirl"
copy myDLL.DLL "%CommonProgramFiles%\TangoGirl"
regsvr32 "%CommonProgramFiles%\TangoGirl\myDLL.DLL"


Save this file as install.bat and copy it to the installation directory where your DLL resides.
Now just run it to install.

I hope this helps!
0
 
LVL 4

Expert Comment

by:zcrammond
ID: 20005695
your best bet and by far your easiest bet is a simple batch file:

dll installer.bat
xcopy "<location of dll>" "<location you want the DLL to be in" /y /r
regsvr32 "<location of dll which has been copied>"

replace <location of dll> with the source location (a shared location on a network or within the same directory the bat file will run from)

replace <location you want the dll to be in> with the destination of the dll (system32 directory)

replace <location of dll which has been copied> with the same location as above

This will copy the dll to whichever location you want it to go to and then register it

EXAMPLE:

xcopy "\\server1\dll\mydll.dll" "c:\windows\system32\" /y /r
regsvr32 "c:\windows\system32\mydll.dll!"

0
 
LVL 29

Expert Comment

by:Alan Huseyin Kayahan
ID: 20005701
   Hi TangoGirl
         Create a folder and copy the dll into it. Lets say that its xxx.dll
         Create a batch file with following commands in it

         copy xxx.dll c:\%windir%\system32
         regsvr32 xxx.dll

        As you double-click that bat file, dll will be installed and registered. You can share that folder and install from other clients

Regards
       
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:zcrammond
ID: 20005702
lol ruben, you beat me to it!!
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20005735
LOL, indeed! But it's nice to know everyone agrees with me ;-)
0
 

Author Comment

by:TangoGirl
ID: 20005856
sounds along the right lines... but how would I make this available via a web page - i.e. I can't link to the .bat file
0
 

Author Comment

by:TangoGirl
ID: 20005861
..oops :)

I was assuming that you can't just link to a .bat file from a hyperlink?

KC.
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20005888
Can you zip the file and offer it as a download on your website?
0
 
LVL 4

Expert Comment

by:zcrammond
ID: 20005955
you will be able to link to the bat file, it will prompt the users to download the file and open it, once opened it will run.

So you will need to make sure that wherever the users will be downloading the bat file to, they will be able to access the UNC path when it opens :)
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20006039
It works in an intranet environment; if the product is intended for external customers, your best bet is to offer it as a zip file.
0
 

Author Comment

by:TangoGirl
ID: 20006175
I'm trying to make it as easy as possible for our non-tech customers. So thought exe was the best bet, rather than giving complex install instructions. WIll run some testing on the BAT now - cheers guys.
0
 
LVL 12

Accepted Solution

by:
RubenvdLinden earned 2000 total points
ID: 20006256
With PowerArchiver (http://www.powerarchiver.com), you can turn a zip file to a self extracting exe file and specify a command to run after the extraction, e.g. the install.bat I created for you. This is very easy for your customers.

Other zip programs (like WinZIP) probably have the same kind of functionality.
0
 

Author Comment

by:TangoGirl
ID: 20006433
I thought about a self-extracting file, but was missing the BAT bit :) Thanks Ruben will give this a try.
0
 

Author Comment

by:TangoGirl
ID: 20006488
So... just to recap so I understand the process...

- create batch file with install commands
- create self-extracting archive containing DLL & BAT (with instruction to run BAT after extracting)

KC.
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20006544
That is correct.
0
 

Author Comment

by:TangoGirl
ID: 20006649
just literally: run install.bat ?
0
 

Author Comment

by:TangoGirl
ID: 20006670
it'll have to be relative, right, so how will i determine the correct variable for common program files - i.e.

run %CommonProgramFiles%??\myinstall_directory\install.bat

i think i'm nearly there...!
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20006743
Most self-extractors automatically assume that the working directory of the program to run should be the directory where the files are to be extracted. In that case, running install.bat should be enough to get things done.

If it doesn't, there is probably a simple solution:
You should be able to specify a default output directory for the self-extractor. Specify %TEMP%
Now, change the copy statement in install.bat like this:

copy "%TEMP%\myDLL.DLL" "%CommonProgramFiles%\TangoGirl"


I hope this helps
0
 

Author Comment

by:TangoGirl
ID: 20006799
that's could be a solution i think, as it's having a problem running the command following extraction.

My other issue is not having admin rights to the program files dir of my own machine, which I can safely assume will also happen with lots of my users.

So I'm going for c:\myinstalldir\ instead. Do you foresee any issues with this? And is there a more elegant way of referencing this using environment vars, as I realise hard-coding c: is a risky strategy?
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20006894
You could use %SYSTEMDRIVE% to find the disk where Windows resides.
I would recommend %USERPROFILE% though (this will return e.g. C:\Documents and Settings\TangoGirl).
However, installation without (at least some) admin rights is not possible. You might be able to copy the file to a user folder, but REGSVR32 really requires admin rights to register your DLL.
0
 

Author Comment

by:TangoGirl
ID: 20006914
yes - I've just come a cropper with this one ;) Can only get as far as REGSVR32 and then that's it.

I don't think there's away around this..nnnggg!
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20006992
The only thing you can do is to put an instruction on your website that the installation can only be performed by a system administrator or a user with administrative rights on the computer.

That way you can also specify the Common Files folder again, which is better. Come to think of it, it's not wise to store the DLL in a user folder; that way it will not be accessible for other users of the computer.
0
 

Author Comment

by:TangoGirl
ID: 20007162
Yes fair comment, did cross my mind.

Thanks Ruben you've been incredibly helpful :)

KC.
0
 
LVL 12

Expert Comment

by:RubenvdLinden
ID: 20007274
Your welcome, I'm glad I could be of help!
0
 

Author Comment

by:TangoGirl
ID: 20007791
related topic, & cheeky I know as I shoudl start a new q - but do you know of a simple way of determining whether the user has admin rights over their machine?

 I'm devising a test to determine this before I run the EXE to try to handle user experience a little better.
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question