🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11023

Re: Problems writing boot record to removable media under WinME

#11023
From: Bob Gonder
Date: Thu, 04 Mar 2004 19:13
52 lines
2723 bytes
Walt Morrey wrote:

>//------------------------------------------------------------------
>BOOL WriteSectors(int drive, DWORD startinglogicalsector, int numberofsectors, char*buffer)
>{
>       hDevice = CreateFile(_devicename,
>             GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
>             NULL, OPEN_EXISTING, 0, NULL);

Once again I'll ask:  Are you going to Write to this "file" or just
Read it?  If you are going to write to it, why are you opening it in
read-only mode?


Comparing Write code vs Read code:

Write:
>       reg.reg_ESI = 0x0001 ;          // for write BOOT
>       reg.reg_ECX = -1 ;
>       reg.reg_EBX = (DWORD)(&ControlBlock);
>       reg.reg_EDX = drive+1;
>       reg.reg_EAX = 0x7305 ;
>
>       fResult = DeviceIoControl ( hDevice, VWIN32_DIOC_DOS_DRIVEINFO,
>          &(reg), sizeof (reg),
>          &(reg), sizeof (reg),
>          &cb,0);
>

Read:
>   reg.reg_Flags = 0x8000;

Flags is different

>   reg.reg_ESI = 0x00 ;
>   reg.reg_ECX = -1 ;
>   reg.reg_EBX = (DWORD)(&ControlBlock);
>   reg.reg_EDX = drive+1;
>   reg.reg_EAX = 0x7305 ;
>
>   fResult = DeviceIoControl ( hDevice,
>     6,

6 is different (maybe not, but why invite errors?)

>     &(reg),
>     sizeof (reg),
>     &(reg),
>     sizeof (reg),
>     &cb,
>     0);
>
Technical Details
Message-ID: <utue40l80bi4l3lnphfvsh70vmeth63lr4@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40437604@newsgroups.borland.com> <404380f3$1@newsgroups.borland.com> <40439482$1@newsgroups.borland.com> <40439fa5$1@newsgroups.borland.com> <4043a4e7$1@newsgroups.borland.com> <4043ae8f$2@newsgroups.borland.com> <4043b610@newsgroups.borland.com> <kbs7409ien56crro53tr9i26s1p6n3cv44@4ax.com> <404408ea$1@newsgroups.borland.com> <4046725d@newsgroups.borland.com> <4046860c$1@newsgroups.borland.com> <404729a6@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5a57fca3b977b3f5
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-04 11:40:43 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Problems writing boot record to removable media under WinME
Date: Thu, 04 Mar 2004 11:13:22 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <utue40l80bi4l3lnphfvsh70vmeth63lr4@4ax.com>
References: <40437604@newsgroups.borland.com> <404380f3$1@newsgroups.borland.com> <40439482$1@newsgroups.borland.com> <40439fa5$1@newsgroups.borland.com> <4043a4e7$1@newsgroups.borland.com> <4043ae8f$2@newsgroups.borland.com> <4043b610@newsgroups.borland.com> <kbs7409ien56crro53tr9i26s1p6n3cv44@4ax.com> <404408ea$1@newsgroups.borland.com> <4046725d@newsgroups.borland.com> <4046860c$1@newsgroups.borland.com> <404729a6@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.165.212
X-Trace: newsgroups.borland.com 1078427598 67.31.165.212 (4 Mar 2004 11:13:18 -0800)
Lines: 53
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail