Article View: borland.public.cppbuilder.nativeapi
Article #6848Re: ReadDirectoryChangesW - Access Violation
From: Zoetjuh
Date: Wed, 06 Apr 2005 20:12
Date: Wed, 06 Apr 2005 20:12
33 lines
2123 bytes
2123 bytes
"Zoetjuh" <peter@i-hate-spam.zoetjuh.demon.nl> wrote in message news:42538b29@newsgroups.borland.com... > > "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? > Corrected by halving the no. of bytes from FileNameLength
Technical Details
Message-ID:
<425442a7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42530459$1@newsgroups.borland.com> <l88651l95ujrrc182cfcfvtmgl7ns5rst5@4ax.com> <42538b29@newsgroups.borland.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> <42538b29@newsgroups.borland.com> Subject: Re: ReadDirectoryChangesW - Access Violation Date: Wed, 6 Apr 2005 22:12:19 +0200 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 82.161.4.111 Message-ID: <425442a7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112818343 82.161.4.111 (6 Apr 2005 13:12:23 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail