Article View: borland.public.cppbuilder.nativeapi
Article #6845Re: ReadDirectoryChangesW - Access Violation
From: Zoetjuh
Date: Wed, 06 Apr 2005 07:09
Date: Wed, 06 Apr 2005 07:09
27 lines
1834 bytes
1834 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:l88651l95ujrrc182cfcfvtmgl7ns5rst5@4ax.com... > Zoetjuh wrote: > >>Violation error; now I'm not sure what buffersize to use, but this one seems >>to >>suffice: > > No, too small. Way too small. > >> FILE_NOTIFY_INFORMATION *ChangesBuffer = new FILE_NOTIFY_INFORMATION(); >> DWORD ChangesMaxBuffer = sizeof(FILE_NOTIFY_INFORMATION) + MAX_PATH; > > Should be MAX_PATH*2 because the path is WCHARs > Also, ChangesBuffer is too small. It only has room for ONE char of the > returned path!Should be more like > > FILE_NOTIFY_INFORMATION *ChangesBuffer = > > (FILE_NOTIFY_INFORMATION*)GlobalAlloc(GMEM_FIXED,ChangesMaxBuffer); > > Thanks. The Acces Violation is gone, however my filename now has a lot of questionmark at the end. It seems the FileNameLength is incorrect, or I'm not doing the right conversion?
Technical Details
Message-ID:
<42538b29@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<42530459$1@newsgroups.borland.com> <l88651l95ujrrc182cfcfvtmgl7ns5rst5@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,251d042661b6c50d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Zoetjuh" <peter@i-hate-spam.zoetjuh.demon.nl> Newsgroups: borland.public.cppbuilder.nativeapi References: <42530459$1@newsgroups.borland.com> <l88651l95ujrrc182cfcfvtmgl7ns5rst5@4ax.com> Subject: Re: ReadDirectoryChangesW - Access Violation Date: Wed, 6 Apr 2005 09:09:30 +0200 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 NNTP-Posting-Host: 82.161.4.111 Message-ID: <42538b29@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112771369 82.161.4.111 (6 Apr 2005 00:09:29 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail