I’m using this code but it always returns false even when it’s Sandboxed. Any ideas?
[code]Public Function IsSandboxed() as Boolean
Declare Function SecCodeCopySelf Lib “Security” (flags as integer, byref proc as ptr) As Integer
Declare Function SecCodeCheckValidity Lib “Security” (code as ptr, flags as integer, requirement as ptr) As Integer
Declare Function SecRequirementCreateWithString Lib “Security” (text as cfstringref, flags as integer, byref requirement as ptr) As Integer
dim myProc as ptr
dim res As integer
dim req As ptr
res=SecCodeCopySelf(0,myProc) //get a code object for the current process
res=res+SecRequirementCreateWithString(“com.apple.security.app-sandbox”,0,req) //create a code requirement
res=res+SecCodeCheckValidity(myProc,0,req) //check the validity with a requirement
if res<>0 then Return false //error or failure… in either case, we failed!
Return True
End Function[/code]