From: "Steve" <cybaflea@hotmail.com>
Subject: Pointers, C, Win32 API
Date: 19 Apr 2005 16:13:38 -0700
Date: 2005-04-19T16:13:38-07:00 [thread overview]
Message-ID: <1113952418.548084.275020@o13g2000cwo.googlegroups.com> (raw)
Hi,
I am fairly new to ADA and have a query.
I am writing a program in ADA to monitor a directory for any changes
using a notification API.
MSDN Samples have a solution called FWATCH and I am basing my code on
this. I understand the C code but I am having problems converting it to
ADA.
Firstly, the C code:
// this is the all purpose structure that contains
// the interesting directory information and provides
// the input buffer that is filled with file change data
typedef struct _DIRECTORY_INFO {
HANDLE hDir;
TCHAR lpszDirName[MAX_PATH];
CHAR lpBuffer[MAX_BUFFER];
DWORD dwBufLength;
OVERLAPPED Overlapped;
} DIRECTORY_INFO, *PDIRECTORY_INFO, *LPDIRECTORY_INFO;
DIRECTORY_INFO DirInfo;
...
// Set up a key(directory info)
hCompPort=CreateIoCompletionPort( DirInfo.hDir,
hCompPort,
(DWORD) &DirInfo,
0);
// Start watching the directory of interest
ReadDirectoryChangesW( DirInfo.hDir,
DirInfo.lpBuffer,
MAX_BUFFER,
TRUE,
FILE_NOTIFY_CHANGE_LAST_WRITE,
&DirInfo.dwBufLength,
&DirInfo.Overlapped,
NULL);
----------------------------------------
Great, all is well. Now here is my attempt at the ADA version:
type DIRECTORY_INFO_T is record
hDir : Win32.Winnt.HANDLE;
lpszDirName : Win32.TCHAR;
lpBuffer : Win32.CHAR;
dwBufLength : Win32.DWORD;
lpOverlapped : Win32.Winbase.LPOVERLAPPED;
end record;
DirInfo : DIRECTORY_INFO_T;
...
// Set up a key(directory info)
hCompPort := Winbase.CreateIoCompletionPort(
FileHandle => DirInfo.hDir,
ExistingCompletionPort => hCompPort,
CompletionKey => ?????,
NumberOfConcurrentThreads => 0);
In ADA how do I do what the 'C' example is doing:
---> (DWORD) &DirInfo,
Cheers
Steve
next reply other threads:[~2005-04-19 23:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-19 23:13 Steve [this message]
2005-04-20 0:00 ` Pointers, C, Win32 API Stephen Leake
2005-04-20 2:44 ` Steve
2005-04-20 23:29 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox