Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 24th, 2005, 5:04 PM   #21
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by anant_tickoo
can i do this without the dlls grumpy
Short answer is it is technically possible, but not a particularly good idea.

The longer answer is that, to access the parallel port from user code, you need the help of a kernel mode driver. That kernel mode driver is normally represented by a .sys file which is installed into your system, and typically requires registration as a windows service (via the SCM : Service Control Manager). The act of installation requires administrative privileges.

While you can take all that out of DLL's (eg inpout32.dll installs a hardware driver named hwinterface.sys if necessary --- IF it is used by a program run by a user with administrator privileges). The catch is that taking the functionality out of the DLL requires you to put that functionality into every program that would otherwise use that DLL --- which is not a good idea as it is easier for a programmer to forget one or more essential steps.

The way I usually handle this is to write my program so it uses the DLL (eg via LoadLibrary() and related functions), and also to pack my program and the DLL into an installer. The installer, when run, insists on having administrator privilege and places the DLL where it needs to go and loads it once --- which installs the kernel mode driver.

Needing to distribute programs that require this sort of thing teaches one the value of installer software, such as Inno Setup or NSIS. With either of these programs (and presumably with other ones out there) you create a script which checks it is run by an administrator, installs your application, installs the DLL, and then does the necessary tricks to ensure the kernel mode driver is installed.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC