* real implementation for FileCreate with ShareMode (plus fix for ShareMode in FileOpen)

git-svn-id: trunk@17565 -
This commit is contained in:
Tomas Hajny 2011-05-26 21:19:20 +00:00
parent cbe040bcc7
commit 5e3ebfab4d

View File

@ -403,10 +403,14 @@ asm
mov ecx, Mode mov ecx, Mode
mov edx, FileName mov edx, FileName
{$ENDIF REGCALL} {$ENDIF REGCALL}
(* DenyAll if sharing not specified. *) (* DenyNone if sharing not specified. *)
test ecx, 112 mov eax, ecx
jnz @FOpen1 xor eax, 112
or ecx, 16 jz @FOpenDefSharing
cmp eax, 64
jbe FOpen1
@FOpenDefSharing:
or ecx, 64
@FOpen1: @FOpen1:
mov eax, 7F2Bh mov eax, 7F2Bh
call syscall call syscall
@ -415,30 +419,42 @@ asm
end {['eax', 'ebx', 'ecx', 'edx']}; end {['eax', 'ebx', 'ecx', 'edx']};
function FileCreate (const FileName: string): longint; assembler; function FileCreate (const FileName: string): longint;
asm begin
push ebx FileCreate := FileCreate (FileName, ofReadWrite or faCreate or doDenyRW, 777);
{$IFDEF REGCALL} (* Sharing to DenyAll *)
mov edx, eax end;
{$ELSE REGCALL}
mov edx, FileName
{$ENDIF REGCALL}
mov eax, 7F2Bh
mov ecx, ofReadWrite or faCreate or doDenyRW (* Sharing to DenyAll *)
call syscall
pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileCreate (const FileName: string; Rights: integer): longint; function FileCreate (const FileName: string; Rights: integer): longint;
begin begin
FileCreate:=FileCreate(FileName); FileCreate := FileCreate (FileName, ofReadWrite or faCreate or doDenyRW,
Rights); (* Sharing to DenyAll *)
end; end;
function FileCreate (const FileName: string; ShareMode : integer; Rights: integer): longint; function FileCreate (const FileName: string; ShareMode: integer; Rights: integer): longint; assembler;
begin asm
FileCreate:=FileCreate(FileName); push ebx
end; {$IFDEF REGCALL}
mov ecx, edx
mov edx, eax
{$ELSE REGCALL}
mov ecx, ShareMode
mov edx, FileName
{$ENDIF REGCALL}
and ecx, 112
or ecx, ecx
jz @FCDefSharing
cmp ecx, 64
jbe @FCSharingOK
@FCDefSharing:
mov ecx, doDenyRW (* Sharing to DenyAll *)
@FCSharingOK:
or ecx, ofReadWrite or faCreate
mov eax, 7F2Bh
call syscall
pop ebx
end {['eax', 'ebx', 'ecx', 'edx']};
function FileRead (Handle: longint; Out Buffer; Count: longint): longint; function FileRead (Handle: longint; Out Buffer; Count: longint): longint;