Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b85018e

Browse files
author
Andrew Zenin
committed
Update ZENDAPI.pas
1 parent 618d3b6 commit b85018e

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

‎Source/ZENDAPI.pas

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ procedure CheckZendErrors;
876876
zend_ini_deactivate : function(TSRMLS_D : pointer) : integer; cdecl;
877877

878878
function GetGlobalResource(resource_name: AnsiString) : pointer;
879-
879+
functionGetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : pointer;
880880
function GetCompilerGlobals : Pzend_compiler_globals;
881881
function GetExecutorGlobals : pzend_executor_globals;
882882
function GetAllocGlobals : pointer;
@@ -1595,10 +1595,13 @@ function ZendToVariant(const Value: pppzval): Variant; overload;
15951595
S: String;
15961596
begin
15971597
case {$IFDEF PHP7} Value^^^.u1.v._type {$ELSE}Value^^^._type{$ENDIF} of
1598+
0: Result := Null;
15981599
1: Result := Value^^^.value.lval;
15991600
2: Result := Value^^^.value.dval;
1600-
6: begin S := Value^^^.value.str.val; Result := S; end;
1601-
4,5: Result := Null;
1601+
3: Result := boolean(Value^^^.value.lval);
1602+
8: begin S := Value^^^.value.str.val; Result := S; end;
1603+
6: begin S := Value^^^.value.str.val; Result := S; end
1604+
else Result := Null;
16021605
end;
16031606
end;
16041607

@@ -3631,6 +3634,31 @@ function GetGlobalResource(resource_name: AnsiString) : pointer;
36313634
end;
36323635
end;
36333636

3637+
function GetGlobalResourceDC(resource_name: AnsiString;TSRMLS_DC:pointer) : pointer;
3638+
var
3639+
global_id : pointer;
3640+
global_value : integer;
3641+
global_ptr : pointer;
3642+
begin
3643+
Result := nil;
3644+
try
3645+
global_id := GetProcAddress(PHPLib, zend_pchar(resource_name));
3646+
if Assigned(global_id) then
3647+
begin
3648+
global_value := integer(global_id^);
3649+
asm
3650+
mov ecx, global_value
3651+
mov edx, dword ptr TSRMLS_DC
3652+
mov eax, dword ptr [edx]
3653+
mov ecx, dword ptr [eax+ecx*4-4]
3654+
mov global_ptr, ecx
3655+
end;
3656+
Result := global_ptr;
3657+
end;
3658+
except
3659+
Result := nil;
3660+
end;
3661+
end;
36343662

36353663
function GetCompilerGlobals : Pzend_compiler_globals;
36363664
begin

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /