Process Hacker
utils.c
Go to the documentation of this file.
1 /*
2  * Process Hacker Extended Tools -
3  * utility functions
4  *
5  * Copyright (C) 2011 wj32
6  *
7  * This file is part of Process Hacker.
8  *
9  * Process Hacker is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * Process Hacker is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "exttools.h"
24 
26  _In_ ULONG64 ValuePerPeriod,
27  _Inout_ PPH_STRING *Buffer,
28  _Out_opt_ PPH_STRINGREF String
29  )
30 {
31  ULONG64 number;
32 
33  number = ValuePerPeriod;
34  number *= 1000;
35  number /= PhGetIntegerSetting(L"UpdateInterval");
36 
37  if (number != 0)
38  {
39  PH_FORMAT format[2];
40 
41  PhInitFormatSize(&format[0], number);
42  PhInitFormatS(&format[1], L"/s");
43  PhMoveReference(Buffer, PhFormat(format, 2, 0));
44 
45  if (String)
46  *String = (*Buffer)->sr;
47  }
48 }