[comp.windows.ms.programmer] copying files within windows

rkt@bjcong.bj.co.uk (RAKESH TANDON) (03/07/91)

I'm about to write a windows installation program and would like
to know the best way of copying files from floppy disk to hard disk.

The files will be .exe's, .dll's and some text file

Also is there any way of creating a .GRP file other than via program manager
ie within a windows program.

Thanks

-- 
Rakesh Kumar Tandon 	            : email   : rkt@bj.co.uk
Boldon James Limited	            : phone   : 0260 280465
Damian House, West Street           : fax     : 0260 298030
CONGLETON, Cheshire                 : UUCP    : ..!mcsun!ukc!pyrltd!bjcong!rkt

spolsky-joel@cs.yale.edu (Joel Spolsky) (03/09/91)

In article <1157@bjcong.bj.co.uk> rkt@bjcong.bj.co.uk (RAKESH TANDON) writes:
>I'm about to write a windows installation program and would like
>to know the best way of copying files from floppy disk to hard disk.
>
>The files will be .exe's, .dll's and some text file
>
>Also is there any way of creating a .GRP file other than via program manager
>ie within a windows program.


Get the Windows Developers' Notes from Microsoft. They cost $20 and
include some source code for writing a setup program, including
copying files with a progress indicator, and telling the Program
Manager via DDE to add new items.

--
Joel Spolsky          // And these streets, Quiet as a sleeping army
spolsky@cs.yale.edu   // Send their battered dreams to heaven.   _Paul Simon

awd@dbase.A-T.COM (Alastair Dallas) (03/22/91)

In article <1157@bjcong.bj.co.uk>, rkt@bjcong.bj.co.uk (RAKESH TANDON) writes:
> I'm about to write a windows installation program and would like
> to know the best way of copying files from floppy disk to hard disk.

The best way is to allocate as large a buffer as you can, and:

	/* software wheel #319 */
	while (filsiz > 0)
		{
		this = MIN(filsiz, bufsiz);
		read( 'this' many bytes );
		write( 'this' many bytes );
		filsiz -= this;
		}

'This' will be bufsiz until the last time.  'Bufsiz' should be a multiple
of 512.  You can get very fancy and request device parameters for the
disk(s) you're dealing with.  Ideally, you'd like to read and write
whole cylinders at a time, but it's not an ideal world--you might
spend so long thinking about it that you delay the overall performance.
Bufsiz's of 16k, 32k or 48k copy files very nicely.  Note that this
basic loop can handle splitting large files across several floppies--
just don't close the output file.

As an alternative, you could WinExec command.com and 'copy', which is 
a highly optimized command.  Or, you could do your installation as a .bat
file the way a lot of people do :-).

Hope it helps.

/alastair/

-- 
|Disclaimer: I am speaking for myself, not as a spokesman for Ashton-Tate,
|which does not monitor my outbursts here.  I reserve all rights to my
|opinions in terms of commercial endorsements.