Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Prototype for CreateFileA


1 reply to this topic

GeoffreyF67

GeoffreyF67
  • Members
  • 8 posts

Posted 31 December 2002 - 19:24

I've got the code below.  When I make the call to CreateFileA I get an error that the system can't find the file specified.  I'm guessing it's because Iv'e got the CreateFileA prototype written incorrectly.  Any help would be greatly appreciated.  I've tried both BYVAL and BYREF in the first parameter.

prototype CloneTimeStamp(STRING, STRING);
prototype LONG kernel32.CreateFileA(BYVAL STRING, LONG, LONG, POINTER, LONG, LONG, LONG);
prototype LONG kernel32.GetFileTime(LONG, LONG, LONG, LONG);
prototype LONG kernel32.SetFileTime(LONG, LONG, LONG, LONG);
prototype LONG kernel32.CloseHandle(LONG);
prototype LONG kernel32.GetLastError();

typedef FILETIME
begin
LONG dwHighDateTime;
LONG dwLowDateTime;
end;

function CloneTimeStamp(sSource, sTarget)
LONG hSrc;
LONG hDest;
FILETIME CreationTime;
FILETIME LastAccessTime;
FILETIME LastWriteTime;
STRING sMsg;
begin
#define READ_WRITE 0x03
#define ACCESS_TYPE 0x08 | 0x10 | 0x080 | 0x100
//#define OPEN_EXISTING 0x03

hSrc = CreateFileA(sSource,ACCESS_TYPE, READ_WRITE,NULL,OPEN_EXISTING,NULL,NULL);

if hSrc = -1 then
sMsg = FormatMessage(Err.LastDllError);
MessageBox(sMsg,INFORMATION);
endif;

hDest = CreateFileA(sTarget,ACCESS_TYPE, READ_WRITE,NULL, OPEN_EXISTING,NULL,NULL);
GetFileTime(hSrc,&CreationTime,&LastAccessTime,&LastWriteTime);
SetFileTime(hDest,&CreationTime,&LastAccessTime,&LastWriteTime);
CloseHandle(hSrc);
   CloseHandle(hDest);
end;

GeoffreyF67

GeoffreyF67
  • Members
  • 8 posts

Posted 31 December 2002 - 19:38

Hehehe....ever have one of those DUH!!! moments?

It helps if I pass the correct path/file to the function :)

DUH!!!

G-Man