🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Unexpected Access Violation when calling WriteFile()

#13235
From: Bob Gonder
Date: Tue, 21 Oct 2003 17:09
20 lines
1746 bytes
Fernando wrote:

>I'm trying to extract a resource from my exe and then save it to a file.  When
>I try to save it, I get an access violation.  :-?
>
>I suspect the culprit is my usage of the API function WriteFile(), but I'm not

You are right.  What is the type of bytesWritten and where is the
value stored? That is, when WriteFile places the count of bytes
actually written, where is that value going? Use the debugger to see
what you are actually passing to WriteFile as the address.

>  bool writeToFile( HANDLE aFileHandle, void * data,  DWORD numOfBytes )
>  {
>    LPDWORD bytesWritten;
>    return ::WriteFile( aFileHandle, data, numOfBytes,
>                        bytesWritten,
>                        NULL );
>  }
>
Technical Details
Message-ID: <jmpapvg0tigrsthluasplsn5cvc3ussvhl@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <7bhapvkde568fjnf10ruf9t114kirltdr5@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6fe7d1767c79674a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-21 10:14:58 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Unexpected Access Violation when calling WriteFile()
Date: Tue, 21 Oct 2003 10:09:07 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <jmpapvg0tigrsthluasplsn5cvc3ussvhl@4ax.com>
References: <7bhapvkde568fjnf10ruf9t114kirltdr5@4ax.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.56.159.172
X-Trace: newsgroups.borland.com 1066756153 65.56.159.172 (21 Oct 2003 10:09:13 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail