IopDeviceObjectFromSymbolicName

DEVICE_OBJECT *__stdcall IopDeviceObjectFromSymbolicName(UNICODE_STRING *SymbolicLinkName){
  DEVICE_OBJECT *v1; 
  WCHAR *PoolWithTag; 
  WCHAR *v4; 
  int ObjectProperty; 
  struct _UNICODE_STRING DestinationString; 
  int v8; 
  int v9; 
  WCHAR *OutString; 
  v1 = 0i64;
  v9 = 0;
  OutString = 0i64;
  DestinationString = 0i64;
  if( SymbolicLinkName )
  {
    if( SymbolicLinkName->Buffer )
    {
      if( SymbolicLinkName->Length )
      {
        if( (int)PnpUnicodeStringToWstr(&OutString, 0i64, SymbolicLinkName) >= 0 )
        {
          v8 = 400;
          PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, 0x190ui64, 0x47706E50ui64);
          v4 = PoolWithTag;
          if( PoolWithTag )
          {
            ObjectProperty = PnpGetObjectProperty(
                               PiPnpRtlCtx,
                               (__int64)OutString,
                               3i64,
                               0i64,
                               0i64,
                               (__int64)&DEVPKEY_Device_InstanceId,
                               &v9,
                               (unsigned __int64)PoolWithTag,
                               v8,
                               (ULONG *)&v8,
                               0);
            PnpUnicodeStringToWstrFree(OutString, SymbolicLinkName);
            if( ObjectProperty >= 0 && v9 == 18 && (int)RtlInitUnicodeStringEx(&DestinationString, v4) >= 0 )
              v1 = (DEVICE_OBJECT *)PnpDeviceObjectFromDeviceInstanceWithTag((INT64)&DestinationString, 0x746C6644ui64);
            ExFreePoolWithTag(v4, 0x47706E50u);
          }
        }
      }
    }
  }
  return v1;
}

Referenced by:

IopGetSessionIdFromSymbolicName