|
-
May 2nd, 2001, 05:39 PM
#1
Thread Starter
New Member
CreateFile API
I have been trying to get the create file API to work...
However, I seem to be having problems with the GENERIC_READ constant that is set to &H80000000. When I specify that, it loops the value to a -2 billion something. After doing some digging, &H80000000 is the ceiling for a long varriable, but as far as I can tell it should work. Here is the code I was working on:
Public Declare Function CreateFile Lib "kernel32" _
Alias "CreateFileA" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Public Constant GENERIC_READ as Long = &H80000000
Public Constant GENERIC_WRITE as Long = &H40000000
tmp = CreateFile(lpFileName, GENERIC_READ Or GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, ByVal 0)
When I do this, the function fails with a -1 and I can see that GENERIC_READ is negative. Is this how it is suposed to be?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|