PspSetProcessShortName

CHAR __stdcall PspSetProcessShortName(_EPROCESS *Process, _UNICODE_STRING *ProcessName){
  wchar_t *Buffer; 
  unsigned __int8 *ImageFileName; 
  unsigned __int8 *v4; 
  unsigned __int64 v5; 
  unsigned __int8 *v6; 
  unsigned __int64 v7; 
  unsigned __int64 v8; 

  Buffer = ProcessName->Buffer;
  ImageFileName = Process->ImageFileName;
  v4 = (unsigned __int8 *)Buffer + ProcessName->Length;
  LODWORD(v5) = 0;
  if( Buffer )
  {
    if( v4 > (unsigned __int8 *)Buffer )
    {
      while( 1 )
      {
        v6 = v4;
        v4 -= 2;
        if( *(_WORD *)v4 == 92 )
          break;
        LODWORD(v5) = v5 + 1;
        if( v4 <= (unsigned __int8 *)Buffer )
          goto LABEL_7;
      }
      v4 = v6;
LABEL_7:
      if( (unsigned int)v5 >= 0xF )
        LODWORD(v5) = 14;
    }
    v7 = (unsigned int)v5;
    v8 = 0i64;
    v5 = (unsigned __int64)&ImageFileName[(unsigned int)v5];
    if( (unsigned __int64)ImageFileName > v5 )
      v7 = 0i64;
    if( v7 )
    {
      do
      {
        LOBYTE(v5) = *v4;
        ++v8;
        *ImageFileName = *v4;
        v4 += 2;
        ++ImageFileName;
      }
      while( v8 < v7 );
    }
  }
  *ImageFileName = 0;
  return v5;
}

Referenced by:

PspInitializeFullProcessImageName
PspSetMinimalProcessName