MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / CreateHandleInt

Method CreateHandleInt

core/logic/HandleSys.cpp:401–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401Handle_t HandleSystem::CreateHandleInt(HandleType_t type,
402 void *object,
403 const HandleSecurity *pSec,
404 HandleError *err,
405 const HandleAccess *pAccess,
406 bool identity)
407{
408 IdentityToken_t *ident;
409 IdentityToken_t *owner;
410
411 if (pSec)
412 {
413 ident = pSec->pIdentity;
414 owner = pSec->pOwner;
415 } else {
416 ident = NULL;
417 owner = NULL;
418 }
419
420 if (!type
421 || type >= HANDLESYS_TYPEARRAY_SIZE
422 || m_Types[type].dispatch == NULL)
423 {
424 if (err)
425 {
426 *err = HandleError_Parameter;
427 }
428 return 0;
429 }
430
431 /* Check to see if we're allowed to create this handle type */
432 QHandleType *pType = &m_Types[type];
433 if (!pType->typeSec.access[HTypeAccess_Create]
434 && (!pType->typeSec.ident
435 || pType->typeSec.ident != ident))
436 {
437 if (err)
438 {
439 *err = HandleError_Access;
440 }
441 return 0;
442 }
443
444 unsigned int index;
445 Handle_t handle;
446 QHandle *pHandle;
447 HandleError _err;
448
449 if ((_err=MakePrimHandle(type, &pHandle, &index, &handle, owner, identity)) != HandleError_None)
450 {
451 if (err)
452 {
453 *err = _err;
454 }
455 return 0;
456 }
457
458 if (pAccess)

Callers 1

CreateIdentityMethod · 0.80

Calls 1

GetAdjustedTimeMethod · 0.80

Tested by

no test coverage detected