ChickenLover
December 27th, 2002, 10:27 PM
i've done this in in VB and now I need to do in VC.
I'm new to Visual C and I just want to share memory with prebuilt c code when it runs. I cant figure out the security structure stuff.
Can some one whip up an example so I call this function from C?
thanks
vb:
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
sub:
usename$ = "myfile"
FileHandle = CreateFile(usename$, GENERIC_READ Or GENERIC_WRITE, _
0, Security, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL Or FILE_FLAG_RANDOM_ACCESS, 0)
end sub
I'm new to Visual C and I just want to share memory with prebuilt c code when it runs. I cant figure out the security structure stuff.
Can some one whip up an example so I call this function from C?
thanks
vb:
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
sub:
usename$ = "myfile"
FileHandle = CreateFile(usename$, GENERIC_READ Or GENERIC_WRITE, _
0, Security, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL Or FILE_FLAG_RANDOM_ACCESS, 0)
end sub